Is it possible to remove xml attributes from XSLT AND work with the resulting transform?
In other words, I have the following XML:
<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type="text/xsl" href="XML_TEST.xslt"?>
<report xmlns="abc123">
<book>
<page id="22">
</page>
<page id="23">
</page>
</book>
</report>
I know that I can use the following XSLT to strip the attributes:
<xsl:template match ="@*" >
<xsl:attribute name ="{local-name()}" >
<xsl:value-of select ="." />
</xsl:attribute>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match ="*" >
<xsl:element name ="{local-name()}" >
<xsl:apply-templates select ="@* | node()" />
</xsl:element>
</xsl:template>
But if I wanted to read the values, using the following template
<xsl:template match="report">
<xsl:for-each select="book/page">
<xsl:value-of select="@id"/>
</xsl:for-each>
</xsl:template>
Could I chain that template to the output of the first two?
Thanks in advance,
-R.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…