Re: [xsl] Getting variable yet most immediate parentNode

Subject: Re: [xsl] Getting variable yet most immediate parentNode
From: Abel Braaksma <>
Date: Fri, 28 Sep 2007 19:40:23 +0200
Steve wrote:

I think we've gone awry. .//answer's doesn't make sense because, as Wendell pointed out, I want to go up the tree if there is no child <answers />. I tried his syntax, however I'm not sure how to make it choose a child answer's node before it goes looking for the closest ancestral answer node (without using those pesky case statements).

I added the .// in my proposed solution because I inversed your logic (i.e., I started the match from the parent of the answer nodes and applied the answer nodes from there with .//). But, like you said yourself already, the source you showed, both in XSLT and in XML contained errors and that may have made me make the wrong assumptions about what structure is and what structure is not possible (or effective).

But I saw that Wendell's solution "up the tree" works just fine, which is nice to hear :)

About understanding what you are after: I've looked through the thread but still haven't seen a clean output that you have now (so we can mimic your current stylesheet) and the output that you are after, so it is just guessing at what you really want with your code. Or have you found the correct solution already?

-- Abel Braaksma

Current Thread