Hi Martin,
    The mentioned XSL implementation issues, within your original mail
as cited within mail trail, have been fixed within Xalan's XSLT 3.0
development branch.

You may try verifying these fixes.

On Wed, Dec 17, 2025 at 1:53 PM Martin Honnen <[email protected]> wrote:
> I have seen that support for xsl:perform-sort has landed on the Apache
> Xalan XSLT 3.0 development branch.
>
> I have tried to write a test case that sorts a sequence of XPath 3.1/XDM
> 3.1 maps, it works fine with Saxon but gives an error with Xalan:
>
> warning: VariableReference given for variable out of context or without
> definition!  Name = sorted-map-sequence1; SystemID: file:///sheet.xsl;
> Line#: 22; Column#: 52
> fatalError: java.lang.NullPointerException; SystemID: file:///sheet.xsl;
> Line#: 32; Column#: 15
>
> Test:
>
> <?xml version="1.0" encoding="utf-8"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>    version="3.0"
>    xmlns:xs="http://www.w3.org/2001/XMLSchema";
>    xmlns:map="http://www.w3.org/2005/xpath-functions/map";
>    xmlns:array="http://www.w3.org/2005/xpath-functions/array";
>    exclude-result-prefixes="#all"
>    expand-text="yes">
>
>    <xsl:param name="map-sequence1" as="map(*)*" select="(map { 'name' :
> 'foo', 'value' : 3 }, map { 'name': 'bar', 'value' : 2 })"/>
>
>    <xsl:variable name="sorted-map-sequence1" as="map(*)*">
>      <xsl:perform-sort select="$map-sequence1">
>        <xsl:sort select="?value"/>
>      </xsl:perform-sort>
>    </xsl:variable>
>
>    <xsl:output method="xml" indent="yes"/>
>
>    <xsl:template match="/*">
>      <xsl:copy>
>        <xsl:for-each select="$sorted-map-sequence1">
>          <item>
>            <name>{?name}</name>
>            <value>{?value}</value>
>          </item>
>        </xsl:for-each>
>      </xsl:copy>
>    </xsl:template>
>
>    <xsl:template match="/">
>      <xsl:copy>
>        <xsl:apply-templates/>
>        <xsl:comment>Run with {system-property('xsl:vendor')} at
> {current-dateTime()}</xsl:comment>
>      </xsl:copy>
>    </xsl:template>
>
> </xsl:stylesheet>


-- 
Regards,
Mukul Gandhi

Reply via email to