Subject:wrapping table rows and mismatched end-tag errors Author:Michael Cepek Date:08 Nov 2011 03:45 PM Originally Posted: 08 Nov 2011 03:46 PM
I'm using for-each to generate table cells. I want at most 10 cells per row. But StylusStudio doesn't like it when I conditionally end and then restart the table row. It complains that the enclosing tag isn't terminated properly. Here's the transform code snippet:
<table>
<tr>
<xsl:for-each select="//blah">
<xsl:if test="position()!=1 and (position() mod 10)=1">
</tr><tr>
</xsl:if>
The error generated (against the close-tr tag line) is:
SXXP0003: Error reported by XML parser: The element type "xsl:if" must be terminated by the matching end-tag "</xsl:if>"
I've tried a number of things that didn't help:
- commenting out <xsl:output method="html">
- wrapping the </tr><tr> tags in <xsl:text>
- using </tr><tr>
- looking for an option to disable enforced tag pairing
This seems to be a StylusStudio issue, as the XSL editor itself is quite insistent on having matched tags.
Note that changing the </tr><tr> line in my snippet above to <td>WRAP</td> works as expected.
How can I accomplish my goal of restarting the table row within the loop? Thanks.
Subject:wrapping table rows and mismatched end-tag errors Author:Michael Cepek Date:10 Nov 2011 09:55 AM
Thanks Ivan. I see how to do it. I find it curious how the construct of the language (XSLT) forces the use of a nested loop to solve this simple problem.
For those playing along at home, here's the translation of my original post that works.
And the following is Ivan's example code that you can copy and paste. It can be run against the books.xml file in the 'examples' directory that comes with StylusStudio.