|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Specify/determine element's "logical" parent
Hi John,
Is this possible and/or a bad idea? I read that XPath statements cannot be dynamic, so I imagine I have to use parentid attributes rather than parentpath, then somehow map the ID to an actual node; does that make sense? I also see the potential for infinite recursion; any suggestions on that topic would be appreciated. It would certainly be easiest to use the parentid attribute. To do that, all you have to do is set up a key that indexes the <item> elements based on their id attribute: <xsl:key name="items" match="item" use="@id" /> and to get the parent of a particular item, use the key() function with the parentid attribute: key('items', @parentid) Parsing XPath using XSLT is possible but difficult. You're probably best off using an extension dyn:evaluate() function to do so. If you're using a small subset of XPath then you can alternatively use recursive templates to step through the path and parse it as you go. See my reply in the thread "generate-id for identical elements" for an example of how that might be done. I'm not sure where the infinite recursion might occur, unless you want to get the parent of the parent once you find it? Cheers, Jeni -- Jeni Tennison http://www.jenitennison.com
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








