You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Loïc Trégan <lt...@hotmail.com> on 2000/12/15 11:53:29 UTC

last() not same in Xalan1 or Xalan2

Hi all,

Find under the XSL and XML used for sample.

result of last() is different under Xalan 1.2 and Xalan 2.0;xalan 1 returns
:
    rule END3;
    rule END3;
    rule END3;

but xalan 2 returns:
    rule END0;


performance issues : if I use count() with xalan 2, which solves my problem
but performance issues may happne. The XSL becomes ;

    <xsl:variable name="count">
        <xsl:value-of select="count("//transition[@to=$activityID]")" />
    </xsl:variable>
      <xsl:for-each select="//transition[@to=$activityID]">
        rule <xsl:value-of select="$activityID" />
        <xsl:value-of select="$count" />
      </xsl:for-each>

wich means that the complex file://transition[@to=$activityID] is processed
twice.
  - is true or is there a caching used internally ?
  - if true, how can I speed up the template ? maybe store match the
expression in a variable, convert the document fragement to a node list,
then reuse this node list in the select and in the count ?

thanks for your help.

------ XSL -------

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
  <xsl:template match="network">
    <xsl:apply-templates select="*" />
  </xsl:template>

  <xsl:template match="*">
    <xsl:variable name="activityID">
      <xsl:value-of select="property[@name='id']" />
    </xsl:variable>
      <xsl:for-each select="//transition[@to=$activityID]">
        rule <xsl:value-of select="$activityID" />
        <xsl:value-of select="last()" />
      </xsl:for-each>
  </xsl:template>

</xsl:stylesheet>


------ XML -------
<network>
    <end>
      <property name="id">END</property>
    </end>
    <transition islink="true" from="Financial_Mail" to="END" />
    <transition islink="true" from="Process_Order" to="END" />
    <transition islink="true" from="OR_N_1" to="END" />
</network>



Loïc Trégan
Staff Technical Account Manager
ILOG / ISD / US


Re: last() not same in Xalan1 or Xalan2

Posted by Gary L Peskin <ga...@firstech.com>.
Loïc Trégan wrote:
> 
> Hi all,
> 
> Find under the XSL and XML used for sample.
> 
> result of last() is different under Xalan 1.2 and Xalan 2.0;xalan 1 returns
> :
>     rule END3;
>     rule END3;
>     rule END3;
> 
> but xalan 2 returns:
>     rule END0;
> 

Loïc --

Under the lastest build of XalanJ2, it returns

      rule END3

which is still wrong, however.  I'm looking into what the problem is and
I will let you know.  Thanks for reporting this problem.

Gary