Forum Moderators: open
I have a simple XSLT...
My XML is similar to this one (note the ID in the tag)
<vdms>
<vdm id="51833">
<text>My text</text>
</vdm>
<vdm id="75835">
<text>Another text</text>
</vdm>
<vdms> Now, I just want to pick the ID and create another HTML tag with the same ID (so that I can use the getElementByID)
<xsl:for-each select="vdms/vdm">
<p id="<xsl:value-of select="@id" />"><xsl:value-of select="text" /></span></p>
</xsl:for-each> But this doesn't work...
Any idea on what I should do to inset a value-of in the ID and get something like.
<p id="51833">My text</p>
<p id="75835">Another text</p> Thanks
The solution is to use <xsl:attribute>
W3C >> [w3schools.com...]
And have something like this.
<xsl:for-each select="vdms/vdm">
<p><xsl:attribute name="id"><xsl:value-of select="@id" /></xsl:attribute></p>
</xsl:for-each> Tomda
Keep with it - the payoff is worth the effort.
And get yourself a cool XSLT debugger like <oXygen/>, Stylus Studio, Visual Studio, XSLerator, or something like that. It'll make the climb easier.