Subject: RE: [xsl] double escaping problem [re-visited]|
From: pkeane <pkeane@xxxxxxxxxxxxxxx>
Date: Tue, 13 Nov 2007 08:28:45 -0600 (CST)
The document() function invokes an XML parser and it can only do what an XML parser does.
In fact an XML parser removes one level of escaping, and a serializer adds it back. So the parser turns "&" into "&" and "&amp"; into "&", and the serializer turns them back into "&" and "&amp;" respectively, unless d-o-e is set, in which case they are turned into "&" and "&" respectively. All the evidence is that your XML source as read by the parser was actually double-escaped. This quite often happens when you have fragments of XML stored in a database: if you try to extract it as XML, and the database software doesn't realise that it's already in XML format, then the database software adds a level of escaping that you don't want. The way to get rid of it is to change the way you do the database query.
many thanks! Peter Keane