I need some help here. I'm kinda new to XSLT.
I know in 2.0 you can use For-Each-Group which would solve my problem, but I'm limited to 1.0.
What I need to to group a flat XML using something like "group-starting-with" function.
This is only an example, but my real problem is very similar.
I have this XML:
<?xml version="1.0" encoding="UTF-8"?>
<catalog>
<xpto name="1">ABC</xpto>
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
<xpto name="2">ABC</xpto>
<xpto name="1">ABC</xpto>
<title>Hide your heart</title>
<artist>Bob Dylan</artist>
<country>UK</country>
<company>CBS Records</company>
<price>9.90</price>
<year>1988</year>
<xpto name="2">ABC</xpto>
</catalog>
And I want it to be:
<?xml version="1.0" encoding="UTF-8"?>
<catalog>
<group>
<xpto name="1">ABC</xpto>
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
<xpto name="2">ABC</xpto>
</group>
<group>
<xpto name="1">ABC</xpto>
<title>Hide your heart</title>
<artist>Bob Dylan</artist>
<country>UK</country>
<company>CBS Records</company>
<price>9.90</price>
<year>1988</year>
<xpto name="2">ABC</xpto>
</group>
</catalog>
So I want to group the elements every time the following appears:
<xpto name="1">ABC</xpto>
Is there any way to do this with XSLT 1.0?
Thank you very much!