Hi,
i'm a newbie to XSLT and trying to learn new things. recently I've encountered a case where in i should apply a for each loop and concat strings using 'and' keyword. Below is a part of my xml document.
<?xml version="1.0" encoding="utf-8"?><case.ref.no.group><case.ref.no><prefix>Civil Appeal</prefix><number>W-02-887</number><year>2008</year></case.ref.no><case.ref.no><prefix>Civil Appeal</prefix><number>W-02-888</number><year>2008</year></case.ref.no></case.ref.no.group>
and i tried the below xslt on it.
<xsl:template match="case.ref.no.group"><xsl:variable name="pre"><section class="sect2"><xsl:text disable-output-escaping="yes">Court of Appeal</xsl:text></section></xsl:variable><xsl:variable name="tex"><xsl:value-of select="./case.ref.no/prefix"/></xsl:variable><xsl:variable name="iter"><xsl:value-of select="./case.ref.no/number"/><xsl:if test="following::case.ref.no/number">;</xsl:if></xsl:variable><xsl:variable name="year"><xsl:value-of select="./case.ref.no/year"/></xsl:variable><div class="para"><xsl:value-of select="concat($pre,' – ',$tex,' Nos. ',$iter,'-',$year)"/></div></xsl:template>
when i try to run it it is giving me the below output.
Court of Appeal – Civil Appeal Nos. W-02-887 2008
but i want it to be as below.
Court of Appeal – Civil Appeal Nos. W-02-887-2008 and W-02-888-2008
please let me know how i can achieve this. i'm doing this in xslt 1.0.
Thanks,
Sunny