Skip to content

IdentityXSLT

Steve Ball edited this page Oct 1, 2021 · 3 revisions

The identity XSLT stylesheet

The identity stylesheet takes a source XML document and produces as the result document an exact copy of the input.

Here is the stylesheet:

<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="3.0">

  <xsl:template match="*|@*">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

</xsl:stylesheet>

To get this working, we need:

  • matching attributes
  • attribute pattern
  • attribute nodes
  • built-in templates
  • template priorities
  • xsl:copy element
  • Union XPath operator
Clone this wiki locally