Relative context from root element : context « XSLT stylesheet « XML






Relative context from root element

File: Data.xml

<wine grape="Chardonnay">
  <product>product 2</product>
  <year>1997</year>
  <price>10.99</price>
</wine>


File: Transform.xslt

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="1.0">
  <xsl:output method="xml" omit-xml-declaration="yes" indent="no" />
  <xsl:template match="wine/year">
    <vintage>
      <xsl:apply-templates />
    </vintage>
  </xsl:template>

</xsl:stylesheet>

Output:

  product 2
  <vintage>1997</vintage>
  10.99

 








Related examples in the same category

1.Relative context