You should file a bug with OpenJDK ;‐) since those sources live there and
who knows what's happened since they (Oracle?) copied Xalan there a long
time ago. We have no idea and get no information on what OpenJDK does with
their copy.

If you find a bug with this project, then by all means, feel free to
provide a failing unit test :-)

Gary

On Mon, Feb 27, 2023, 18:58 Bederov, Sergey <[email protected]> wrote:

> Hello,
>
> I am using the Xalan engine which is embedded into the OpenJDK. On
> versions JDK15 to JDK21 an incorrect behavior is observed, which looks like
> a bug in Xalan.
>
> XSLT:
>
> <xsl:stylesheet version="2.0" xmlns:xsl="
> http://www.w3.org/1999/XSL/Transform"; xmlns:str="http://exslt.org/strings";
> xmlns:exslt="http://exslt.org/common"; exclude-result-prefixes="plmxml">
>
>   <xsl:template match="Root">
>
>     <xsl:variable name="created">
>
>       <Created/>
>
>     </xsl:variable>
>
>     <xsl:apply-templates select="exslt:node-set($created)">
>
>       <xsl:with-param name="prm" select="@attr"/>
>
>     </xsl:apply-templates>
>
>   </xsl:template>
>
>   <xsl:template match="Created">
>
>     <xsl:param name="prm"/>
>
>     <Output>
>
>       <Display>
>
>         <xsl:value-of select="$prm"/>
>
>       </Display>
>
>       <Usage>
>
>         <xsl:value-of select="key('nonexistentkey',$prm)"/>
>
>       </Usage>
>
>       <Display>
>
>         <xsl:value-of select="$prm"/>
>
>       </Display>
>
>     </Output>
>
>   </xsl:template>
>
> </xsl:stylesheet>
>
> XML:
>
> <?xml version="1.0" encoding="utf-8"?>
>
> <Root attr="foo"/>
>
> The problem is that in the second template, when the “key” function is
> called, the “prm” variable is for some reason cleared. In the output file,
> the first “Display” element contains the correct value “foo”, but the
> second “Display” element is empty. Why does it happen? It’s a variable
> which should always have the same value.
>
> Yes, here the “key” function is called for a key which doesn’t exist, but
> it’s not the cause of the problem. If a key is present, and if it contains
> the required value, the bug is still there. Actually the “key” function
> doesn’t find anything anyway, as if the variable was already empty.
>
> I see that the Xalan development is ongoing, so I thought it would be
> useful to report this bug.
>
>
>
>
> *Sergey Bederov *Senior Developer
>
> *Cortona3D *www.cortona3D.com
>
>
>
>
>
>
>

Reply via email to