Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Getting the parent when the child doesn't exist

From: Jeroen Mostert <jmostert@------.-->
To: NULL
Date: 3/3/2009 8:23:00 PM
Jeroen Mostert wrote:
> Greg Collins wrote:
>> I'm posting this to both the XSL and C# newsgroups because it spans both.
>>
>> I have an XPath passed to me that starts at the root node and goes 
>> down to a table row node. From this XPath I was grabbing the table 
>> node by appending a "/.." to the end of the XPath.
>>
>> While this technique works great when the row exists, if the row does 
>> not exist, I can no longer identify the table node.
>>
> I don't mean to be overly simplistic, but why don't you just use the 
> XPath to navigate to the table node and then use the DOM (in an 
> XPathNavigator, or whatever other guise) to conditionally navigate up? 
> Do you have to stuff it in a single XPath expression?
> 
Wait, I fail at reading -- you want to find the parent node when the child 
node doesn't exist (that particular expression isn't meaningful, but at 
least now I get what you mean).

Well, I don't mean to be a spoilsport, but there's no guarantee you can get 
at a "parent node" at all in this case, is there? You can't navigate to a 
node based on its relation to a node that doesn't exist. Manipulating the 
XPath expression that points at the child node won't always work unless you 
can really guarantee that the XPath expression will be strictly 
hierarchical. Finding what would have been the parent node of "id('test')" 
had it existed, for example, is a tad tricky.

-- 
J.


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