This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: rookie questions - Try 2


> Currently each time it loops through the results a </TR> is 
> inserted to end the row in a html table.  How would I modify the style
sheet 
> to insert that tag every other time it loops through?

First you need to understand that stylesheets don't write tags, they write
nodes to a tree. Creating a TR element node is one operation, you can't
split it into writing a start tag and an end tag.

You want to create a TR element node for every 2 items in the input, so the
simplest way to do it is along the lines:

<xsl:template match="item[position() mod 2 = 0]">
   <tr>
   <td><xsl:value-of select="."/></td>
   <td><xsl:value-of select="following-sibling::item"/></td>
   </tr>
</xsl:template>

<xsl:template match="item[position() mod 2 != 0]"/>

Mike Kay


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]