Subject: [xsl] Outputting closing HTML table tags conditionally From: Mark Jordan <mjordan@xxxxxx> Date: Sat, 29 Nov 2003 14:35:23 -0800 |
Hello, I've looked through the FAQ and tried searching http://www.biglist.com/lists/xsl-list/archives/ but I don't believe the archive search is working (even searching for 'html' returned 0 hits). I am having trouble understanding how to output closing HTML tags within an <xsl:if> block. My input XML has a number of <image> tags, and the stylesheet works perfectly except that I can't output HTML that begins with closing tags in the <xsl:if> block. No matter what variation I use, Saxon gives up a "required string (expected "xsl:if")" error. My stylesheet (with XML declaration, <xsl:output> and root template XSL ommitted) is: <table><tr> <xsl:for-each select="image"> <td>Image <xsl:value-of select="position()"/> / <xsl:value-of select="last()"/></td> <!-- BEGIN SECTION GIVING ME PROBLEMS --> <xsl:if test="position() mod 4 = 0"> </tr></table><table><tr> </xsl:if> <!-- END SECTION GIVING ME PROBLEMS --> </xsl:for-each> </tr></table> I have tried using: <xsl:if test="position() mod 4 = 0"> <xsl:text></tr></table><table><tr></xsl:text> </xsl:if> and <xsl:if test="position() mod 4 = 0"> </tr></table><table><tr> </xsl:if> to no avail. Adding <xsl:output method="text"/> might do it, but then my other HTML tags are stripped. The desired output is to add '</tr></table><table><tr>' at every 4th match on <image>, as in the following exacmple output: <table> <tr><td>Image 1 / 5</td> <td>Image 2 / 5</td> <td>Image 3 / 5</td> <td>Image 4 / 5</td> </tr> </table> <table><tr> <td>Image 5 / 5</td> </tr></table> Anybody have any suggestions? All I want to do is output '</tr></table><table><tr>' within xsl:if. Mark Mark Jordan Acting Coordinator of Library Systems W.A.C. Bennett Library, Simon Fraser University Burnaby, British Columbia, V5A 1S6, Canada Phone (604) 291 5753 / Fax (604) 291 3023 mjordan@xxxxxx / http://www.sfu.ca/~mjordan/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Formatting white space wi, David Carlisle | Thread | Re: [xsl] Outputting closing HTML t, G. Ken Holman |
[xsl] XSL-List Guidelines, Mulberry Technologie | Date | Re: [xsl] Outputting closing HTML t, G. Ken Holman |
Month |