Re: xsl:script and Xalan ?

Subject: Re: xsl:script and Xalan ?
From: Warren Hedley <w.hedley@xxxxxxxxxxxxxx>
Date: Fri, 16 Jun 2000 09:19:50 -0400
Hi Phillipe.

It appears I completely misinterpreted your first post, and your problem
is indeed quite complex. If you're absolutely determined to use Javascript,
there is some documentation and examples available in the online docs
in the Extensions section:

http://xml.apache.org/xalan/extensions.html

However, don't give up on pure XSLT, because almost anything
is possible - you just have to change your way of doing things.
A few notes:

You can use named templates to perform certain simple functions. You
can probably use a named template for your text filtering - the
following one replaces all spaces with &nbsp;.

<xsl:template name="Filter">
  <xsl:param name="input_text" />
  <xsl:value-of select="translate($input_text, ' ', '&#160;')" />
</xsl:template>


Parameters created with <xsl:variable> are not actually variable - you
can't change their value. However you can often rewrite your scripts to
use a recursive template where the parameter is changed each time you
call the template. eg:

<xsl:template name="recursive">
  <xsl:param name="var" />
  <!-- do some stuff -->
  <xsl:call-template name="recursive">
    <xsl:with-param name="var" select="$var + 1" />
  </xsl:call-template>
</xsl:template>

You can almost always get away without having to generate start and
close tags using plain text output - you just have to use some
creativity in working out where the tags and templates belong in
your XSL. This kind of thing is a no-no.

  document.write(ltchar + "/TR" + gtchar);
  == <xsl:text disable-output-escaping="yes">&lt;/TR&gt;</xsl:text>

Hope this helps.

-- 
Warren Hedley


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


Current Thread