Re: Help with lots of <'s

Subject: Re: Help with lots of <'s
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 26 Aug 1999 17:36:14 +0100 (BST)
 Mike Brown writes


   > The JavaScript has a lot of "<",">" and "&" characters in 
   > it. [...] Is there a way I can use these charachters in a
   > large block without having to write the equivalent 
   > entities every time?

   Wrap the characters in <![CDATA[...]]>, like this:

   <xsl:text disable-output-escaping="yes">
   <![CDATA[

   <SCRIPT LANGUAGE="JavaScript"><!-- 
	   ... foo & bar ...
   --></SCRIPT>

   ]]>
   </xsl:text>


Beware though, that if you do this you are not outputting a SCRIPT
element but the characters < S C R I P T  thus this stylesheet only
works in a context in which you are linearising the result tree as an
XML file, and then re-parsing it as XML (or HTML in this case).
It wouldn't (or shouldn't) work in an embedded context where the
result tree of the stylesheet is being directly accessed, eg by the
layout engine of a browser.

David


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread
  • Help with lots of <'s
    • Joe - Thu, 26 Aug 1999 09:40:13 +0100
      • <Possible follow-ups>
      • Mike Brown - Thu, 26 Aug 1999 10:09:33 -0600
        • David Carlisle - Thu, 26 Aug 1999 17:36:14 +0100 (BST) <=