E
eric.goforth
Hello,
I have some xml data that look like:
<currencysummary rec_count="16">
<currency>
<currency_description>$</_currency_description>
<currency_code>1</_currency_code>
</currency>
<currency>
<currency_description>£</_currency_description>
<currency_code>2</_currency_code>
</currency>
<currency>
<currency_description>€</_currency_description>
<currency_code>3</_currency_code>
</currency>
<currency>
<currency_description>$</_currency_description>
<currency_code>4</_currency_code>
</currency>
</currencysummary>
I'd like to get it to look like:
<table cellpadding="2" cellspacing="0" border="0">
<tr><td>1$</td><td>2£</td></tr>
<tr><td>3€</td><td>4$</td></tr>
</table>
I've tried
<table cellpadding="2" cellspacing="0" border="0">
<xsl:for-each select="/page/contents/currencysummary/currency">
<xsl:choose>
<xsl:when test="((currency_code mod 2) = 0)">
<td><xsl:value-of
select="currency_code"></xsl:value-of><xsl:value-of
select="currency_description"></xsl:value-of></td></tr>
</xsl:when>
<xsltherwise>
<tr><td><xsl:value-of
select="currency_code"></xsl:value-of><xsl:value-of
select="currency_description"></xsl:value-of></td>
</xsltherwise>
</tr>
</xsl:choose>
</xsl:for-each>
</table>
But the xml parser doesn't like it because I have incomplete <tr> tags.
I also tried doing a CDATA around the beginning and ending <tr> tags.
Does anyone know how to do this?
-Eric
I have some xml data that look like:
<currencysummary rec_count="16">
<currency>
<currency_description>$</_currency_description>
<currency_code>1</_currency_code>
</currency>
<currency>
<currency_description>£</_currency_description>
<currency_code>2</_currency_code>
</currency>
<currency>
<currency_description>€</_currency_description>
<currency_code>3</_currency_code>
</currency>
<currency>
<currency_description>$</_currency_description>
<currency_code>4</_currency_code>
</currency>
</currencysummary>
I'd like to get it to look like:
<table cellpadding="2" cellspacing="0" border="0">
<tr><td>1$</td><td>2£</td></tr>
<tr><td>3€</td><td>4$</td></tr>
</table>
I've tried
<table cellpadding="2" cellspacing="0" border="0">
<xsl:for-each select="/page/contents/currencysummary/currency">
<xsl:choose>
<xsl:when test="((currency_code mod 2) = 0)">
<td><xsl:value-of
select="currency_code"></xsl:value-of><xsl:value-of
select="currency_description"></xsl:value-of></td></tr>
</xsl:when>
<xsltherwise>
<tr><td><xsl:value-of
select="currency_code"></xsl:value-of><xsl:value-of
select="currency_description"></xsl:value-of></td>
</xsltherwise>
</tr>
</xsl:choose>
</xsl:for-each>
</table>
But the xml parser doesn't like it because I have incomplete <tr> tags.
I also tried doing a CDATA around the beginning and ending <tr> tags.
Does anyone know how to do this?
-Eric