Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Getting the parent when the child doesn't exist >Thread Next - Re: Getting the parent when the child doesn't exist Re: Getting the parent when the child doesn't existTo: NULL Date: 3/3/2009 7:56:00 PM 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? Otherwise, yes, you'll probably have to get tricky actually semi-parsing the XPath -- whip out the standard and away you go. I'd reconsider the entire approach first, though. -- J. | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
