Forum Moderators: phranque
My XML looks kinda like this:
<things>
<doodads>
<grommit type="plastic"/>
<grommit type="metal" />
<grommit type="wood" />
<grommit type="silly putty" />
</doodads>
</things>
What I need to do is display something like this:
- my plastic grommit
- my metal grommit
- my wood grommit
- my silly putty grommit
Ideally I'd like this XSL to work on the server, so I can use ASP to transform it:
xml.transformNode(xsl)
I've been hacking through tutorials on the <xsl:for-each > and <xsl:value-of> for a long time, and still nothing is working. I'm at my wit's end.
HELP!
[w3schools.com...]
Is it something like this you are looking for?
<xsl:for-each select="doodads/grommit">
- my <xsl:value-of select="@type"/> grommit<fo:block/>
</xsl:for-each>
This example goes on your <things> being the report-root and your document starting with <xsl:template match="things">
-George
<xsl:template match="things">
<ul>
<xsl:apply-templates select="doodads/grommit" />
</ul>
</xsl:template>
<xsl:template match="grommit">
<li>
<xsl:text>my </xsl:text>
<xsl:value-of select="@type" />
<xsl:text> grommit</xsl:text>
</li>
</xsl:template>