[xsl] How do I search ancestors in the output tree?

Subject: [xsl] How do I search ancestors in the output tree?
From: "Costello, Roger L." <costello@xxxxxxxxx>
Date: Fri, 31 Aug 2012 19:32:10 +0000
Hi Folks,

I have some xsl:templates.

Each template outputs an XML element with an attribute.

For example, I process this element in the input:

     <A>

And output this:

    <Publication id="foo">

Nested within <A> in the input document there is a <B> element:

    <A>
         <B>

The template rule for <B> outputs this:

     <Article id="bar">

So, in the output tree I have this:

     <Publication id="foo">
          <Article id="bar">

And so forth, with the templates processing deeper and deeper into the input
tree, building a corresponding deeper and deeper nested output tree.

Now I get to this element in the input tree:

    <Book id="PM">

I am at a certain nesting in the output tree. I would like to look up (i.e.,
to the ancestors) of the *output* tree to see if there is an ancestor element
with the same id value as the id value in the *input* element.

How do I search ancestors in the output tree?  (As opposed to searching
ancestors in the input tree).

I apologize for my question being so abstract.

/Roger

Current Thread