Re: [xsl] > replaced by ">", < is not replaced...
2007-07-13 06:32:57
in the output, ">" become a ">". This is not what I want. Not
because of visualization in an HTML client, but because I have to be
able to map the output of the XLS back to some original input which
contains the ">", " ", etc. I basically just want to keep the
character encodings from the input in the output.
Aha, now we're getting at the root of the problem. You need to compare
the things. If you compare XML documents, or HTML documents, the
comparison software should be able to deal with numerical character
entities (and named character entities) and treat a ">" equal to ">"
equal to ">" equal to ">".
If your software cannot make that kind of comparison, you can try
several things, of which the following come to mind:
1. Post process the output to get your original char ents back
2. Use XSLT 2 instead and use character maps to force the char ents
3. Use different comparison software that is capable of reading XML
the proper way (you mention HTML, but from your code it seems that you
create XML)
4. Load and Save the original XML into the XSLT processor you built,
one with transformation, other with copy-of, this will serialize both
the same way and makes comparison on a byte by byte basis easier (but
still not solid)
5. Use XSLT to do the comparison (XSLT 2 is preferred: just use
deep-equal() function if equality is all you are after)
I cannot recommend anything else than option 3 and 5, all others are
workarounds that after time will make your software weak or at least
vulnerable to bugs.
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. 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 I
mean.
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.
Thank you very much for you time and help.
--
Best regards,
Jethro Borsje
http://www.jborsje.nl
--~------------------------------------------------------------------
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>
--~--
<Prev in Thread] |
Current Thread |
[Next in Thread>
|
- RE: [xsl] > replaced by ">", < is not replaced..., (continued)
- RE: [xsl] > replaced by ">", < is not replaced..., Michael Kay
- Re: [xsl] > replaced by ">", < is not replaced..., Jethro Borsje
- Re: [xsl] > replaced by ">", < is not replaced..., Abel Braaksma
- Re: [xsl] > replaced by ">", < is not replaced..., Jethro Borsje
- RE: [xsl] > replaced by ">", < is not replaced..., Michael Kay
- Re: [xsl] > replaced by ">", < is not replaced..., Abel Braaksma
- Re: [xsl] > replaced by ">", < is not replaced...,
Jethro Borsje <=
- [xsl] comparing a part of the XML tree, Jethro Borsje
- RE: [xsl] comparing a part of the XML tree, Michael Kay
- RE: [xsl] comparing a part of the XML tree, Owen Rees
- RE: [xsl] comparing a part of the XML tree, Michael Kay
- Re: [xsl] comparing a part of the XML tree, Jethro Borsje
- Re: [xsl] comparing a part of the XML tree, David Carlisle
- Re: [xsl] comparing a part of the XML tree, Jethro Borsje
- RE: [xsl] comparing a part of the XML tree, Michael Kay
- Re: [xsl] comparing a part of the XML tree, Jethro Borsje
- Re: [xsl] comparing a part of the XML tree, Jethro Borsje
|
|
|