[xsl] accessing different nodes when comparing two xml files

Subject: [xsl] accessing different nodes when comparing two xml files
From: RahilQ <qamar_rahil@xxxxxxxxxxx>
Date: Mon, 25 Apr 2005 14:30:23 +0100
Hi

I am comparing two xml files in one xsl file for content equality.

I have declared two variables that will contain the two document trees.

   <xsl:variable name="first">First.xml</xsl:variable>
   <xsl:variable name="second" select="document('Second.xml')/Top"/>

When trying to run a for-loop (as below) I get a compile-time error that 'the result is a node() instead of a boolean' :

<xsl:for-each select="$first/following-sibling::SubConcepts/SubConcept[@name=$firstName]/Value | $first/preceding-sibling::SubConcepts/SubConcept[@name=$firstName]/Value">

<xsl:if test="$second/following-sibling::SubConcepts/SubConcept[@name=$secondName] | $second/preceding-sibling::SubConcepts/SubConcept[@name=$secondName]">

   .............</xsl:if>
.........</xsl:for-each>

Could someone please suggest the best way of writing a code for looping.

PS: I need to access the 'first' and 'second' variables at different points in the same file, which is why I felt that using the $first/.... and $second/... when required will be most convenient.

Thanks in advance for any help
Rahil

Current Thread