[Home] [By Thread] [By Date] [Recent Entries]

Subject: xsl:package use question
From: "Mukul Gandhi mukulg@xxxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 10 Feb 2026 06:01:56 -0000
Hello xsl-list,
    I've been trying to run an XSL stylesheet using xsl:package instruction
to bind two stylesheet modules together, using Saxon XSL 3 transformer.
I've tried with both Saxon-HE 12.9 and Saxon-EE 10.3.

Following are XSL 3 stylesheet examples that I've tried to run.

XML document (test1.xml):

<?xml version="1.0" encoding="UTF-8"?>
<info1/>

XSL stylesheet 1 (test1.xsl):

<?xml version="1.0" encoding="UTF-8"?>
<xsl:package name="http://package1"
                      package-version="1.0.0"
                      version="3.0"
                      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                      xmlns:fn0="http://fn0"
                      exclude-result-prefixes="fn0">

       <xsl:output method="xml" indent="yes"/>

       <xsl:include href="test2.xsl"/>

       <xsl:use-package name="http://package2" package-version="1.0.0">
            <xsl:accept component="function" names="fn0:abc"
visibility="public"/>
       </xsl:use-package>

       <xsl:template match="/">
            <result>
                <xsl:value-of select="fn0:abc()"/>
            </result>
       </xsl:template>

</xsl:package>

XSL stylesheet 2 (test2.xsl):

<?xml version="1.0" encoding="UTF-8"?>
<xsl:package name="http://package2"
                      package-version="1.0.0"
                      version="3.0"
                      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                      xmlns:xs="http://www.w3.org/2001/XMLSchema"
                      xmlns:fn0="http://fn0"
                      exclude-result-prefixes="xs fn0">

        <xsl:expose component="function" names="fn0:abc"
visibility="public"/>

        <xsl:function name="fn0:abc" visibility="public" as="xs:string">
             <xsl:sequence select="'Hello, ' || fn0:abc1()"/>
        </xsl:function>

        <xsl:function name="fn0:abc1" visibility="private" as="xs:string">
             <xsl:sequence select="'..., ref local only function. This
cannot be accessed, from outside this package.'"/>
        </xsl:function>

</xsl:package>

When I run, an XSL stylesheet test1.xsl using XML document test1.xml as an
input, I get following results with Saxon,

XTSE3000  Cannot find package http://package2 (version 1.0.0)
Cannot find package http://package2 (version 1.0.0)

Can anyone, please find an error and let us know, with how I'm using XSLT
and Saxon XSL processor?

Thanks in advance.


-- 
Regards,
Mukul Gandhi

Current Thread
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member