RE: [xsl] empty row between types

Subject: RE: [xsl] empty row between types
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 8 Dec 2006 20:24:19 -0000
add

<xsl:if test="@type != preceding-sibling::row[1]/@type">
  <tr><td/></tr>
</xsl:if>

Michael Kay
http://www.saxonica.com/
 

> -----Original Message-----
> From: scarleton@xxxxxxxxx [mailto:scarleton@xxxxxxxxx] On 
> Behalf Of Sam Carleton
> Sent: 08 December 2006 19:21
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] empty row between types
> 
> Here is my data:
> 
> <data>
>   <row type="red"></row>
>   <row type="red"></row>
>   <row type="red"></row>
>   <row type="blue"></row>
>   <row type="blue"></row>
>   <row type="blue"></row>
> </data>
> 
> What I want is a blank row between the red and the blue:
> 
> <table border="1">
>     <tr><th>Color</th></tr>
>     <tr><td>red</td></tr>
>     <tr><td>red</td></tr>
>     <tr><td>red</td></tr>
>     <tr><td></td></tr>
>     <tr><td>blue</td></tr>
>     <tr><td>blue</td></tr>
>     <tr><td>blue</td></tr>
> </table>
> 
> Here is the good old basic XSLT, that does not include the 
> empty row between:
> 
> <xsl:template match="data">
>     <html>
>       <body>
>         <table border="1">
>           <tr><th>Color</th></tr>
>           <xsl:apply-templates/>
>         </table>
>       </body>
>     </html>
>   </xsl:template>
> 
>   <xsl:template match="row">
>   <tr><td><xsl:value-of select="@type"/></td></tr>
>   </xsl:template>
> 
> How do I go about getting the empty row.  Oh, there is one catch, I do
> *NOT* know what the types are or when they will change.  I 
> only know there *MIGHT* be different types, might not.
> 
> P.S. I am working with the Microsoft .Net 2.0 XSLT 
> Transformer, IE XSLT 1.
> 
> Sam
> --
> Miltonstreet Photography
> http://www.miltonstreet.com

Current Thread