2

I'm trying xsl:package for the first time but getting an error on the command line-

xml (not really used)-

<woot/>

package.xsl-

<?xml version="1.0" encoding="UTF-8"?>
<xsl:package name="http://example.org/package.xsl"
    package-version="1.0"  version="3.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:f="http://example.org/package">

    <xsl:function name="f:woot" visibility="public">
        <xsl:value-of select="'DANGGGG'"/>
    </xsl:function>

</xsl:package>

package-use.xsl

<?xml version="1.0" encoding="UTF-8"?>
<xsl:package name="http://example.org/package-use.xsl"
    package-version="1.0"  version="3.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:f="http://example.org/package">

    <xsl:use-package name="http://example.org/package.xsl" package-version="1.0"/>

    <xsl:template match="/">
        <xsl:variable name="output-text" select="f:woot()"/>
        <xsl:value-of select="$output-text"/>

    </xsl:template>
</xsl:package>

On command line (using saxon 9.7)

> java -jar saxon9ee.jar woot.xml package-use.xsl;package.xsl

returns-

Possible circular package dependency

I tried similar transformation on Oxygen XML with Saxon 9.6 and got java.lang.NullPointerException.

Vinit
  • 1,815
  • 17
  • 38

1 Answers1

1

I've logged a Saxon bug here:

https://saxonica.plan.io/issues/2541

I'm afraid that until we issue a patch there's no workaround other than running the transformation from the s9api API rather than from the command line.

You will hit another issue when you get past this one: your package needs to declare the modes it uses. Adding an empty <xsl:mode/> declaration is the minimum fix.

Michael Kay
  • 156,231
  • 11
  • 92
  • 164
  • Thanks for looking into this and also pointing out the mode issue. Looking forward to the next release. – Vinit Dec 15 '15 at 16:29