xsl-list
[Top] [All Lists]

Boolean Short Curcuit

2005-09-23 01:50:51
In Saxon 8.(4|5).

I'm calling this function.

<xsl:function name="page:field" as="element()">
  <xsl:param name="name" as="xs:string"/>
  <xsl:sequence select="document($form-uri)/form/field[name = $name][1]"/>
</xsl:function>

During this template match. Note that I'm performing a test to see
if the parameter exists. I expect that when it doesn't exist, the
function part of the test will not be called.

<xsl:template
    match="page:message[ancestor::page:error[(_at_)name]
        and page:field(ancestor::page:error/@name)/error]"
    mode="page:page">
<page:message><xsl:value-of
    select="page:field(ancestor::page:error/@name)/error"/></page:message>
</xsl:template>

But it appears to be getting called.

Recoverable error of :
  XPTY0004: An error occurred matching pattern
  {page:message[ancestor::page:error[(_at_)name] and
        page:field(ancestor::page:error/@name)/error]}
  : An empty sequence is not allowed as the result of function page:field()

I can provide more context if necessary. I tried if/else statements
in the call to page:field, but that still produced the error.

Thanks.

--
Alan Gutierrez - alan(_at_)engrm(_dot_)com
    - http://engrm.com/blogometer/index.html
    - http://engrm.com/blogometer/rss.2.0.xml

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>