How to retrive the id attribute of the root node of a xml usin开发者_运维技巧g XSL?
How to retrive the id attribute of the root node of a xml using XSL?
You mean ... of the top element. The root node is not an element and cannot have attributes.
This simple XPath expression selects the id
attribute of the top element of any XML document:
/*/@id
In XSLT, one will use:
<xsl:variable name="vsomeName" select="/*/@id"/>
or
<xsl:copy-of select="/*/@id"/>
or
<xsl:value-of select="/*/@id"/>
精彩评论