xsl-list
[Top] [All Lists]

RE: [xsl] Trouble creating tables while looping through elements

2010-05-10 03:57:54
Hi Charles,

It doesn’t seem right to me that you create a tbody for each node.  A table 
typically has 1 <thead> and 1 <tbody> tag.

If you want to create different tables for different nodes based on some 
condition it's best to create different templates using specific predicates.

<xsl:template match="node[condition predicitate 1]">
  <table>
   ...
  </table>
</xsl:template>

<xsl:template match="node[condition predicitate 2]">
  <table>
   ...
  </table>
</xsl:template>

Cheers,
Robby Pelssers

-----Original Message-----
From: Charles-Louis De Maere 
[mailto:charles-louis(_dot_)demaere(_at_)ehealth(_dot_)fgov(_dot_)be] 
Sent: Monday, May 10, 2010 10:14 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Trouble creating tables while looping through elements

Dear all,

I'm looping through a (sorted) list of nodes, and would like to put them 
in different tables based on a certain condition using xslt.

At the moment, I'm doing the following :

<table>
<xsl:for-each select="node">
<tbody>
         ... some formatting ...
</tbody>
<xsl:if test="not(subnode = following-sibling::node/subnode)">
</table>
<h2>Some Title</h2>
<table>
</xsl-if>
</xsl:for-each>
</table>

However, this XSLT file is invalid (XMLSpy indicates a warning when I 
save it, because of the closing <table> tag underneath the if-test), and 
Firefox refuses to display it for the same reason.

Is there any easy way to have some kind of separation within the 
for-each loop, or should I take this formatting out of the loop ?


Thanks in advance,

Charles-Louis de Maere



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>