[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Javascript inside XSL(Just when I think I understa

Subject: Re: Javascript inside XSL(Just when I think I understand)
From: Mike Brown <mike@xxxxxxxx>
Date: Fri, 1 Feb 2002 09:04:17 -0700 (MST)
javascript inside xsl
Peter Davis wrote:
> Putting <![CDATA[ <!-- stuff --> ]]> in your stylesheet will not normally 
> output the comment, it will output &lt;!-- stuff --&gt;.  It only works in 
> this case because no output-escaping is performed when inside the <script> 
> tag in HTML mode.
> 
> The more general way to do it is to put all your code in an <xsl:comment> tag.

That is preferable, yes, but then you have to tell him that he must escape the
"<" and "&" characters and avoid using any "--" sequences as are so often used
in decrement operations.

Here is an example for Gene's benefit (note the &lt;)

<HTML>
  <HEAD>
    <script language="JavaScript1.2">
      <xsl:comment>
        var aname='pull';
        var NS4 = (document.layers) ? 1 : 0;
        var IE = (document.all) ? 1 : 0;
        var DOM = (parseInt(navigator.appVersion) >=5) ? 1 : 0;
        var MAC = ((navigator.appVersion.indexOf("PPC") >0) ||
        (navigator.appVersion.indexOf("Mac") >0)) ? 1 : 0;

        //global nav
        function ShowLayer(){return};
        function OutLayer(){return};
        if (document.layers) {
          appVer = navigator.appVersion.substring(0,4);
          if (appVer &lt; 4.06) NS4 = 0;
        }
        if (NS4 || IE || DOM) globalPulldown = 1;
        if (!globalPulldown) event = null;
        //</xsl:comment>
  </HEAD>
  <BODY>
  ...
  </BODY>
</HTML>

   - Mike
____________________________________________________________________________
  mike j. brown, fourthought.com  |  xml/xslt: http://skew.org/xml/
  denver/boulder, colorado, usa   |  personal: http://hyperreal.org/~mike/

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.