How can I map xmlns: * attributes to XSLT?

How can I map xmlns: * attributes with XSLT 1.0? Using an RDF document, I tried:

<xs:template match="rdf:RDF">
(...)
<xsl:for-each select="@*">
  <xsl:value-of select="."/>
</xsl:for-each>
(...)
</xsl:template>

but it does not work for xmlns attributes .

Thank.

+3
source share
2 answers

The xmlns attributes are not normal attributes; they are namespace declarations. To access them, you must use the axis of the namespace.

eg:.

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

You cannot directly, but look at namespaceaxis:

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

Source: https://habr.com/ru/post/1729076/


All Articles