xsl-list
[Top] [All Lists]

RE: Suggestion: transparent id-ref traversal with XPath?

2003-05-20 04:07:05
Hi.

-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com 
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of 
Gunther Schadow
Sent: Monday, May 19, 2003 10:06 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] 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 *[(_at_)id=key('ship',@id)/@ref]/mapLocation  or
*[(_at_)id=key('ship',@id)/@ref]/mapLocation | key('ship',@id)/mapLocation

The same could be done in shippingAdress:
*[(_at_)ref=key('bill',@ref)/@id]/mapLocation  or
*[(_at_)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



<Prev in Thread] Current Thread [Next in Thread>