xsl-list
[Top] [All Lists]

Re: accessing different nodes when comparing two xml files

2005-04-25 07:37:45
I corrected the <xsl:for-each> condition such that its now
<xsl:for-each select="document($first)/following-sibling::Top/SubConcepts/SubConcept[(_at_)name=$firstName]/Value>

But it still returns null.

For testing purpose I changed the condition to
        <xsl:value-of select="document($arch)/Top/SubConcepts/SubConcept[1]">

and it returned the right value.

I have a feeling its got something to do with the way Ive written the following-sibling statement.

Any suggestions?

Thanks
Rahil



David Carlisle wrote:

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"/>

That $first does not contain a document it contains a result tree
fragment that corresponds to a document node that has (just) a text node
with value the string "First.xml".

presulamably you intended that to be
   <xsl:variable name="first" select="document('First.xml')/Top"/>

 <xsl:for-each  select="$first/f
Thus will give you a compile time error as $first is a result tree
fragment not a node set.

However your xpaths are not going to work I expect.

for example

 $second/following-sibling::SubConcepts

If Second.xml is a well formed XML file it has only one top level
element, presumably called Top. $second is bound to that element node
and so will have no following siblings, so this will be th eempty set.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

--~------------------------------------------------------------------
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>
--~--