And if you can find any way to persuade the JDK owners to track the product release of Xalan (and other stuff they copied into their libraries from outside) we'd all applaud. This business of being out of sync goes back to before Oracle bought Sun, and has always been a nuisance.
-- /_ Joe Kesselman (he/him/his) -/ _) My Alexa skill for New Music/New Sounds fans: / https://www.amazon.com/dp/B09WJ3H657/ () Plaintext Ribbon Campaign /\ Stamp out HTML mail! ________________________________ From: Gary Gregory <garydgreg...@gmail.com> Sent: Monday, February 27, 2023 7:02:45 PM To: Bederov, Sergey <bede...@cortona3d.com> Cc: j-users@xalan.apache.org <j-users@xalan.apache.org> Subject: Re: Xalan bug: key( ) clears variable 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 <bede...@cortona3d.com<mailto:bede...@cortona3d.com>> 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<http://www.cortona3D.com>