Hello Everyone.
I'm new to XSL and couldn't get something to work. [Not sure if this is the right way to go about it...]
Sample XML excerpt:
My intent is to build a list of drop downs (# of drop downs = # of NodeTypes) based on those defined in the template. Using "xsl:for-each" and "xsl:elemen t", I could build 2 drop downs. But I cannot figure out how to pass the select clause a different node type.
Line 4 is probably what is wrong in my approach. Any help in this regard is welcome.
Thanks in advance,
Parag
I'm new to XSL and couldn't get something to work. [Not sure if this is the right way to go about it...]
Sample XML excerpt:
Code:
<root> <ObjectTemplate> <NodeType1></NodeType1> <NodeType2></NodeType2> </ObjectTemplate> <Object> <NodeType1>N11</NodeType1> <NodeType2>N12</NodeType2> </Object> <Object> <NodeType1>N21</NodeType1> <NodeType2>N22</NodeType2> </Object> </root>
Code:
<xsl:for-each select="/root/ObjectTemplate/*">
<xsl:element name="select">
<xsl:variable name="myNodeType"><xsl:value-of select="name(.)"/></xsl:variable>
<xsl:for-each select="concat('/root/Object/',$myNodeType)">
<xsl:element name="option"><xsl:value-of select="."/></xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:for-each>
Thanks in advance,
Parag
Comment