[XSL-LIST Mailing List Archive Home]
Re: [xsl] > replaced by ">", < is not replaced...
Subject: Re: [xsl] > replaced by ">", < is not replaced...|
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Mon, 16 Jul 2007 12:28:41 +0200
Jethro Borsje wrote:
This sounds all very logical. I think option 5 is the best way to go at
this point. However, I am not sure how to go about doing such a
comparison. My situation is as follows: My user selects a subset of the
original XML file. After this action I need to compare the selection of
the user to the original.
It sounds to me that it will be way easier if you try to track the user
action and record his selection, instead of finding it per the selected
text/xml (what if parts of your xml are equal?).
Once I find the location of the selection
inside the original I have to surround this selection with a new tag,
say "<selection>", and "</selection>". I have placed an example of
text online at http://www.jborsje.nl/example.txt, so you can see what
One way I can think of is iterating over all of the elements of the
original, each time calling the "deep-equal()" function, but I do not
know if that is the best approach.
deep-equal() already does this 'iteration' for you. It deep-equals all
nodes of the tree recursively and when they are indeed equal, it will
return true. Applying deep-equal to every node in your code would be
I don't think it is the best approach for what you need. If you need to
find a particular node by means of a node as input, you *could* use
deep-equal, but when the input is stringized, it will be problematic. I
am not sure if using XSLT for finding the selected nodes is the right
approach at all.
-- Abel Braaksma