Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - How to point to an element using context-dependent information? [Thread Next] Re: How to point to an element using context-dependent information?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 | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
