![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries [Thread Prev] >Thread Next - Re: Multiple Groupings with Muenchian Method Multiple Groupings with Muenchian MethodTo: NULL Date: 9/3/2007 5:35:00 AM
A newbies question on multiple groupings:
Input XML:
<?xml version="1.0" encoding="utf-8"?>
<root>
<a title="Heavy Vehicle Driver Fatigue Reform Information">
<g compliance_issue_title="Transport of Materials and Goods">
<j titlelong="Commonwealth of Australia" />
</g>
<g compliance_issue_title="Working Hours">
<j titlelong="Commonwealth of Australia" />
</g>
</a>
<a title="Marine and Safety Regulations - Collision">
<g compliance_issue_title="Transport of Materials and Goods">
<j titlelong="New South Wales" />
<j titlelong="Tasmania" />
</g>
<g compliance_issue_title="Emergency Preparedness and Response">
<j titlelong="New South Wales" />
<j titlelong="Tasmania" />
</g>
</a>
<a title="Road Transport (Mass, Loading and Access) Amendment
Regulation - Fees">
<g compliance_issue_title="Transport of Materials and Goods">
<j titlelong="New South Wales" />
</g>
</a>
</root>
Output :
<root>
<g> "Transport of Materials and Goods"
<j> "Commonwealth of Australia"
<a title="Heavy Vehicle Driver Fatigue Reform Information"/>
</j>
<j> "New South Wales"
<a title="Marine and Safety Regulations - Collision"/>
<a title="Road Transport (Mass, Loading and Access) Amendment
Regulation - Fees"/>
</j>
<j>"Tasmania"
<a title="Marine and Safety Regulations - Collision"/>
</j>
</g>
<g> "Working Hours"
<j>"Commonwealth of Australia"
<a title="Heavy Vehicle Driver Fatigue Reform Information"/>
</j>
</g>
<g"Emergency Preparedness and Response"
<j>"New South Wales"
<a title="Marine and Safety Regulations - Collision"/>
</j>
<j>"Tasmania"
<a title="Marine and Safety Regulations - Collision"/>
</j>
</g>
</root>
The XSLT I got to :
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/
Transform">
<xsl:key name="bpjur" match="//j" use="concat(../
@compliance_issue_title,'',@titlelong)" />
<xsl:template match="/">
<root>
<xsl:for-each select="//j[generate-id() = generate-id(key('bpjur',
concat(../@compliance_issue_title,'',@titlelong))[1])]">
<g>
<xsl:value-of select ="../@compliance_issue_title"/>
<j>
<xsl:value-of select ="@titlelong"/>
</j>
</g>
</xsl:for-each>
</root>
</xsl:template>
</xsl:stylesheet>
Which gives me the following output:
<?xml version="1.0" encoding="utf-8"?>
<root>
<g>Transport of Materials and Goods
<j>Commonwealth of Australia</j>
</g>
<g>Working Hours
<j>Commonwealth of Australia</j>
</g>
<g>Transport of Materials and Goods
<j>New South Wales</j>
</g>
<g>Transport of Materials and Goods
<j>Tasmania</j>
</g>
<g>Emergency Preparedness and Response
<j>New South Wales</j>
</g>
<g>Emergency Preparedness and Response
<j>Tasmania</j>
</g>
</root>
Which looks promising as it has not displayed the last nodeset of :
<g>Transport of Materials and Goods
<j>Tasmania</j>
But this is where I get stuck, I dont know how to group this resultset
to first display the unique <g> elements followed by <j> elements and
then the a/@title below it.
Any help would be appreciated.
-regrads,
Rohit
| ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||
|
