This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Which engine? (RE: JavaScript and XSL)


Paul Tchistopolskii wrote:
> Mike Brown wrote:
> > My opinion is that if I write a stylesheet with version="1.0" then it is
> > my job as a document author to not attempt to do anything that isn't
> > allowed by XSLT 1.0.
> [...]
> This was the header of my stylesheet. It says version="1.0".
> 
> This means SAXON already allows me to write XSLT 1.1
> using version="1.0". Right? 
> 
> This means stylesheets I write in SAXON are not portable.
> ( in the universe of version="1.0" )

Well, per my statement above, if your stylesheet (which you must have
written since SAXON 5.5 came out, so there's probably time to change it
:)) depends on the implicit type cast that is not allowed in 1.0, then no,
your stylesheet is not really an XSLT 1.0 document. Why would you expect
it to be 'portable' to XSLT-1.0 compliant processors? I think it is
unreasonable to have such an expectation.

Better yet, how do you define 'portable'?

Does it mean you can execute the stylesheet with any processor?
Does it mean you will achieve the same output with any processor?
Does it mean the stylesheet contains nothing that is disallowed by the
version of XSLT the stylesheet claims to conform to, except within the
guidelines of 'forwards-compatible mode' processing?

These are separate questions ... degrees of portability.

XSLT provides function-available(), system-property(), xsl:version
attributes and 'forwards-compatible mode' ... I think SAXON should require
xsl:version="1.1" to be in effect to do the type cast, but I may be
misunderstanding that somewhat obtuse section of the spec. Something like

<xsl:stylesheet ...  version="1.0">
  ...
  <xsl:template match="/">
    ...
    <xsl:variable name="rtf">
      <foo/>
      <bar>baz</bar>
    </xsl:variable>
    ...
    <xsl:choose>
      <xsl:when test="system-property('xsl:version') &gt;='1.1'">
        <xsl:apply-templates select="$rtf/*" xsl:version="1.1"/>
      </xsl:when>
      <xsl:when test="function-available('xt:node-set')">
        <xsl:apply-templates select="xt:node-set($rtf/*)"/>
      </xsl:when>
      <xsl:when test="function-available('saxon:node-set')">
        <xsl:apply-templates select="saxon:node-set($rtf/*)"/>
      </xsl:when>
      ...
      <xsl:otherwise>
        <xsl:message terminate="yes">Sorry, you need to be able to convert result tree fragments to node-sets to use this stylesheet</xsl:message>
      </xsl:otherwise>
    </xsl:choose>
 ...

I may have this wrong, but you see the idea... this stylesheet is
'portable' and may also be 'conformant' to XSLT 1.0, but does not
necessarily produce the same results on all processors.

   - Mike
____________________________________________________________________
Mike J. Brown, software engineer at         My XML/XSL resources:
webb.net in Denver, Colorado, USA           http://www.skew.org/xml/


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]