Re: [xsl] equivalent for 'while'

Subject: Re: [xsl] equivalent for 'while'
From: JBryant@xxxxxxxxx
Date: Wed, 16 Feb 2005 13:14:09 -0600
I do some similar things (such as combining child elements based on the 
presence of a parent element in two documents) in some of my XSL, so 
perhaps I can help.

Please prepare a small but representative sample of the two documents you 
want to compare, insert them into a message (the list does not take 
attachments - a good thing, in my opinion), and identify which items you 
want to compare/verify. Please keep the XML documents as small as possible 
(complete but just enough to show the problem).


Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)

RQamar <qamar_rahil@xxxxxxxxxxx> 
02/16/2005 01:00 PM
Please respond to


Re: [xsl] equivalent for 'while'

Hi David and Michael

I feel rather silly but Ive tried out both your <xsl:for-each> 
statements and they dont seem to work for me. I dont really know what 
the cause is coz I've tried checking other dependencies and they're 
working fine.

My problem really is trying to interact between two XML documents. I 
need to determine whether the top-level element of XML doc 1 is present 
in XML doc 2 (which I've done). I then need to determine whether the 
defining sub-element of the top-level element in doc 1 is also present 
in XML doc 2 (this part is becoming a nightmare for me).

For e.g. I have a top-level element 'Pain' and a sub-element (instance 
of Pain) viz. 'Headache' in XML doc 1. I want to check whether 'Pain' 
exists in XML doc 2 and whether it has a child (or grandchild) named 
'Headache' as well. If it does then I'll proceed to extract other bits 
which have been said about 'headache' in XML doc 2.

I'm seriously stuck with this problem and one of the main reasons is my 
background in procedural programming. I could probably have done this 
bit using Java in 5mins but its taking me forever to get it done in 
XSLT. But I want to use XSLT as its a very powerful language and will 
ultimately be the best choice for my requirements.

Would sincerely appreciate your help.


Michael Kay wrote:

>Don't think in terms of the the program processing the first element, 
>the second, and so on, in a time-ordered manner. Rather, describe the set 
>elements that you want to be processed: that is, preceding-siblings of 
>DEFCONCEPT named "abcGrandChild":
>Michael Kay

Current Thread