Re: Meta-stylesheet EXSLT namespace problem
Christoffer Bruun <[email protected]> Wed, 15 Feb 2012 22:19:37 +0100
| Newsgroups | gmane.text.xml.xalan.java.user |
|---|---|
| Message-ID | <[email protected]> |
I think the easiest way is to simply remove the:
extension-element-prefixes="exsl"
- That has always worked just fine for me (I don't think Xalan actually
*uses* it for anything but to exclude the prefix from the output)
Otherwise you can try the following which is kind of a hack:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias"
xmlns:exsl2="http://exslt.org/common"
xmlns:exsl="dummy"
extension-element-prefixes="exsl2">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:strip-space elements="*"/>
<xsl:namespace-alias stylesheet-prefix="axsl" result-prefix="xsl"/>
<xsl:namespace-alias stylesheet-prefix="exsl" result-prefix="exsl2"/>
<xsl:template match="/">
<xsl:call-template name="disappearance-act" />
</xsl:template>
<xsl:template name="disappearance-act">
<axsl:stylesheet
xmlns:exsl="dummy"
extension-element-prefixes="exsl" >
<xsl:attribute name="version">1.0</xsl:attribute>
</axsl:stylesheet>
</xsl:template>
</xsl:stylesheet>
This produces the output:
<axsl:stylesheet xmlns:axsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
extension-element-prefixes="exsl"
version="1.0"/>
Christoffer Bruun
Den 12-02-2012 10:45, Jernej Tuljak skrev:
> Hi! I am having difficulties running this meta-stylesheet:
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias"
> xmlns:exsl="http://exslt.org/common"
> extension-element-prefixes="exsl">
> <xsl:output method="xml" omit-xml-declaration="yes" />
> <xsl:strip-space elements="*"/>
> <xsl:namespace-alias stylesheet-prefix="axsl" result-prefix="xsl"/>
>
> <xsl:template match="/">
> <xsl:call-template name="disappearance-act" />
> </xsl:template>
>
> <xsl:template name="disappearance-act">
> <axsl:stylesheet
> xmlns:exsl="http://exslt.org/common"
> extension-element-prefixes="exsl" >
> <xsl:attribute name="version">1.0</xsl:attribute>
> </axsl:stylesheet>
> </xsl:template>
> </xsl:stylesheet>
>
> It outputs this:
>
> <axsl:stylesheet xmlns:axsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0" extension-element-prefixes="exsl"/>
>
> As you can see the exsl namespace in the generated stylesheet is
> simply gobbled up. The problem is easily solved by removing that
> namespace from the root stylesheet (or to put it in another way, move
> all EXSLT stuff to an external stylesheet and then include it). But I
> would like to know what causes the namespace to disappear. Afterall
> one should be able to use EXSLT in both the meta-stylesheet and in the
> generated stylesheet without having to use two separate stylesheets,
> right?
>
> Using xalan-j_2_7_1 (xalan.jar) with java 1.6. Saxon 6.5.5 also
> suffers from this problem so it might be a XSLT 1.0 limitation I'm not
> aware of. Searching this mailing list did not help me find an answer.
> Also this is my first time using _any_ mailing list, so please be
> gentle if I'm doing it wrong.
>
> Thanks, Jernej