Get attribute from different level : Attribute « XSLT stylesheet « XML

Get attribute from different level

File: Data.xml

<data grape="A">
  <winery year="1998">B</winery>

File: Transform.xslt

<xsl:stylesheet xmlns:xsl=""
  <xsl:output method="xml" omit-xml-declaration="yes" indent="no" />

  <xsl:template match="winery">
      <xsl:value-of select="@year" />
      <xsl:value-of select="../@grape" />





Related examples in the same category attribute value
2.List the attribute names and values
3.if there is an attribute
4.Get value of attribute with @ node by attribute value
6.Set attribute value in tranformation
7.attribute omitted
8.get attribute name