[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] RE: Finding the closest preceding element within the containing block

Subject: Re: [xsl] RE: Finding the closest preceding element within the containing block
From: Vasu Chakkera <vasucv@xxxxxxxxx>
Date: Sun, 27 May 2012 22:20:26 +0100

Hi Mike,
Preceding-sibling allways brings you the sibling under the same
parent. So you will never get a "C" element from a different B parent.
But sometimes there could be a situation where you are having to use
preceding as opposed to the preceding-sibling, then there is a chance
that you may go out into other parents..  in those cases, if you want
to make sure that the two nodes that you are selecting have a common
ancestor node, then you could  use  key() function, with the third
parameter of the key ( xslt 2 ) as the common ancestor.( the third
parameter of the key in xslt 2 gives the context under which the key
is being evaluated)..
Hope this helped

On 21 May 2012 19:20,  <mlcook@xxxxxxxxxx> wrote:
> Thanks for the response (also suggested by Syd Bauman) and follow-up emails
from Michele Combs to refine the test on a more complex document structure.
> With my other document variation, I ended up also using ../preceding-sibling
to look into previous "b" elements.
> I've started going through the tutorial suggested by ihe onwuka.
> Thanks again for this help and all the previous info I've gleaned from the
> --Mike Cook
> This email and any attachments are only for use by the intended recipient(s)
and may contain legally privileged, confidential, proprietary or otherwise
private information.  Any unauthorized use, reproduction, dissemination,
distribution or other disclosure of the contents of this e-mail or its
attachments is strictly prohibited.  If you have received this email in error,
please notify the sender immediately and delete the original.

Vasu Chakkera
NodeLogic Limited

Current Thread