Hi,
Say I have the following XML:
<a>
<b>1</b>
<b>2</b>
<b>3</b>
</a>
... and require:
Header
1
2
3
... but an xslt like:
<xsl:template match = "/" >
<xsl:variable name="headed" select="false()"/>
<xsl:for-each select = "a/*" >
<xsl:if test="not($headed)">
<xsl:text>Header</xsl:text>
<!--
this next line causes a problem due to
the attempted reassignment of $headed
-->
<xsl:variable name="headed" select="true()"/>
</xsl:if>
<xsl:value-of select="." />
<xsl:value-of select="'
'"/>
</xsl:for-each>
</xsl:template>
is invalid, can anybody recommend a brief and readable solution? and perhaps a good book to learn a functional mindset from :)
Cheers
Simon
------------------------------ addendum --------------------------
After pondering the answers I've been presented with I realised I've lost some of the key components of the problem I was trying to tackle.
my data is more like:
<address>
<line1>street</line1>
<line2>town</line2>
<line3>city</line3>
<country>uk</country>
</address>
and my desired output is more like:
<table>
<tr><td rowspan="6" valign="top">Address</td><td>street</td></tr>
<tr><td>town</td></tr>
<tr><td>city</td></tr>
<tr><td>uk</td></tr>
</table>
any further help would be greatly appreciated.