开发者

How can I match the xmlns:* attributes with XSLT?

开发者 https://www.devze.com 2022-12-17 00:59 出处:网络
How can I match the xmlns:* attributes with XSLT 1.0 ? Using a RDF document I tried: <xs开发者_StackOverflow社区:template match=\"rdf:RDF\">

How can I match the xmlns:* attributes with XSLT 1.0 ? Using a RDF document I tried:

<xs开发者_StackOverflow社区:template match="rdf:RDF">
(...)
<xsl:for-each select="@*">
  <xsl:value-of select="."/>
</xsl:for-each>
(...)
</xsl:template>

but it doesn't seem to work for the xmlns attributes.

Thanks.


The xmlns attributes aren't normal attributes, they are namespace declarations. You need to use the namespace axis to access them.

e.g.:

<xsl:for-each select="namespace::*">
   <xsl:value-of select="name()" />
</xsl:for-each>


You can't directly, but have a look at the namespace axis:

<xsl:for-each select="namespace::*">
    <xsl:value-of select="."/>
</xsl:for-each>
0

精彩评论

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