|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Outputting closing HTML table tags conditionally
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








