attribute omitted : Attribute « XSLT stylesheet « XML






attribute omitted


File: Data.xml

<wine price="10.99" year="1997">A</wine>

File: Transform.xslt

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

  <xsl:template match="wine">
    <wine vintage="{@year}">
      <xsl:apply-templates />
    </wine>
  </xsl:template>

</xsl:stylesheet>

Output:

<?xml version="1.0" encoding="UTF-8"?><wine vintage="1997">A</wine>

 








Related examples in the same category

1.compare attribute value
2.Get attribute from different level
3.List the attribute names and values
4.if there is an attribute
5.Get value of attribute with @
6.select node by attribute value
7.Set attribute value in tranformation
8.get attribute name