Re: Stray quote from <xsl:value-of/> causing a string termination err or

Subject: Re: Stray quote from <xsl:value-of/> causing a string termination err or
From: Dan Morrison <dman@xxxxxxxx>
Date: Sat, 10 Jun 2000 18:44:54 +1200
Banker, Arjun wrote:
> However, the only thing is, i have both stray " marks and ' marks.

Yeah, I sort of expected that, but apostrophes might have been just from
words, whereas Quotes implies that your input is very unpredictable, and
therefore deserves a bit of massaging, as per my second suggestion.

I see that Mike Browns substring replacement posted recently might be
the thing to do, but it looks horrible.
Give me a Regular Expression any day!

A two-step pre-process could work, but it would be more efficient to do
it outside of XSL surely.

I think this arises as your data is coming from free-text data blocks
and you're trying to place it into attributes. If the data was stored as
an attribute originally, it would be already escaped.

So here's an observation on the old attribute/value debate - 
Consider the rigidness of the escaping expected to be applied to your

So sorry, I've had end-to-end control of the data I was throwing at my
Javascript, so I made it easy on myself by avoiding this mixed-quote

... OK! Hack from Hell, how desperate are you?
(I have actually implimented this method several years ago)

A hidden textarea can have arbitrary text dumped into it, and the value
of that form element can then be read by JavaScript.

<div style="position:absolute; visibility:hidden">
 <form name="hidden">
  <textarea name="rowheader"><xsl:value-of

This has not been proofread for syntax, and would take more work to
scale up to multiple instances, and relies on css support, but it's a

... Sorry, you should probably treat that suggestion as a theoretical
exercise, and not impliment it unless you're either biding your time
until a better solution comes along ... or you wish to curse those who
will come after you.
My strength is making JavaScript doing what it was never designed to do
(such as talk to the server) and not XSL escaping. That said, some of
the XSL-based solutions look just as hacky when you consider the
simplicity of the questions.


: Dan Morrison        : The Web Limited    :
: :  :
:  dman@xxxxxxxx      :  danm@xxxxxxxxx    :
:  04 384 1472        :  04 495 8250       :
:  025 207 1140       :                    :
: If ignorance is bliss, why aren't more people happy?

 XSL-List info and archive:

Current Thread