Find parent tag xslt
How to get the parent node of a particular tag type . For ex- Input XML is below-
<table type="SPECIALMATERIALtbl" UID="2001">
<row class="FIGURE" type="SPECIALMATERIALrow">
<cell class="FIGURE" colspan="7">
This is a cell
</cell>
</row>
</table>
So, I want to get the type attribute of 'table' element above when I am inside the cell template in XSLT. I want to do this only for开发者_JAVA百科 parent element of type - 'table' . So the output to above should be- "SPECIALMATERIALtbl"
Awaiting a response.
With <cell>
being the context node, <xsl:value-of select="ancestor::table/@type"/>
returns what you want.
精彩评论