[xsl] Escaping apostrophes for use in javascript, etc. - how to trouble shoot template results?

Subject: [xsl] Escaping apostrophes for use in javascript, etc. - how to trouble shoot template results?
From: "Kathy Burke" <Kathy_Burke@xxxxxxxxx>
Date: Thu, 9 Oct 2003 08:34:31 -0400
This is one of those questions where I don't know at this point what is xsl
related and what is not, but after two days of trying, I'm thought I'd ask
here.

I'm using a stylesheet whose output includes some javascript (typical stuff,
validation, submit, etc.) run exclusively in IE6  using msxml4. One of the
functions includes a parameter whose text can contain apostophes.

function Anomaly(typeIn,idIn,textIn)
newWindow =
window.open(('Anomaly.aspx?type='+typeIn+'&id='+idIn+'&text='+textIn),
'Anomaly', 'width=650,height=700');

This passes certain text nodes as parameters, which then get included in the
querystring to the next form.

Trying to solve this, I included a template written by Jeni Tennison (from
an online post) to escape apostrophes. In the variable name="apos" the
select='"&apos;"'  -- I don't understand how/if this is working. Does xsl
look for the actual ' character?  And how would one tell if it's working...I
know I wouldn't see a backslash appear with the apostrophe in the html
output transformation, but how do I check if this is working? I'm still
getting javascript errors which I'm sure is tied to the apostrope (and/or
use of backslash or forward slash) in my text elements being passed to the
querystring.

Sorry if this is OT, but hoping someone can point me in the right direction,
even just how to troubleshoot further. Of course, the error messages don't
seem to be pointing to the actual lines causing the trouble. I'm using both
Xslerlator and IE6.

Thanks.  Kathy




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread