[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Specify/determine element's "logical" parent

Subject: Specify/determine element's "logical" parent
From: "john-xsl-list" <john-xsl-list@xxxxxxxx>
Date: Thu, 23 Sep 2004 12:34:43 -0400
xsl unmatch
I have an XML document that looks something like the following:

<items>
  <item id="A1">
    <item id="A2>
      <item id="A3" />
    </item>
  </item>
  <item id="B1">
    <item id="B2>
      <item id="B3" parentid="A1" parentpath="/items/item[id='A1']" />
    </item>
  </item>
</items>
  
I am hoping for a facility to easily retrieve the logical parent node for any
item.  Specifically, if an item has a parentpath defined, I would want the
node specified by that parentpath, otherwise I want the actual (XML) parent. 
Note that the parentpath/parentid may be stored in a child element/attribute
instead of an attribute of the item itself.  

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.

The long story, in case there are better suggestions: the XML contains the
entire information architecture and content of multiple websites.  In most
cases this XML matches site navigation, but for resources such as news
articles that are shared to multiple sites, the content is stored in the item
tree in a shared location (not in the normal navigation hierarchy).  I want to
be able to define these logical parents to facilitate navigation in this news
section.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.