[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Stray quote from <xsl:value-of/> causing a string termin

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
xsl value of quote
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
data.

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
issue.

... 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
select="row-header/"/></textarea>
 </form>
</div>
...
document.write(document.forms["hidden"].rowheader.value)

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
thought... 

... 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.

:=====================:====================:
: Dan Morrison        : The Web Limited    :
:  http://here.is/dan :  http://web.co.nz  :
:  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:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.