Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


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

From: Peter Flynn <peter.nosp@-.--------.-->
To: NULL
Date: 7/14/2007 8:52:00 PM

Arndt Jonasson wrote:
> 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. 

If you only want links within the document, just us ID and IDREF 
attribute types.

<top>
   <friends>
     <friend ID="JA1">
       <name1>Joe</name1>
       <name2>Anderson</name2>
     </friend>
     <friend>
       <name1>Paul</name1>
       <name2>Bright</name2>
     </friend>
   </friends>
   <addresses>
     <address>
       <name>Joe</name>
       <moredata see="JA1"/>
       <street>Wilson St.</street>
       <number>15</number>
     </address>
   </addresses>
</top>

But there are other, probably much more efficient ways to do this.

///Peter
-- 
XML FAQ: http://xml.silmaril.ie/


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