fliptight
09-10-2008, 02:34 PM
New to XML and I am having trouble googling for how to do this... say the XML had something like this
<myxml>
<section>
Some Content
<section>Some Subsection Content</section>
<section>Some Subsection Content2</section>
</section>
<section>
Some Content2
</section>
</myxml>
I've been able to recursively iterate through the sections and subsections with something like this:
<xsl:template match="/">
<xsl:apply-templates select="myxml/section" />
</xsl:template>
<xsl:template match="section">
<p><xsl:value-of select="." /></p>
<xsl:apply-templates select="section" />
</xsl:template>
What if i wanted to iterate over and display those same nodes again (in the same xsl stylesheet) but with a different template that styled it differently... how would i do that? how would i get another template to still match those nodes but override the first one?
<myxml>
<section>
Some Content
<section>Some Subsection Content</section>
<section>Some Subsection Content2</section>
</section>
<section>
Some Content2
</section>
</myxml>
I've been able to recursively iterate through the sections and subsections with something like this:
<xsl:template match="/">
<xsl:apply-templates select="myxml/section" />
</xsl:template>
<xsl:template match="section">
<p><xsl:value-of select="." /></p>
<xsl:apply-templates select="section" />
</xsl:template>
What if i wanted to iterate over and display those same nodes again (in the same xsl stylesheet) but with a different template that styled it differently... how would i do that? how would i get another template to still match those nodes but override the first one?