C
Chris
Hi,
I just would like to iterate through some attributes of a tag
(Section). Sometimes I only need one attribute and sometimes I need
all attributes.
In a xslaram I declare the attribute name for the selection. So it's
no problem if I only search for one attribute. But what can I declare
in the same parameter when I need all attributes? As an expression I
could write @* for all attributes. But I can't put that sign as value
in the parameter -> Path Error.
I appreciate any help!
XML-File:
----------
<Main>
<Section id='basic'/>
<Section id='test'/>
<Section id='test2'/>
</Main>
XSL-File:
----------
<xsl:template match="Main">
<xslaram name="searchID" select="'basic'"/>
<!-- For all attributes -> I can't set @* as parameter value
<xsl:for-each select="Section[@id=@*]">
-->
<!-- For only one attribute -->
<xsl:for-each select="Section[@id=$searchID]">
<b>
<xsl:value-of select="@id" />
</b>
<br/>
</xsl:for-each>
</xsl:template>
I just would like to iterate through some attributes of a tag
(Section). Sometimes I only need one attribute and sometimes I need
all attributes.
In a xslaram I declare the attribute name for the selection. So it's
no problem if I only search for one attribute. But what can I declare
in the same parameter when I need all attributes? As an expression I
could write @* for all attributes. But I can't put that sign as value
in the parameter -> Path Error.
I appreciate any help!
XML-File:
----------
<Main>
<Section id='basic'/>
<Section id='test'/>
<Section id='test2'/>
</Main>
XSL-File:
----------
<xsl:template match="Main">
<xslaram name="searchID" select="'basic'"/>
<!-- For all attributes -> I can't set @* as parameter value
<xsl:for-each select="Section[@id=@*]">
-->
<!-- For only one attribute -->
<xsl:for-each select="Section[@id=$searchID]">
<b>
<xsl:value-of select="@id" />
</b>
<br/>
</xsl:for-each>
</xsl:template>