05-26-2004, 01:01 AM | #1 (permalink) |
Crazy
Location: europe
|
[xslt] grouping elements (newbie question)
hi there
i'm a java guy but i have to do a project in xslt (conversion of xml documents) and i'm stuck : input file is more or less this <records> <record> <element1>lorem ipsum</element1> <element1>lorem ipsum</element2> <element1>lorem ipsum</element3> <element1>lorem ipsum</element4> <element1>lorem ipsum</element5> <element1>lorem ipsum</element6> <element1>lorem ipsum</element7> <element1>lorem ipsum</element8> <element1>lorem ipsum</element9> <element1>lorem ipsum</element9> <element1>lorem ipsum</element9> <element1>lorem ipsum</element9> </record> <record> <element1>lorem ipsum</element1> <element2>lorem ipsum</element2> <element3>lorem ipsum</element3> <element4>lorem ipsum</element4> <element5>lorem ipsum</element5> <element6>lorem ipsum</element6> <element7>lorem ipsum</element7> <element8>lorem ipsum</element8> <element9>lorem ipsum</element9> <element9>lorem ipsum</element9> <element9>lorem ipsum</element9> <element9>lorem ipsum</element9> </record> <record> <element1>lorem ipsum</element1> <element2>lorem ipsum</element2> <element3>lorem ipsum</element3> <element4>lorem ipsum</element4> <element5>lorem ipsum</element5> <element6>lorem ipsum</element6> <element7>lorem ipsum</element7> <element8>lorem ipsum</element8> <element9>lorem ipsum</element9> <element9>lorem ipsum</element9> <element9>lorem ipsum</element9> </record> </records> now all i have left to do is group the element9 objects in a <question> object. ==> <record> <element1>lorem ipsum</element1> <element2>lorem ipsum</element2> <element3>lorem ipsum</element3> <element4>lorem ipsum</element4> <element5>lorem ipsum</element5> <element6>lorem ipsum</element6> <element7>lorem ipsum</element7> <element8>lorem ipsum</element8> <vraag> <element9>lorem ipsum</element9> <element9>lorem ipsum</element9> <element9>lorem ipsum</element9> <element9>lorem ipsum</element9> </vraag> </record> anyone have a clue how to do ? thanx in advance
__________________
--- this space for rent --- pm me |
05-29-2004, 06:32 AM | #2 (permalink) |
Insane
Location: Belgium
|
hmm I should look up the details, but at first sight I would create use xpath to select all element9 elements...
Code:
<xsl:element name = "vraag"> <xsl:for-each select="element9"> <xsl:template-match /> <xsl:for-each/> </xsl:element>
__________________
Let's GO |
Tags |
elements, grouping, newbie, question, xslt |
|
|