[xsl] Re: Suggestion: transparent id-ref traversal with XPath?

Subject: [xsl] Re: Suggestion: transparent id-ref traversal with XPath?
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Tue, 20 May 2003 06:25:45 +0200
Why don't you use the id() function?

This can also be done using xsl:key and the key() function.


=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL


"Gunther Schadow" <gunther@xxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:3EC94729.9050101@xxxxxxxxxxxxxxxxxxxxxxxxx
> Hi, just to bounce off an idea. Suppose I have this very simplified
> use case:
>
> <order>
>    <billingAddress>
>       ...
>    </billingAddress>
>    <shippingAddress>
>       ...
>    </shippingAddress>
> </order>
>
> and suppose I am tracking addresses as location objects with lots
> of data such as, street, telephone number, GPS location, map drawing,
> picture of the front of the builing and other stuff (hey this is
> just an example, my real use case is special.) The point is this:
> in a significant number of cases one address will be the SAME
> (= IDENTICAL) address-object and I may not want to have to repeat
> its data for both in an instance. The reason is not just to save
> space but also because I know that the two addresses are IDENTICAL
> I don't want to send two copies of them.
>
> Now this is easy to do with some ID/IDREF trick:
>
> <order>
>    <billingAddress id="1">
>       ...
>    </billingAddress>
>    <shippingAddress ref="1"/>
> </order>
>
> when it comes to XSLT and writing XPath expression, however, things
> get more complicated now. I now have to add conditional paths that
> go
>
> order/shippingAddress/mapLocation
>
> or
>
> *[@id="order/shippingAddress/@ref]/mapLocation
>
> Wouldn't it be cool if one could somehow specify in XSLT that there
> are certain links that XPath could translate?
>
> In this case I could somewhere say:
>
> <x:xpath-view map="order/shippingAddress" select="*[@id=this()/@ref]"/>
>
> and then the XPath engine would handle this transparently? Well,
> I suppose I could also do this union instead:
>
> order/shippingAddress/mapLocation
> |*[@id="order/shippingAddress/@ref]/mapLocation
>
> but it is more tedious.
>
> regards,
> -Gunther
>
> -- 
> Gunther Schadow, M.D., Ph.D.                    gschadow@xxxxxxxxxxxxxxx
> Medical Information Scientist      Regenstrief Institute for Health Care
> Adjunct Assistant Professor        Indiana University School of Medicine
> tel:1(317)630-7960                         http://aurora.regenstrief.org
>
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>




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


Current Thread