[xsl] double escaping problem

Subject: [xsl] double escaping problem
From: pkeane <pkeane@xxxxxxxxxxxxxxx>
Date: Mon, 12 Nov 2007 14:06:37 -0600 (CST)
My apologies is this is repeat material, but I was unable to find the answer by searching the archives.

I am building a web application based on REST-based web services. It is digital asset repository/management tool and all of the "data" in the system lives in a relational database but is exposed to the rest of the application by way of XML documents accessed over http. The entire user interface is constructed using xslt which consumes and "mashes up" these services to present html pages to the user. There is a site-wide XSLT stylesheet and a sitewide "layout" xml file. Each request is mapped to a small script which invokes an XSLT processor, and specifies the page-specific stylesheet to use (this page-specific stylesheet will "include" the site-wide stylesheet). The "source" is the site-wide layout.xml and all of the rest of the data comes from service documents which are grabbed by way of the xslt document() function. The controller (the small script that the request was mapped to) passes parameters to the processor specifying URLs for the data documents.

So...a request for "http://example.com/collections"; will use the collections.xsl stylesheet which will in turn invokes document(http://example.com/xml/collections) which returns an xml document listing the collections.

Unfortunately, I have a double escaping problem I cannot seem to get rid of, short of using translate(@my_text,'amp;','') when an ampersand appears in any of the text from the service document. The service documents, of course, have already had ampersands escaped and my process escapes them again, so I get "Art &amp; Art History Collection" being presented to the user (view source of the html shows "Art &amp;amp; Art History).

Disable-output-escaping makes no difference (I believe because output is set to be xml -- I am using xhtml strict doctype).

Any help would be greatly appreciated.

-Peter Keane

Current Thread