Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


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

From: Arndt Jonasson <arndt.jonasson@-----.--->
To: NULL
Date: 7/5/2007 1:32:00 PM

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:

<top>
  <friends>
    <friend>
      <name1>Joe</name1>
      <name2>Anderson</name2>
    </friend>
    <friend>
      <name1>Paul</name1>
      <name2>Bright</name2>
    </friend>
  </friends>
  <addresses>
    <address>
      <name>Joe</name>
      <moredata>/top/friends/friend[name1=$./../name]</moredata>
      <street>Wilson St.</street>
      <number>15</number>
    </address>
  </addresses>
</top>

The string "/top/friends/friend[name1=$./../name]" could be what
I want, except that the "$." thing is an invention. The contents
of /top/friends/addresses/address[name="Joe"]/moredata is
meant to be an XPath expression pointing out the node
/top/friends/friend[name1="Joe"], based on the fact that when looking
at /top/friends/addresses/address[name="Joe"]/moredata, "../name" has
the contents "Joe".

I could invent a syntax (like $. above), but I'd like to use existing
syntax if there is any. I'm not familiar enough with XPointer or
XQuery
to know whether they can express this. Can they? I don't see that
XPath alone is enough. Thanks in advance for any suggestions.



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