[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: HELP!!!!!!!!!!!!!!!!!!!!!!!!!!


Subject: Re: HELP!!!!!!!!!!!!!!!!!!!!!!!!!!
From: "Russell Allen" <rallen@xxxxxxxxxxxx>
Date: Wed, 14 Jul 1999 09:58:51 -0500

I've done something like this.  If your going to perform dynamic changes to
the HTML on the client browser then you will want to look at JavaScript
(ECMAScript).  You would place such scripting into the HTML by putting it in
the xsl as an <xsl:comment>.  However it is NOT the <xsl:script> tag.  That
is for scripting which may be used during the processing of the XSL file.

My xsl file contains the following:

<SCRIPT LANGUAGE="JavaScript"><xsl:comment>
<![CDATA[

    ...JavaScript Here...

]]>//</xsl:comment></SCRIPT>

The JavaScript within those tags is passed into the final HTML file.


The tag <xsl:script> allows for scripting during xsl processing.  I use the
script below to alternate colors on the rows in a table.  (Just like an
accounting report)  This determines if it is an even or odd row and applies
a different color based on which.

<xsl:script><![CDATA[
      function even(e) {
        return childNumber(e) % 2;
      }

      function whichColor(e) {
        if (even(e))
          return "#EEEEEE";
        else
          return "#ffffff";
      }
    ]]></xsl:script>

I call the above xsl:script with the following in my template:

<TR>
      <xsl:attribute
name="BGCOLOR"><xsl:eval>whichColor(this)</xsl:eval></xsl:attribute>
...rest of content...
</TR>


hope it helped,
Russell Allen
Software Engineer
ComFrame Software Corp.


----- Original Message -----
From: <Marco.Mistroni@xxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxx>
Sent: Wednesday, July 14, 1999 8:55 AM
Subject: HELP!!!!!!!!!!!!!!!!!!!!!!!!!!


>
> Hi all,
> I need urgent help: I must generate an HTML file from an XML
> file.... But  the HTML file must contains a script for modifying something
> in the HTML file
> How can I do that with XSL??
> And also, previously there was a tag <xsl:functions> but in the last draft
> it has been removed
> Do I have to use xsl:script???? And if so, how can I use it?? Forgive me
but
> I am a bit new of the subject of XSL
> Reply me soon
> Br
> marco
> -----Original Message-----
> From: EXT Kay Michael [mailto:Michael.Kay@xxxxxxx]
> Sent: 14. July 1999 15:58
> To: 'xsl-list@xxxxxxxxxxxxxxxx'
> Subject: RE: XSLT:  conversion:  string variable to selection pattern
>
> >
> > <xml:template name="myTemplate" match="$myString">
> >
> > The above syntax doesn't work;  is there a way to explicitly
> > convert my string variable into a reference pattern
>
> No. There is no way to construct an expression or pattern in XSLT at
> run-time, any more than there is in (say) C or C++. XSLT is not a
reflexive
> language, the stylesheet has no access to itself.
>
> If you really need this, the only solution is to generate a stylesheet and
> then execute it.
>
> Mike Kay
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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



Current Thread
Keywords