Hi
Thanks for all the responses.
I've done a small but complete snippet of doc 1, doc 2 and the resulting
doc 2 I'd like in order to compare the two files.
-------------------- Document 1------------------------
<Top>
<PrimeConcept id="at0000" type="EVALUATION">
<PrimeName>Pain</PrimeName>
<SubPrimeConcept id="at0003">Headache</SubPrimeConcept>
</PrimeConcept>
<SubConcepts>
<SubConcept id="at0027" name="Severity">
<Value
type="TEXT">[MildSeverity,ModerateSeverity,SevereSeverity]</Value>
</SubConcept>
</SubConcepts>
</Top>
---------------------- Document 2 --------------------------------
<?xml-stylesheet type="text/xsl" href="file://C:\Document2.xsl"?>
<TOP id="1000" name="Thing">
<DEFCONCEPT id="10180" name="Pain">
<PARENT>
<CONCEPT name="ExternalStimulusSensation" ref="10181"/>
</PARENT>
<CHILD>
<CONCEPT name="HeadPain" ref="10235"/>
</CHILD>
</DEFCONCEPT>
<DEFCONCEPT id="10235" name="HeadPain">
<PARENT>
<CONCEPT name="Pain" ref="10180"/>
</PARENT>
<CHILD>
<CONCEPT name="Headache" ref="10279"/>
</CHILD>
</DEFCONCEPT>
<DEFCONCEPT id="10279" name="Headache">
<PARENT>
<CONCEPT name="HeadPain" ref="10235"/>
</PARENT>
</DEFCONCEPT>
</TOP>
------------------------ Resulting Document 2------------------------
<Top>
<PrimeConcept id="10180" type="none">
<PrimeName>Pain</PrimeName>
<SubPrimeConcept id="10279">Headache</SubPrimeConcept>
</PrimeConcept>
<SubConcepts>
<SubConcept id="11000" name="Severity">
<Value
type="TEXT">[MildSeverity,ModerateSeverity,SevereSeverity]</Value>
</SubConcept>
</SubConcepts>
</Top>
-----------------------------------------------------
The main concepts to compare in the two files are present in the
<PrimeConcept> block. I'd like to determine the existence of the
<PrimeName> and <SubPrimeConcept> in doc 2. Later I need other stuff to
be determined but this is the main bit, initially. I also do not know in
advance how many levels down I'd need to look to check the existence of
<SubPrimeConcept> in doc 2.
Hope this is what you and Andrew asked me to post. Appreciate all your help.
Regards
Rahil
JBryant(_at_)s-s-t(_dot_)com wrote:
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).
Thanks.
Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)
RQamar <qamar_rahil(_at_)yahoo(_dot_)co(_dot_)uk>
02/16/2005 01:00 PM
Please respond to
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
cc
Subject
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.
Thanks
Rahil
Michael Kay wrote:
Don't think in terms of the the program processing the first element,
then
the second, and so on, in a time-ordered manner. Rather, describe the set
of
elements that you want to be processed: that is, preceding-siblings of
the
DEFCONCEPT named "abcGrandChild":
<xsl:for-each
select="DEFCONCEPT[name="abcGrandChild"]/preceding-sibling::DEFCONCEPT"
Michael Kay
http://www.saxonica.com/
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--