With XSL you can modify any source text and produce different output from the same source file : Introduction « XSLT stylesheet « XML Tutorial






"//title" matches any title element anywhere in the document.
"//author" matches any author element anywhere in the document.
"/" matches the root element.


File: Data.xml

<data>
    <title>XSL</title>
    <author>John Smith</author>
</data>
File: Transform.xslt

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
      <h1>
        <xsl:value-of select="//title"/>
      </h1>
      <h2>
        <xsl:value-of select="//author"/>
      </h2>
    </xsl:template>

    <xsl:template match="/">
      <h2>
        <xsl:value-of select="//author"/>
      </h2>
      <h1>
        <xsl:value-of select="//title"/>
      </h1>
    </xsl:template>

</xsl:stylesheet>

Output:

<?xml version="1.0" encoding="UTF-8"?><h2>John Smith</h2><h1>XSL</h1>








5.1.Introduction
5.1.1.With XSL you can modify any source text and produce different output from the same source file
5.1.2.Every XSL stylesheet must start with xsl:stylesheet element
5.1.3."xsl:template xsl:value-of"
5.1.4."xsl:value-of xsl:apply-templates"
5.1.5.Insert html tags into template
5.1.6.Batch-Processing Nodes