This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Finding corresponding node in structurally identical sibling tree?
- From: jcrisp at blueyonder dot co dot uk
- To: <XSL-List at lists dot mulberrytech dot com>
- Date: Fri, 26 Apr 2002 10:38:48 +0100
- Subject: [xsl] Finding corresponding node in structurally identical sibling tree?
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi
(Xalan 2.3.1)
I need to quickly find the matching node to the current node which is in a parallel branch with identical structure to the branch I'm operating in. It seems like this should be really simple, but the only solution I can come up with is
a recursive template to assemble the name of the path from the branch tag down, and then compare that against the result from the same template for each node in the second tree. The trees may be of arbitrary depth. Any other ideas?
<example>
<branch1>
<somestuff>
<somedeeperstuff>
<someevendeeperstuff/> <--- Current node
</somedeeperstuff>
</somestuff>
</branch1>
<branch2>
<somestuff>
<somedeeperstuff>
<someevendeeperstuff/> <--- Corresponding node I want to find
</somedeeperstuff>
</somestuff>
</branch2>
</example>
The reason we are doing this is to be able to cache a form description in the first branch.
Then any default values are placed in the second branch which means that we don't need to modify the
cached document fragment.
TIA
Joel
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list