开发者

How to retrieve the id attribute of the root node of a xml using XSL?

开发者 https://www.devze.com 2023-01-01 04:52 出处:网络
How to retrive the id attribute of the root node of a xml usin开发者_运维技巧g XSL? How to retrive the id attribute of the

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"/>
0

精彩评论

暂无评论...
验证码 换一张
取 消