Bug #3333
closedUsing an XSLT 3.0 package indirectly by several routes
100%
Description
I'd like to be able to create a single package of common functions, variables, etc.
Something like this:
<xsl:package
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
name="http://www.oup.com/oup-academic-common-package"
package-version="0.1"
version="3.0">
<xsl:use-package name="http://www.oup.com/logger" package-version="0.1"/>
<xsl:use-package name="http://www.oup.com/generalVariables" package-version="0.1"/>
<xsl:use-package name="http://www.oup.com/getDTD" package-version="0.1"/>
</xsl:package>
Both "logger" and "getDTD" packages need to use the "generalVariables" package.
The "generalVariables" package also needs to be available to the stylesheet that uses the "oup-academic-common-package".
My first attempt threw up duplicate variable error messages.
Then I had a go with xsl:accept. So now both the "logger" and "getDTD" packages contain this statement:
<xsl:use-package name="http://www.oup.com/generalVariables" package-version="0.1">
<xsl:accept component="*" names="*" visibility="private"/>
</xsl:use-package>
Now my error message is:
java.lang.AssertionError: Saxon can't find the new component corresponding to variable oupdtg:filePathSeparator
oupdtg:fileSeparator is a variable defined in the "generalVariables" package:
<xsl:package
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"
xmlns:oupdtg="http://www.oup.com/oupdtg"
name="http://www.oup.com/generalVariables"
package-version="0.1"
exclude-result-prefixes="#all"
version="3.0">
<xsl:variable name="oupdtg:newLine" as="xs:string" visibility="public">
<xsl:text>
</xsl:text>
</xsl:variable>
<xsl:variable name="oupdtg:quot" as="xs:string" visibility="public" select="'"'"/>
<xsl:variable name="oupdtg:filePathSeparator" as="xs:string" visibility="public" select="'[\\/]'"/>
</xsl:package>
If I use the three packages directly within my stylesheet (rather than wrapping them in the "oup-academic-common-package", the stylesheet works fine.
But is it possible to create this wrapper package?
Files
Related issues
Please register to edit this issue