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: grouping headers


watch for line wraps.

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                version="1.0">

  <xsl:output method="html"/>
  <xsl:template match="person" mode="content">
    <tr><td>    <xsl:value-of select="name"/></td></tr>
  </xsl:template>
  <xsl:template match="person">
    <tr><td>
    <b> <xsl:value-of select="city"/></b></td></tr>
    <xsl:apply-templates select="/people/person[city = current()/city]"
mode="content"/>
    <xsl:text>
    </xsl:text>
  </xsl:template>

  <xsl:template match="/people">
    <html>
      <body bgcolor="#FFFFFF">
        <xsl:element name="table">
          <xsl:attribute name="rules">all</xsl:attribute>
          <xsl:attribute name="border">1</xsl:attribute>
        <xsl:apply-templates
select="person[preceding-sibling::person[city]!=city]">
          <xsl:sort select="city"/>
        </xsl:apply-templates>
      </xsl:element>
      </body>
    </html>
  </xsl:template>

</xsl:stylesheet>


Dan

 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]