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

Suggestion: transparent id-ref traversal with XPath?

Subject: Suggestion: transparent id-ref traversal with XPath?
From: Gunther Schadow <gunther@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 19 May 2003 16:05:45 -0500
transparent id
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


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.