My xslt needs to create JavaScript code. After
that, the page is complete and ready to serialize. However, when I do that with the legacy html-serialize, etc., JavaScript code like && and < get escaped and the processors don't work. This is under 2.8, but it isn't clear to me how even under 3.0 and the http-serializer this can be done. Basically, I need to have my xml document streamed as-is, with no character escaping. Or, a way to insert <!CDATA[[ ]] around some sections I'm going to upgrade to 3.0. Anyone else run into this? Basically, I need to stream my prepared xml as text, no translating, or && and < become && and < which Javascript doesn't accept. Note: this is not worth anyone's vacation time! Cheers, Hank -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
On Thu, 8 Sep 2005 09:51:21 -0700, "Hank Ratzesberger" <[hidden email]> said: > My xslt needs to create JavaScript code. After > that, the page is complete and ready to serialize. > However, when I do that with the legacy html-serialize, > etc., JavaScript code like && and < get escaped and > the processors don't work. > > This is under 2.8, but it isn't clear to me how even > under 3.0 and the http-serializer this can be done. > > Basically, I need to have my xml document streamed > as-is, with no character escaping. Or, a way to > insert <!CDATA[[ ]] around some sections > > I'm going to upgrade to 3.0. > > Anyone else run into this? Basically, I need to > stream my prepared xml as text, no translating, or > && and < become && and < which Javascript > doesn't accept. > > Note: this is not worth anyone's vacation time! text or with the serializer doing so? Assuming the former, have you tried putting the generating the script as a text node while using disable-output-escaping? For example the following generates the literal "<!--" : <xsl:text disable-output-escaping='yes' ><!--</xsl:text> -- Regards, Dan S ( Not on vacation. ) -- http://www.fastmail.fm - And now for something completely differentÂ… -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Hank:
to have sections wrapped in CDATA by a XSL transform, use the "cdata-section-elements" attribute of <xsl:output> like : <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> <xsl:output cdata-section-elements="myelement1 myelement2"/> ... The disable-output-escaping option suggested below is porbably more appropriate in your case. hope this helps, *P [hidden email] wrote: On Thu, 8 Sep 2005 09:51:21 -0700, "Hank Ratzesberger" [hidden email] said:My xslt needs to create JavaScript code. After that, the page is complete and ready to serialize. However, when I do that with the legacy html-serialize, etc., JavaScript code like && and < get escaped and the processors don't work. This is under 2.8, but it isn't clear to me how even under 3.0 and the http-serializer this can be done. Basically, I need to have my xml document streamed as-is, with no character escaping. Or, a way to insert <!CDATA[[ ]] around some sections I'm going to upgrade to 3.0. Anyone else run into this? Basically, I need to stream my prepared xml as text, no translating, or && and < become && and < which Javascript doesn't accept. Note: this is not worth anyone's vacation time!Is the problem with getting XSLT to produce un-escaped text or with the serializer doing so? Assuming the former, have you tried putting the generating the script as a text node while using disable-output-escaping? For example the following generates the literal "<!--" : <xsl:text disable-output-escaping='yes' ><!--</xsl:text> -- Regards, Dan S ( Not on vacation. ) -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
In reply to this post by Hank Ratzesberger
The issue is in the serializer. Presently, I
can preserve the JavaScript with CDATA, but when it is passed to the serialzer, it gets escaped. Do any of the 3.0 converters have the option to "disable-output-escaping" ? Trying that now... Thanks everyone, Hank ----- Original Message ----- From: "Hank Ratzesberger" <[hidden email]> > My xslt needs to create JavaScript code. After > that, the page is complete and ready to serialize. > However, when I do that with the legacy html-serialize, > etc., JavaScript code like && and < get escaped and > the processors don't work. > > This is under 2.8, but it isn't clear to me how even > under 3.0 and the http-serializer this can be done. > > Basically, I need to have my xml document streamed > as-is, with no character escaping. Or, a way to > insert <!CDATA[[ ]] around some sections > > I'm going to upgrade to 3.0. > > Anyone else run into this? Basically, I need to > stream my prepared xml as text, no translating, or > && and < become && and < which Javascript > doesn't accept. > > Note: this is not worth anyone's vacation time! > > Cheers, > Hank -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
<[hidden email]> said:
> The issue is in the serializer. Presently, I > can preserve the JavaScript with CDATA, but > when it is passed to the serialzer, it gets > escaped. > > Do any of the 3.0 converters have the option to > "disable-output-escaping" ? Trying that now... I am missing something. I tried tweaking the example file WEB-INF/resources/examples/tutorial/hello2/view.xsl to include something that should cause a problem. <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:version="2.0"> <head> <title>Hello World MVC</title> </head> <body> <script type="javascript" > <![CDATA[ var foo = true && false; var bar = 5 < 4; ]]> </script> <p>Hello <xsl:value-of select="/name"/>!</p> </body> </html> However when in my browser when I view the page source everything looks fine : ...<div><script type="javascript"> var foo = true && false; var bar = 5 < 4; </script><p>Hello World!</p> </div>... Course this is with 3.0 and not 2.8, so maybe there's a bug in 2.8. -- Regards, Dan S -- http://www.fastmail.fm - Or how I learned to stop worrying and love email again -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
I agree something is a bit puzzling here. In my case, I have an XSLT with the following line: <xsl:text disable-output-escaping="yes">&nbsp;</xsl:text> This renders normally as &nbsp; if I un the transfrom with Saxon 8 under XMLSpy but comes out as: <?javax.xml.transform.disable-output-escaping >&nbsp;<?javax.xml.transform.enable-output-escaping > when I executed the transform under 3.0. The above is then not treated a non breaking space by IE or Firefox. Can I prevent the insertion of the <?javax.xml.transform.disable-output-escaping > tag? thanks <P/> [hidden email] wrote: [hidden email] said:The issue is in the serializer. Presently, I can preserve the JavaScript with CDATA, but when it is passed to the serialzer, it gets escaped. Do any of the 3.0 converters have the option to "disable-output-escaping" ? Trying that now...I am missing something. I tried tweaking the example file WEB-INF/resources/examples/tutorial/hello2/view.xsl to include something that should cause a problem. <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:version="2.0"> <head> <title>Hello World MVC</title> </head> <body> <script type="javascript" > <![CDATA[ var foo = true && false; var bar = 5 < 4; ]]> </script> <p>Hello <xsl:value-of select="/name"/>!</p> </body> </html> However when in my browser when I view the page source everything looks fine : ...<div><script type="javascript"> var foo = true && false; var bar = 5 < 4; </script><p>Hello World!</p> </div>... Course this is with 3.0 and not 2.8, so maybe there's a bug in 2.8. -- Regards, Dan S -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
In reply to this post by dsmall-2
Thanks Dan, Indeed, the epilogue.xpl processor
handles this correctly. I was using my own model so it was not getting passed to epilogue. --Hank ----- Original Message ----- From: <[hidden email]> To: <[hidden email]> Sent: Friday, September 09, 2005 2:12 AM Subject: Re: [ops-users] Preventing character escaping > <[hidden email]> said: >> The issue is in the serializer. Presently, I >> can preserve the JavaScript with CDATA, but >> when it is passed to the serialzer, it gets >> escaped. >> >> Do any of the 3.0 converters have the option to >> "disable-output-escaping" ? Trying that now... > > I am missing something. I tried tweaking the > example file > WEB-INF/resources/examples/tutorial/hello2/view.xsl > to include something that should cause a problem. > > <html xmlns="http://www.w3.org/1999/xhtml" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xsl:version="2.0"> > <head> > <title>Hello World MVC</title> > </head> > <body> > <script type="javascript" > > <![CDATA[ var foo = true && false; var bar = 5 < 4; ]]> > </script> > <p>Hello <xsl:value-of select="/name"/>!</p> > </body> > </html> > > However when in my browser when I view the page source > everything looks fine : > > ...<div><script type="javascript"> > var foo = true && false; var bar = 5 < 4; > </script><p>Hello World!</p> > </div>... > > Course this is with 3.0 and not 2.8, so maybe there's a bug in > 2.8. > > -- Regards, Dan S > > -- > http://www.fastmail.fm - Or how I learned to stop worrying and > love email again > > > -------------------------------------------------------------------------------- > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws > -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
In reply to this post by Pascal Heus
On Fri, 09 Sep 2005 07:22:10 -0400, "Pascal Heus" <pascal.heus> said: > > I agree something is a bit puzzling here. In my case, I have an XSLT > with the following line: > <xsl:text disable-output-escaping="yes">&nbsp;</xsl:text> > This renders normally as &nbsp; if I un the transfrom with Saxon 8 > under XMLSpy but comes out as: > <?javax.xml.transform.disable-output-escaping > >&nbsp;<?javax.xml.transform.enable-output-escaping > > when I executed the transform under 3.0. > The above is then not treated a non breaking space by IE or Firefox. > Can I prevent the insertion of the > <?javax.xml.transform.disable-output-escaping > tag? > thanks > <P/> a processing instruction. It also is not the source of your problem. The problems are that a.) &nbsp; is of no use to the browser, and b.) unless you have declared it yourself , the entity you are trying to use isn't known to XML parsers. Don't know the best way to deal with this. One way would be to use   instead. Another would be to declare the entity like so : <!DOCTYPE stuff [ <!ENTITY nbsp " " > ]> The first isn't as recognizable to people, the second is a bit heavy as you have to declare the entity in every file where you intend to use it. -- Regards, Dan S -- http://www.fastmail.fm - One of many happy users: http://www.fastmail.fm/docs/quotes.html -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Free forum by Nabble | Edit this page |