p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   XSLT (http://p2p.wrox.com/forumdisplay.php?f=86)
-   -   XML List -> HTML table (http://p2p.wrox.com/showthread.php?t=6188)

JPMRaptor November 14th, 2003 09:49 PM

XML List -> HTML table
I'm trying to create a 3 column HTML table from an xml list. The source XML looks something like:
 <child id="1"/>
 <child id="2"/>

I have a template setup to output the needed info for each child but can't figure out how to generate the proper "tr" tags to break things into rows.

So far my best try looks like:
 <xsl:template match="root">
      <xsl:for-each select="child">

       <xsl:if test="0 = ((position()-1) mod 2)">
         <xsl:apply-templates select="." />
         <xsl:apply-templates select="following-sibling::child" />

What I end up with from this is for each node matching the mod test it runs my child template for all nodes after that. The following-sibling call is the one causing the multiple calls to the child template.

I'm using the jdk 1.4.2_02 bundled XSLT engine.

JPMRaptor November 14th, 2003 10:19 PM

Never mind, found the solution in the archives:

All times are GMT -4. The time now is 08:36 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.