|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: javascript, xsl and xml
I have a child window and am looking to pass some of the xml within it to it's parent. The problem is: any '<' '>' or '"' contained within the xml (as there will be) causes the javascript function call to fail. Is there anyway in a stylesheet to pass xml into a function without the contents of the xml causing problems? Do I need to convert every < to < < to > etc - if so is there a quick way to do this? you wern't very specifc where your problem was, if ypu mean that you have in the xml source unquoted < then the input is not well formed (ie, not XML) so will be a fatal error to any XML application, not just XSLT. You can use < or equivalently put a CDATA section around teh whole block as in <foo><![CDATA[ 1 < 2 < 3 ]]></foo> To XSLT that is identical input to <foo> 1 < 2 7gt; 3 </foo> That's all about the input, but as you said "javascript function call to fail". perhaps your problem is in the output. If you have some input quoted as above and copy it to a script block in the output it will come out as <script> 1 < 2 > 3 </script> if you are using the xml output method or <script> 1 < 2 < 3 </script> if you are using the html output method which is teh default if the top level output element is html in no-namespace. Quoting < and & in script elements is teh correct thing to do in XHTML but if you send the file to a browser that doesn't know anything about xhtml (like for instance IE) then it will trip over the quoting as < does not mean < in an html script element as & is not markup there so it literally means the four characters & l t ;. If you specify cdata-section-elements="script" in your stylesheet the element will probably be output as <script><![CDATA[ 1 < 2 < 3 ]]></script> which is equivalent as XHTML, as HTML it sould just be a syntax error as < is not special inside an html <script> so <
Cart








