[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
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|