开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜