[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Generating a unique listing of elements from multi

Subject: Re: Generating a unique listing of elements from multiple sets
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 24 Jan 2007 18:18:38 GMT
Re:  Generating a unique listing of elements from multi
Your input wasn't well formed but after fixing that, i think this does
what you want. Th e"uniqueness" aspect is automatic given xpath1's node
set semantics as sets never have repeated values.


<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  
<xsl:key name="c" match="country" use="@id"/>
<xsl:key name="cg" match="countryGroup" use="@groupID"/>

 <xsl:template match="data">
   <xsl:apply-templates select="businesses/business"/>
 </xsl:template>

 <xsl:template match="business">
   <xsl:text>&#10;</xsl:text>
   <xsl:value-of select="name"/>
   <xsl:text>: </xsl:text>
   <xsl:for-each select="key('c',key('cg',countryGroup/@included)/country/@included)">
     <xsl:value-of select="."/>
     <xsl:text> </xsl:text>
   </xsl:for-each>
 </xsl:template>

</xsl:stylesheet>

$ saxon gm.xml gm.xsl
<?xml version="1.0" encoding="utf-8"?>
Acme: United States Mexico 
Another Acme: Canada Mexico 


David

oops I just use saxon on the command line, silly me:-)

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.