[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Outputting closing HTML table tags conditionally

Subject: Outputting closing HTML table tags conditionally
From: Mark Jordan <mjordan@xxxxxx>
Date: Sat, 29 Nov 2003 14:35:23 -0800
closing html
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">
    &lt;/tr>&lt;/table>&lt;table>&lt;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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.