gchq/CyberChef

Operation request: XSLT processor

Open

#418 aperta il 20 nov 2018

Vedi su GitHub
 (0 commenti) (0 reazioni) (0 assegnatari)JavaScript (3944 fork)batch import
help wantedoperation

Metriche repository

Star
 (34.843 star)
Metriche merge PR
 (Merge medio 57g 13h) (62 PR mergiate in 30 g)

Descrizione

Summary

An operation to process XSLT over XML input.

https://en.wikipedia.org/wiki/XSLT

Example

Input

<?xml version="1.0" ?>
<persons>
  <person username="JS1">
    <name>John</name>
    <family-name>Smith</family-name>
  </person>
  <person username="MI1">
    <name>Morka</name>
    <family-name>Ismincius</family-name>
  </person>
</persons>

XSLT

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="xml" indent="yes"/>

  <xsl:template match="/persons">
    <root>
      <xsl:apply-templates select="person"/>
    </root>
  </xsl:template>

  <xsl:template match="person">
    <name username="{@username}">
      <xsl:value-of select="name" />
    </name>
  </xsl:template>

</xsl:stylesheet>

Output

<?xml version="1.0" encoding="UTF-8"?>
<root>
  <name username="JS1">John</name>
  <name username="MI1">Morka</name>
</root>

Guida contributor