Home > database >  Has <xsl:package> been deprecated in XSLT 3.0?
Has <xsl:package> been deprecated in XSLT 3.0?

Time:09-26

This used to work years ago, but not anymore. It says:

"Unbound namespace prefix: "xsl:package" at line 1 column 36"

<?xml version="1.0"?>
<xsl:package name="P" version="9.0">
   <xsl:global-context-item as="item()" use="optional" streamable="true" />
   <xsl:expose component="template" names="T1 T2" visibility="public"/>
   <xsl:use-package name="P2" version="10.0">
      <xsl:accept component="template" names="T1 T2" visibility="public"/>
      <xsl:override>
          <xsl:template match="object">
             <dummy/>
          </xsl:template>  
      </xsl:override>
   </xsl:use-package>
  
   <xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:import href="a.xsl"/>
     <xsl:include href="b.xsl" use-when="system-property('xsl:vendor')='vendorX'"/>
     <xsl:template match="person">
        <override>
           <xsl:apply-imports/>    
        </override>
     </xsl:template>
     <xsl:template match="animal">
        <override>
           <xsl:next-match/>    
        </override>
     </xsl:template>
   </xsl:stylesheet>
</xsl:package>

CodePudding user response:

The problem here is not with the local name "package", the problem is the undeclared namespace prefix xsl. An XSLT stylesheet must be a well-formed XML document, and this isn't because of the undeclared namespace prefix.

Another problem here is the nesting of xsl:stylesheet within xsl:package. That may correspond to the syntax defined in some early draft of XSLT 3.0, but it's not allowed in the final specification.

  • Related