Re: [xsl] [Ann] jd.xslt - a XSLT 1.1 processor

Subject: Re: [xsl] [Ann] jd.xslt - a XSLT 1.1 processor
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Thu, 8 Mar 2001 15:32:14 +0000
Hi Sebastian,

> can someone tell me (and forgive my ignorance) how to make other
> processors accept stylesheets using xsl:document (assuming that they
> dont reach the code, as its in an xsl:choose case)?

If you put a version="1.1" on the xsl:stylesheet element, then the
XSLT 1.0 processor should process the stylesheet in
forwards-compatible mode, which means that it shouldn't complain just
'cos the element is there.  (If you don't put version="1.1" on the
xsl:stylesheet element then it might.)

You can avoid xsl:document being instantiated by testing the version
of XSLT supported by the processor:

   <xsl:choose>
      <xsl:when test="system-property('xsl:version') >= 1.1">
         <xsl:document>...</xsl:document>
      </xsl:when>
      <xsl:when test="element-available('saxon:output')">
         <saxon:output>...</saxon:output>
      </xsl:when>
      ...
      <xsl:otherwise>
         <xsl:message terminate="yes">
            ERROR: Unable to write to other documents.
         </xsl:message>
      </xsl:otherwise>
   </xsl:choose>

Or you can use xsl:fallback instead:

   <xsl:document>
      ...
      <xsl:fallback>
         <saxon:output>
            ...
            <xsl:fallback>
               <xsl:message terminate="yes">
                  ERROR: Unable to write to other documents.
               </xsl:message>
            </xsl:fallback>
         </saxon:output>
      </xsl:fallback>
   </xsl:document>

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread