Re: [transquery-discuss] Interoperability and xsl:param (was Re: Ananalogy)

From: Evan Lenz (elenz@xyzfind.com)
Date: Wed Dec 12 2001 - 16:16:18 CET


Bryan Rasmussen wrote:
> Well I was just thinking about that with document(), dependant on
processor,
> if you're trying to return a document that doesn't exist, or isn't
> accessible, you can get either a recoverable error or a complete failure,
> obviously there will be cases where x:input doesn't return a document, do
> you in those cases get a nodeset returned with error info? It would be
> interesting if error messages were standardised across Transquery
> implementations.

This is an interesting idea. We should try to think about how that would
actually play out for users. I'm not sure it will work, because it doesn't
represent a first-class error condition for the user. Unless the stylesheet
writer explicitly tests for the presence of x:error, then processing will
keep on going without any notice. I think it would be contrary to the XSLT
rec to do anything else, i.e. throwing an error where there's not really an
error.

So it seems that the user would be required to do something like the
following in order to explicitly test for the error condition:

<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:tq="http://www.xmlportfolio.com/transquery">

  <xsl:param name="tq:input"/>

  <xsl:template match="/">
    <xsl:choose>
      <xsl:when test="$tq:input/tq:error">
        <xsl:message terminate="yes">
          <xsl:value-of select="$tq:input/tq:error"/>
        </xsl:message>
      </xsl:when>
      <xsl:otherwise>
        <xsl:copy-of select="$tq:input//purchaseOrder[paid='yes']"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

</xsl:stylesheet>

This might not be what you had in mind, but I know I don't like it.

Evan



This archive was generated by hypermail 2.1.4 : Fri Feb 22 2002 - 11:35:58 CET