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

Re: Connecting the Source and Destination fields

Subject: Re: Connecting the Source and Destination fields
From: Ronan Klyne <ronan.klyne@xxxxxxxxxxx>
Date: Mon, 20 Aug 2007 10:02:21 +0100
Re:  Connecting the Source and Destination fields
Andrew Welch wrote:
> On 8/20/07, Yaswanth <yaswanth.mtrx@xxxxxxxxx> wrote:
>> Hi Ronan and Andrew,
>> Thanks for the Help.
>> I am able to get the exact result .
>> I am working on it . I think I need to understand XSL:Key ..
>> I will look into it..
>> Ronan , Thanks for the brilliant solution !
> 
> If you did want to use a  key then all you need to do is define the key:
> 
> <xsl:key name="conn-by-source" match="connection" use="@source"/>
> 
> then put this wherever you want your output:
> 
> <xsl:text>event.0</xsl:text>
> <xsl:apply-templates select="key('conn-by-source', 'event.0')"/>
> 
> and have this template:
> 
> <xsl:template match="connection">
> 	<xsl:text> -> </xsl:text>
> 	<xsl:value-of select="@destination"/>
> 	<xsl:apply-templates select="key('conn-by-source', @destination)"/>
> </xsl:template>
> 
> and thats it - no need for recursive named templates: the "recursion"
> stops when the key doesn't return an element for a given string.
> 

A much cleaner solution than mine - very nice...
Out of curiosity, how would your solution change if we couldn't
guarantee that event.0 would be first? I couldn't express that
particularly elegantly either...

	# r

-- 
Ronan Klyne
Business Collaborator Developer
Tel: +44 (0)870 163 2555
ronan.klyne@xxxxxxxxxxx
www.groupbc.com

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.