This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 24310 - Importing or including xsl:package
Summary: Importing or including xsl:package
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 (show other bugs)
Version: Last Call drafts
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-16 14:51 UTC by Abel Braaksma
Modified: 2014-02-17 16:55 UTC (History)
1 user (show)

See Also:


Attachments

Description Abel Braaksma 2014-01-16 14:51:52 UTC
It seems that we are not explicit enough about whether we can or cannot use xsl:include or xsl:import to import a stylesheet that has xsl:package as its root.

The spec says:

"The referenced stylesheet module may be any of the four kinds of stylesheet module: that is, it may be standalone or embedded, and it may be standard or simplified. If it is a simplified stylesheet module then it is transformed into the equivalent standard stylesheet module by applying the transformation described in 3.9 Simplified Stylesheet Modules."[1]

While in essence this seems to exclude stylesheets that are packages, the stylesheet inside a package is considered a "embedded standard stylesheet module"[2] and a referenced stylesheet can also be an embedded standard stylesheet module.

Since locating stylesheet modules is largely implementation dependent, I think it is fair that we be explicit about this. I.e., either explicitly forbid (unless with an xpointer ref), explicitly make it implemention-dependent, or explicitly allow a referenced stylesheet module, in which case we should define whether the xsl:package declarations and the stylesheet, or only the embedded stylesheet is referenced.


[1] http://www.w3.org/TR/xslt-30/#locating-modules
[2] http://www.w3.org/TR/xslt-30/#dt-package-manifest (#2 in the numbered list)
Comment 1 Michael Kay 2014-01-29 11:18:06 UTC
I think we should explicitly disallow this.
Comment 2 Abel Braaksma 2014-02-05 14:02:59 UTC
If we explicitly disallow this, we break the rule that "a stylesheet is-a package", as defined with a transformation example under packages for stylesheets that do not have an xsl:package parent.
Comment 3 C. M. Sperberg-McQueen 2014-02-10 14:35:59 UTC
The WG discussed this in the face to face meeting in Prague; we agreed to adopt the proposal in comment 1.  (Modules are substitutable for packages, but not vice versa.)
Comment 4 Michael Kay 2014-02-11 22:05:46 UTC
Detailed changes:

(A) In the intro to 3.12, "XSLT provides two mechanisms to construct a stylesheet from multiple stylesheet modules", change "stylesheet" to "package".

(B) In 3.7, Stylesheet Modules, change the categorisation of stylesheet modules, as follows.

The principal stylesheet module of a package may take one of three forms:

* A package manifest, as decribed in 3.6 Packages, which is a subtree rooted at an xsl:package element
* An implicit package, which is a subtree rooted at an xsl:stylesheet or xsl:transform element. This is transformed automatically to a package as described in 3.6 Packages.
* A simplified stylesheet, which is a subtree rooted at a literal result element, as described in 3.9 Simplified Stylesheet Modules. This is first converted to an implicit package by wrapping it in an xsl:stylesheet element using the transformation described in 3.9, and then in an xsl:package element using the transformation described in 3.6.

A stylesheet module other than the principal stylesheet module of a package may take either of two forms:

* A standard stylesheet module, which is a subtree rooted at an xsl:stylesheet or xsl:transform element. 
* A simplified stylesheet, which is a subtree rooted at a literal result element, as described in 3.9 Simplified Stylesheet Modules. This is first converted to a standard stylesheet module by wrapping it in an xsl:stylesheet element using the transformation described in 3.9

Whichever of the above forms a module takes, the outermost element (xsl:package, xsl:stylesheet, or a literal result element) may either be the outermost element of an XML document, or it may be a child of some (non-XSLT) element in a host document. 

[Definition: A stylesheet module whose outermost element is the child of a non-XSLT element in a host document is referred to as an embedded styelsheet module.] See 3.13 Embedded Stylesheet Modules.

(C) Drop the defined term "standalone stylesheet module".

(D) In 3.12.1 change the paragraph

The referenced stylesheet module may be any of the four kinds of stylesheet module: that is, it may be standalone or embedded, and it may be standard or simplified. If it is a simplified stylesheet module then it is transformed into the equivalent standard stylesheet module by applying the transformation described in 3.9 Simplified Stylesheet Modules.

to read:

The referenced stylesheet module must be either a standard stylesheet module or a simplified stylesheet module. It must not be a package manifest. If it is a simplified stylesheet module then it is transformed into the equivalent standard stylesheet module by applying the transformation described in 3.9 Simplified Stylesheet Modules. 

[The previous paragraph already says the module can be either a complete document or an embedded element within a larger document].
Comment 5 C. M. Sperberg-McQueen 2014-02-12 13:37:24 UTC
The WG discussed this again in Prague and accepted the resolution in comment 4.
Comment 6 Michael Kay 2014-02-17 16:55:53 UTC
The changes proposed have been applied.