Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: How to point to an element using context-dependent information?

From: Pavel Lepin <p.lepin@-------.--->
To: NULL
Date: 7/5/2007 5:07:00 PM


Arndt Jonasson <arndt.jonasson@g...> wrote in
<1183642341.069392.220360@w...>:
> Say I have an XML document, where I want the contents of
> certain elements
> to be a textual pointer to another element, based on the
> contents of yet another element. Somewhat silly example:

[snip]
 
> The string "/top/friends/friend[name1=$./../name]" could
> be what I want, except that the "$." thing is an
> invention.

XSLT defines several extensions to XPath, including
current() function. Taking a look at XPointer/XLink/XQuery
is probably a much better idea, though.

However. Are you certain you want to do something like that
at all? That is, do you want to allow pointers to anything
in the document (and perhaps *beyond* the document, if you
allow document() or somesuch as well)? Perhaps it would be
a better idea to define a more structured grammar
for 'links', and let your application logic handle the
actual processing.

For example:

<moredata><friends/></moredata>

Upon seeing that, your applications would know they should
look up the corresponding friends. If you needed to link
something else as well, you would define more elements and
the logic for processing them as well:

<moredata><friends/><borks foobarcity="42"/></moredata>

(Supposedly linking all the Joe's borks with foobarcity of
42 or more... whatever that means.)

-- 
Pavel Lepin


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent