This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Stray quote from <xsl:value-of/> causing a string termination err or
- To: xsl-list at mulberrytech dot com
- Subject: Re: Stray quote from <xsl:value-of/> causing a string termination err or
- From: Dan Morrison <dman at es dot co dot nz>
- Date: Sat, 10 Jun 2000 03:36:41 +1200
- Organization: Disorganised
- References: <E6C33530C94CD311ABB20008C791D6C3035EA809@MSPMAIL1>
- Reply-To: xsl-list at mulberrytech dot com
Banker, Arjun wrote:
>
> In the web page I'm generating using XSL, I'm using javascript to write
> values from an XML file. For example, it would be something like this:
Ah yes, Dynamic generation of Javascript. I now have several templates
which combine 3-4 Languages in one file.
Quickest work-around is to use " instead of ' in your code.
document.write(" <xsl:value-of select="row-header/"/> " );
It looks like crap at first glance, but XSL is quite happy with it.
You can go
document.write(" <xsl:value-of select='row-header/'/> " );
If it feels tidier.
Otherwise consider validating your input data earlier in the process.
Stray apostrophies are no fun anyway so maybe you should be storing them
as (the numeric equivalent of) ' in your source.
But you're right, there should be a nice XSL way of doing it that can
handle the general case, and eliminate not only ' and " but newlines
too, as that will also kill javascript if you use it as in your example.
I'm sure someone else here can fill that in ...
:=====================:====================:
: Dan Morrison : The Web Limited :
: http://here.is/dan : http://web.co.nz :
: dman@es.co.nz : danm@web.co.nz :
: 04 384 1472 : 04 495 8250 :
: 025 207 1140 : :
:.....................:....................:
: If ignorance is bliss, why aren't more people happy?
:.........................................:
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list