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

Re: Group by Element based on Attribute inside contain

Subject: Re: Group by Element based on Attribute inside container using 1.0
From: Michael Ludwig <mlu@xxxxxxxxxxxxx>
Date: Thu, 06 Nov 2008 19:29:44 +0100
Re:  Group by Element based on Attribute inside contain
Friend, Darris E schrieb:
I am using 1.0 and can not use 2.0. [...] I can not alter the XML

The verbosity and redundancy of the XML vocabulary you have to deal with makes this a bit tedious.

The following produces more or less the desired output:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"

<xsl:output method="text"/>

  match="ObjectClassField[ @name = 'Valve Number']"


  use="ObjectClassField[ @name = 'Valve Number']"/>

 <xsl:template match="/">
  <xsl:for-each select="
   //ObjectClassField[ @name = 'Valve Number']">
   <xsl:sort select="." data-type="number"/>
   <xsl:if test="
    generate-id() =
    generate-id( key( 'valves-by-number', .)[1])">
    <xsl:text>Valve Number: </xsl:text>
    <xsl:value-of select="."/>
    <!-- inspections -->
    <xsl:for-each select="key( 'inspections-by-valve-number', .)">
     <xsl:sort select="concat(
      substring( ObjectClassField[ @name = 'Date Inspected'], 6, 4),
      substring( ObjectClassField[ @name = 'Date Inspected'], 1, 2),
      substring( ObjectClassField[ @name = 'Date Inspected'], 4, 2))"/>
     <xsl:apply-templates select="."/>

 <xsl:template match="ObjectClassRow">
  <!-- Extend this to display more information. -->
  <xsl:value-of select="ObjectClassField[ @name = 'Date Inspected']"/>


I would be nice to be able to use a variable in the xsl:sort that
rearranges the date as in:

 name="d" select="ObjectClassField[ @name = 'Date Inspected']"/>
<xsl:sort select="concat( substring( $d, 6, 4)), ... "/>

But that is not possible. If MSXML for IE6 has EXSLT or another
extension function facility, you could use that to write a function
to rearrange the date and then sort by select="my:iso-date( $d)".

Michael Ludwig

Current Thread


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.
First Name
Last Name
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.