home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / XML Utilities / Professional Programmer XSL IDE / Xselerator25.msi / Data.Cab / F45660_xsGroupingPositional.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2001-03-05  |  1.3 KB  |  53 lines

  1. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  2.   <xsl:output method="html" />
  3.  
  4.   <xsl:template match="/">
  5.     <xsl:apply-templates select="/rs/z" />
  6.   </xsl:template>
  7.  
  8.   <xsl:template match="z[position() mod 3 = 1]">
  9.     <xsl:variable name="thisGroup"
  10.     select=".|following::z[position() < 3]" />
  11.  
  12.     <table>
  13.       <tr>
  14.         <xsl:apply-templates select="$thisGroup" mode="header" />
  15.       </tr>
  16.  
  17.       <xsl:for-each select="@*[name() != 'date']">
  18.         <tr>
  19.           <xsl:apply-templates select="$thisGroup" mode="row">
  20.             <xsl:with-param name="breakfType" select="name()" />
  21.           </xsl:apply-templates>
  22.         </tr>
  23.       </xsl:for-each>
  24.     </table>
  25.   </xsl:template>
  26.  
  27.   <xsl:template match="z" mode="header">
  28.     <xsl:if test="position()=1">
  29.       <td>Breakfast Type</td>
  30.     </xsl:if>
  31.  
  32.     <td>
  33.       <xsl:value-of select="@date" />
  34.     </td>
  35.   </xsl:template>
  36.  
  37.   <xsl:template match="z" mode="row">
  38.     <xsl:param name="breakfType" />
  39.  
  40.     <xsl:if test="position()=1">
  41.       <td>
  42.         <xsl:value-of select="$breakfType" />
  43.       </td>
  44.     </xsl:if>
  45.  
  46.     <td>
  47.       <xsl:value-of select="@*[name()=$breakfType]" />
  48.     </td>
  49.   </xsl:template>
  50. </xsl:stylesheet>
  51.  
  52.  
  53.