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

Re: Identity Transform Grouping Question

Subject: Re: Identity Transform Grouping Question
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 13 Oct 2004 17:17:27 +0100
identity transform xslt
   if the current node is the last in a group with the same
   /names/name[@lang='en'] value, then closing tag should be inserted here
                                                                    -->

Whenever anyone mentions the word "tag" in connection with xslt (which
happens most days:-) it's almost always a sign that the design thinking
is wrong, XSLT can not access the tags in the source document, and it
can't directly generate tags in the result.

XSLT inputs a node tree (typically but not always generated by an XML
parser reading tags in an XML file) and generates a result tree, which
might (it's an optional feature of an XSLT system) be linearised back to
an XML file using tags as a final stage (conceptually) after the
transformation. But the transformation itself just concerns trees.

Node trees don't contain markup, so don't have tags, and you can't have
half a node, so you can never insert a closing tag anywhere, in
particular you can't insert one at the location of this comment.

The way to put a group of nodes as child elements of another node
is to first create the wrapper node
<foo>
 then inside that select all the elements that should go in the group
</foo>


Jeni's site has lots of discussion on this gropuing technique:
http://www.jenitennison.com/xslt/grouping/index.html
(Your code was a bit big to debug by eye, and also written for msxml
which doesn't run on this linux box.)

actually I'm not sure _why_ you are using msxsl:node-set()

    <xsl:variable name="rtf">
                                    <temp>
                                       <xsl:copy-of select="offices/office"/>
                                    </temp>
                                 </xsl:variable>
                                 <xsl:for-each
                                    select="msxsl:node-set($rtf)/temp/office/cities...

That's quite expensive having to copy all teh nodes, and then you don't
seem to do anything with the new tree that you have created.

It looks equivalent to


                                 <xsl:for-each
                                 select="offices/office/cities...

except you'd have to remove temp/ from your key definition, to match.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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.