Re: [xsl] XPath that returns nothing

Subject: Re: [xsl] XPath that returns nothing
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 29 Sep 2011 11:30:09 +0100
On 29/09/2011 11:14, Andrew Welch wrote:
Yep - the drawback with that is sometimes the later steps are affected
by an error in the earlier step, so you get a load of false error
reports that potentially hide genuine errors... so you end up fixing
the earlier step and rerunning anyway to just get a clearer picture...
and if that problem was in step 2 and step 1 takes a while, well you
soon get annoyed re-running step 1 all the time


Well not always. In our case we tend to have quite complicated xpaths
checking what should have been there and putting human-oriented
messages, with suggestions for possible fixes in the log file and
sticking big red "TEXT REQUIRED HERE" in the final generated document.

If overnight, every night, you are making thousands of documents and in
one 40 page document a constraint on one parameter is missing.
it's much easier to point the developer at the document and say please
supply the information required to make the red bits go away, than to
say, your document failed to build last night as an internal xpath
selection failed a type assertion.

adding
<xsl:if test="*[2] or not(definition)">
<xsl:message>.....

in lots of places makes the transformation resemble a schematron schema
more than a transformation at times (and probably the xslt engine spends
as long doing those checks as anything else), but having the messaging
inserted at the point that the transformation fails (often an
xsl:otherwise or match="*" default case) rather than have a separate
schematron try to second-guess what input the transformation can validly
handle means that the error reporting is more accurate, and (perhaps)
more likely to get run every time.



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