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

RE: Suggestion: transparent id-ref traversal with XPat

Subject: RE: Suggestion: transparent id-ref traversal with XPath?
From: "Americo Albuquerque" <aalbuquerque@xxxxxxxxxxxxxxxx>
Date: Sun, 20 Jul 2003 11:54:12 +0100
ref id
Hi.

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Gunther Schadow
> Sent: Monday, May 19, 2003 10:06 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Suggestion: transparent id-ref traversal with XPath?
> 
> 
(...)
> Now this is easy to do with some ID/IDREF trick:
> 
> <order>
>    <billingAddress id="1">
>       ...
>    </billingAddress>
>    <shippingAddress ref="1"/>
> </order>
> 

You could use keys:
<xsl:key name="bill" match="billingAddress" use="@id"/>
<xsl:key name="ship" match="shippingAddress" use="@ref"/>

And use key('ship',@id) to get the shippingAddress from billingAdress or
key('bill',@ref) to get billingAdrress from shippingAdrress

The xpath will be *[@id=key('ship',@id)/@ref]/mapLocation  or
*[@id=key('ship',@id)/@ref]/mapLocation | key('ship',@id)/mapLocation

The same could be done in shippingAdress:
*[@ref=key('bill',@ref)/@id]/mapLocation  or
*[@ref=key('bill',@ref)/@id]/mapLocation | key('bill',@ref)/mapLocation

Hope this helps

  Americo Albuquerque




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.