RE: [xsl] Problem with the use of JavaScript in a XSL file

Subject: RE: [xsl] Problem with the use of JavaScript in a XSL file
From: "Martinez, Brian" <brian.martinez@xxxxxxxx>
Date: Wed, 5 Mar 2003 07:33:11 -0700
> From: Andrew Welch [mailto:AWelch@xxxxxxxxxxxxxxx]
> Sent: Wednesday, March 05, 2003 5:45 AM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] Problem with the use of JavaScript in a XSL file
> 
> > I need Help. I have a problem using the character "<"other ">" in a
> > javasript in a XSL file.
> 
> Hi,
> 
> Try wrapping script in <xsl:comment> and in a cdata section:
> 
>   <script>
>     <xsl:comment>
>       <![CDATA[
> 
> 
>       ]]>
>     </xsl:comment>
>   </script>
> 
> This will allow you to write javascript that doesnt bother 
> the xslt processor, and will wrap the script in <!-- --> in the ouput.

Not really an XSLT issue, but if you don't prefix the end comment tag with a
JavaScript comment delimiter, interpreters will treat it as a pre-decrement
operator, which can generate unexpected errors.  So the last line before the
end script tag should look like:

//</xsl:comment>

Could you put the comment tags (literal, not xsl:comment) inside the CDATA
block, or would that still cause the processor to ignore the contents?

In practice, I no longer see the point of wrapping script code in comment
tags.  IIRC, it's only needed for browsers that don't understand the script
tag (as opposed to not recognizing JavaScript, or having scripting disabled
via an option setting).  How many people are actually using such beasts
these days?

cheers,
b.

| brian martinez                              brian.martinez@xxxxxxxx |
| senior gui programmer                                  303.708.7248 |
| trip network, inc.                                 fax 303.790.9350 |
| 6436 s. racine cir.                             englewood, co 80111 |
| http://www.cheaptickets.com/                   http://www.trip.com/ |

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


Current Thread