Subject: Re: [xsl] Identity Transform Grouping Question From: David Carlisle <davidc@xxxxxxxxx> Date: Wed, 13 Oct 2004 17:17:27 +0100 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Identity Transform Grouping Q, ethan.kalfus | Thread | Re: [xsl] Identity Transform Groupi, ethan.kalfus |
RE: [xsl] Problem using Position() , Pieter Reint Siegers | Date | RE: [xsl] xsl:number with level=any, Michael Kay |
Month |