|
Subject: [xsl] Conditional tagging in xsl:for-each From: Jan Eden <lists@xxxxxxxxxxx> Date: Mon, 12 Dec 2005 21:30:55 +0100 |
Hi,
I am new to XSLT, so please forgive me if this is a FAQ (I have found no
useful reference on the web). I have the following XML source (snippet):
<children>
<child id="870">
<file>dscn1095.jpg</file>
<title>Some text.</title>
</child>
<child id="871">
<file>dscn1100.jpg</file>
<title>More text</title>
</child>
<child id="872">
<file>dscn1101.jpg</file>
<title>Still more text.</title>
</child>
The children should be transformed into a two-column table. I tried this,
which makes the XSLT processors choke:
<xsl:template match="page[@type='galleries']/children">
<table><tr>
<xsl:for-each select="child">
<td><img><xsl:attribute name="src"><xsl:value-of select="file"
/></xsl:attribute></img><xsl:value-of select="title" /></td>
<xsl:if test="not(position() mod 2)"></tr><tr></xsl:if>
</xsl:for-each>
</tr></table>
</xsl:template>
Obviously, they don't like the closing </tr> tag following my <xsl:if>. While
I see the reason for the error, I cannot find a way around it. Is there a way
to achieve what I want with XSLT?
Thanks,
Jan
--
There are 10 kinds of people: those who understand binary, and those who
don't
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] group-starting-with probl, Michael Kay | Thread | RE: [xsl] Conditional tagging in xs, Michael Kay |
| RE: [xsl] group-starting-with probl, Michael Kay | Date | RE: [xsl] Conditional tagging in xs, Michael Kay |
| Month |