[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: > > 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@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
|