1. stylesheet_1-input.xml

  2. <?xml version="1.0"?>
  3. <products>
  4.   <product>
  5.     <name>Delta</name>
  6.   </product>
  7. </products>
  1. stylesheet_1-stylesheet.xsl

  2. <?xml version="1.0"?>
  3. <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  4.   <xsl:template match="/">
  5.     <Products>
  6.       <Product>
  7.         <Name>
  8.           <xsl:value-of select="products/product/name"/>
  9.         </Name>
  10.       </Product>
  11.     </Products>
  12.   </xsl:template>
  13. </xsl:stylesheet>
  1. stylesheet_1-output.xml

  2. <?xml version="1.0" encoding="UTF-8"?>
  3. <Products><Product><Name>Delta</Name></Product></Products>


Note that if we don't use xsl:output to control serialization, it defaults to XML, the use of the XML declaration, the use of UNICODE, and no indention (one long line).

The element xsl :transform can be used as an alias for xsl:stylesheet. Stupid to have two element names for the same element. The name xsl:transform is hardly ever used and should have been deleted from the spec.

Updated 2009-03-19