[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Grouping repeating elements
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|