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

Re: Grouping repeating elements

Subject: Re: Grouping repeating elements
From: tcn@xxxxxxxxxxxxx (Trevor Nash)
Date: Thu, 12 Jul 2001 19:14:59 GMT
selecting repeating elements in xslt
On Thu, 12 Jul 2001 03:00:37 -0700 (PDT), Till wrote:

>Hi Trevor
>
>thanks for the help.
>
>> So, add a further condition that the <name> node
>> before the one you
>> have found is the same node as the one matched in
>> your template: use
>> preceding-sibling and generate-id().
>
>I managed to create the result tree with:
>
><xsl:copy-of select=".">
><xsl:copy-of
>select="following-sibling"::FirstName[1]/>
><xsl:copy-of select="following-sibling"::Age[1]
>generate-id(prededing-sibling::Name[1])=generate-id(current())]/>
>
Well done.

>Is it possible to apply further templates to the
>result-tree - or do I have to create a new
>xml-document with the result-tree first and then apply
>a second stylesheet to that new document?
>
In standard XSLT, thats your only option. But assuming you want to
process a person at a time, you can put the result inside an
xsl:variable.  Strictly speaking the only thing you can do with this
is copy it unchanged to the result tree, but most processors have a
function like node-set() which you can use like this:

  <xsl:variable name="tree">
        <person>
               <xsl:copy-of ... />
        </person>
  </xsl:variable>
  <xsl:apply-templates select="xx:node-set($tree)" />

The 'xx' depends on your processor - read the docs carefully to see
exaclty what needs to be done here.  Some even let you get away with
  <xsl:apply-templates select="$tree" />
because thats how they think its going to be in the next version of
the XSLT spec.

Hint: because you are going to process the same elements (e.g. age)
again, you may need to use modes.

Regards,
Trevor Nash
--
Traditional training & distance learning,
Consultancy by email

Melvaig Software Engineering Limited
voice:     +44 (0) 1445 771 271 
email:     tcn@xxxxxxxxxxxxx

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.