Sorry, I still haven't had time to dig deeper into the actual compilation 
output, which is the level at which this can be most easily analyzed. (When I 
regain that skill, I should probably write a short essay on debugging Xalan at 
that level.)

Have you had a chance to try replacing your inline macro-style expansion with a 
call to a generated function/template? Or made sure that each  inlining of the 
macro creates and uses unique intermediate variables to carry the parameter? I 
still think that looks like the most likely place for your solution to be 
fighting with our semantics.

I *really* want to get the Maven build to the point of bring good enough to 
merge, rather than putting it on pause after all that effort...  it has been 
eating my brain.  Thought we were almost there before the question if website 
update came up...


--
   /_  Joe Kesselman (he/him/his)
-/ _) My Alexa skill for New Music/New Sounds fans:
   /   https://www.amazon.com/dp/B09WJ3H657/

Caveat: Opinionated old geezer with overcompensated writer's block. May be 
redundant, verbose, prolix, sesquipedalian, didactic, officious, or redundant.
________________________________
From: Mukul Gandhi <muk...@apache.org>
Sent: Saturday, December 23, 2023 10:14:39 AM
To: dev@xalan.apache.org <dev@xalan.apache.org>
Subject: issue with xpath expression evaluations involving xpath dynamic 
function calls, and workaround

Hi all,
   I've just thought of mentioning these issues to this list (if
anyone has any thoughts for possible fixes, that'll be great to know).

The following XSLT 3.0 stylesheet produces, wrong numeric result when
run by the latest XalanJ XSLT 3.0 codebase on dev repos branch
xalan-j_xslt3.0,

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                         xmlns:xs="http://www.w3.org/2001/XMLSchema";
                         exclude-result-prefixes="xs"
                         version="3.0">

  <xsl:variable name="func1" select="function($x as xs:integer) as
xs:integer { $x + 3 }"/>

  <xsl:variable name="func2" select="function($x as xs:integer) as
xs:integer { $x * 2 }"/>

  <xsl:template match="/">
     <result>
          <xsl:value-of select="$func1(2) + $func2(3)"/>
     </result>
  </xsl:template>

</xsl:stylesheet>

Whereas, the following XSLT 3.0 stylesheet workaround works fine with
XalanJ on dev repos branch xalan-j_xslt3.0,

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                         xmlns:xs="http://www.w3.org/2001/XMLSchema";
                         exclude-result-prefixes="xs"
                         version="3.0">

  <xsl:variable name="func1" select="function($x as xs:integer) as
xs:integer { $x + 3 }"/>

  <xsl:variable name="func2" select="function($x as xs:integer) as
xs:integer { $x * 2 }"/>

  <xsl:template match="/">
        <result>
            <xsl:variable name="f1Result" select="$func1(2)"/>
            <xsl:variable name="f2Result" select="$func2(3)"/>
            <xsl:value-of select="$f1Result + $f2Result"/>
        </result>
  </xsl:template>

</xsl:stylesheet>


--
Regards,
Mukul Gandhi

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@xalan.apache.org
For additional commands, e-mail: dev-h...@xalan.apache.org

Reply via email to