如何在XSLT子节点读取父节点的属性(How to read attribute of a pare

2019-07-17 17:30发布

只是想知道如何在XSLT子节点读取父节点的属性。 码:

<A>
  <b attr1="xx">
    <c>
    </c>
  </b>
</A>

XSLT:

<xsl:template match="c">
  <xsl:value-of select="attribute of b node">
</xsl:template>

Answer 1:

你可以去“上”使用水平“ .. ”。 所以:

<xsl:value-of select="../@attr1"/>


文章来源: How to read attribute of a parent node from a child node in XSLT
标签: xslt xpath