[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: How do I change a XSL style sheet to group data t

Subject: Re: How do I change a XSL style sheet to group data together under one heading
From: "kieters c" <kieters@xxxxxxxxxxx>
Date: Fri, 18 May 2007 12:10:01 +0000
Re:  How do I change a XSL style sheet to group data  t
Good day,

Thank you for the information. I have changed it accordingly and nothing seems to happen. I have checked to see if I did everything, checked for any inconsistancies like an extra bracket but still nothing happened. I replace every instance of "sample_date_time" with "concat(sample_date_time, cp_name)".

This is what I have done
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="1.0">

<xsl:output method="xml" indent="yes"/>

<!-- the key determines (here) what to group by -->

<xsl:key name="sample" match="sample" use="concat(sample_date_time, cp_name)" />

  <xsl:template match="/">
      <submission imis_company_code="0001843309" ws_name="LENNOX">
          <xsl:apply-templates />
      </submission>
  </xsl:template>

<xsl:template match="dataroot">

<!-- the actual 'group by' construct -->
<xsl:for-each select="sample[generate-id() = generate-id(key('sample', concat(sample_date_time, cp_name)[1])]">
<xsl:copy>
<!-- date-time must become an attribute -->
<xsl:apply-templates select="concat(sample_date_time, cp_name)" />


<!-- find all samples with equal date time -->
<xsl:apply-templates select="key('sample', concat(sample_date_time, cp_name))" />
</xsl:copy>
</xsl:for-each>
</xsl:template>


<!-- match the sample's that are grouped -->
<xsl:template match="sample">
<result>
<xsl:apply-templates select="*[not(self::concat(sample_date_time, cp_name))]" />
</result>
</xsl:template>


  <!-- any direct child of 'sample' must be turned into an attribute -->
  <xsl:template match="sample/*">
      <xsl:attribute name="{name()}">
          <xsl:value-of select="."/>
      </xsl:attribute>
  </xsl:template>

</xsl:stylesheet>

Regards.

Hennie

_________________________________________________________________
Message offline contacts without any fire risk! http://www.communicationevolved.com/en-za/


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.