You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by S Page <sp...@macromedia.com> on 2001/05/18 04:11:08 UTC

Xalan-J support for xsl:version and xsl:fallback ?

Continuing on my quest to write interoperable XSLT code that writes files...

I tried nesting an xsl:document tag (yes I know it's bogus and may not make any standard) inside a literal element that has the xsl:version="1.1" attribute.  Xalan-J doesn't like it.  For what it's worth, the code and approach is from the Michael Kay XSLT v2 book.

Does Xalan-J implement xsl:version handling and xsl:fallback?
What should I do instead?
Here's the Bugzilla report I filed.  

Thanks.
I'm wowed by the fast turnaround on the other bugs I filed.
=S Page

= = = = = = =



As I understand http://www.w3.org/TR/xslt?#forwards , I should be able to mention novel xsl elements unknown to Xalan-J if their parent literal result element specifies xsl:version 1.1.  Xalan-J should ignore the element and invoke the xsl:fallback for it.

However, it doesn't work.  Xalan-J complains about xsl:document even when nested inside a tag that specifies xsl:version 1.1.  (Yes I am aware that 1.1 isn't shipping yet.)

- - - - run the following against any xml document - - - - 

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
    Write something out in main document.
    <!--
        Wrap the xsl:document reference in a literal element that
        mentions xsl:version 1.1, otherwise 1.0 XSL processors
        complain about it.
    -->
    <a href ="preface.html" xsl:version="1.1">
        <!-- xalan-J doesn't like xsl:document, despite xsl:version in enclosing a tag. -->
        <xsl:document href="preface.html"
            xsl:version="1.1"
        >
            We are in xsl:document.
            <xsl:fallback>
                Fallback in case xsl:document doesn't work.
            </xsl:fallback> 
        </xsl:document>
    </a>
</xsl:template>
</xsl:stylesheet>

<!--
    BUG: 
    Even with xsl:version="1.1" on the enclosing element,
    Xalan-J 2.0.1 complains:
    file:///xml_format/tests/bugs/xsl_document.xsl; Line 14; Column 4; 
    XSLT Error (javax.xml.transform.TransformerConfigurationException):
    xsl:document is not allowed in this position in the stylesheet!


    But if I put version="1.1" on the stylesheet tag,
    Xalan-J 2.0.1 runs through the xsl:document tag,
    even though it doesn't implement it,
    and doesn't trigger the xsl:fallback.

    Same code works in InstantSaxon 6.0.2, haven't tried xt yet.
-->

-- 
=S Page  a www.macromedia.com site engineer  http://webdev.macromedia.com/~spage/ 

  Big corporations are stripping you of your rights.
  http://www.toad.com/gnu/whatswrong.html