Re: [xsl] XPath that returns nothing

Subject: Re: [xsl] XPath that returns nothing
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 28 Sep 2011 12:07:25 +0100
On 28/09/2011 11:34, Andrew Welch wrote:
On 28 September 2011 11:25, David Carlisle<davidc@xxxxxxxxx> wrote:
On 28/09/2011 11:18, Andrew Welch wrote:

...but... only if you don't specify the as attribute -

ah yes, although actually we have mixed experience of using as=, tend to use it less and less (despite MK's periodic reminders of the potential efficiency from optimisations that the extra information that the xslt engine can make given the information).

Ah that's interesting / controversial :) Do you have an example of where you were using it but decided to remove it?



our usual situation is we're running the same stylesheet over a couple of thousand input documents. With the way we are currently pipelining these transformations, if you have a function that expects a single element and you go
xsl:param name="x" as="element()"
then if one of the input documents is bad the error percolates up to the top level and not only that document fails to produce but the entire run is aborted.


if on the other hand you don't use as="element()" but instead you accept anything but have
<xsl:if test="exists($x[2]) or not($x/self::*)">
<xsl:message select='excuse me, I think parameter x might be wrong'"/>
</xsl:if>


then the run proceeds to the end but problems get logged more gracefully.

It may be that by using a different pipelining strategy each document could be isolated but I think (until there is a try/catch facility within xslt) errors reported by as= attributes will be fatal errors and so stop at the very least that document.

David

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. ________________________________________________________________________


Current Thread