This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: xsl:script and Xalan ?


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  .

<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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]