Subject: Re: [xsl] Signature of a function that may throw an error From: "Christophe Marchand cmarchand@xxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Fri, 25 Jan 2019 10:44:40 -0000 |
I have decided to re-write all the orchestrator, without Spring, without Zookeeper, without Redis, and with only 4 server instances instead of 12. See you in Prague, Christophe Le 24/01/2019 C 00:47, Michael Kay mike@xxxxxxxxxxxx a C)critB : > > >> On 23 Jan 2019, at 23:05, Christophe Marchand cmarchand@xxxxxxxxxx >> <mailto:cmarchand@xxxxxxxxxx> >> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx >> <mailto:xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>> wrote: >> >> It has been very difficult to understand, and your help, especially >> on the code that may raise this error, help us a lot. >> >> > > Debugging XSLT can be very challenging. I'm working on a complex > stylesheet myself at the moment (more details, come to XML Prague) and > I've been trying to improve the diagnostics and debugging aids in the > product as I go. >> >> As a conclusion, this orchestrator is going to be re-written totally. >> Never trust a program made by a developer you can't trust ! >> > Never hesitate to refactor code that's poorly structured, regardless > of who wrote it. Base your decisions on the code, not the author. The > best developers write bad code if their understanding of the > requirements was still evolving while they wrote it. > > Michael Kay > Saxonica > >> Thanks a lot, >> Christophe >> >> Le 22/01/2019 C 17:28, Michael Kay mike@xxxxxxxxxxxx a C)critB : >>> The XPath spec defines the return type of the error() function as >>> "none", and the role of "none" in the type system is pretty much >>> unspecified. As a result, there was always a steady stream of >>> problems with edge cases in the W3C test suites in this area. >>> >>> Saxon actually implements the static return type of error() as >>> item(), which is intended to ensure that you won't get a static type >>> error from this sort of construct. >>> >>> This particular example doesn't seem to give a static error with >>> Saxon 9.9, though the error message looks like it comes from Saxon. >>> The code that produces this error is intended for the case where one >>> of the branches of the conditional always returns an empty sequence >>> (typically, an implicit xsl:otherwise). >>> >>> What software version are you running? >>> >>> Michael Kay >>> Saxonica >>> >>> >>> >>>> On 22 Jan 2019, at 14:36, Christophe Marchand cmarchand@xxxxxxxxxx >>>> <mailto:cmarchand@xxxxxxxxxx> >>>> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx >>>> <mailto:xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>> wrote: >>>> >>>> Hello, >>>> >>>> I have a function that must return a xs:string, or raise an error, >>>> if result value can not be computed, or is empty-sequence. >>>> >>>> Here is function : >>>> >>>> B <xsl:function name="conf:getConfVar" as="xs:string"> >>>> B B B <xsl:param name="conf" as="element(els-conf:conf)"/> >>>> B B B <xsl:param name="varName" as="xs:string"/> >>>> B B B <xsl:sequence select=" >>>> B B B B B if (exists($conf/els-conf:variable[@name=$varName])) >>>> B B B B B then $conf/els-conf:variable[@name=$varName]/@value >>>> B B B B B else ( >>>> B B B B B B B error( >>>> B B B B B B B B B $conf:ERROR_MISSING_ENTRY, >>>> B B B B B B B B B concat('Entry ',$varName,' is missing in environment >>>> configuration') >>>> B B B B B B B ) >>>> B B B B B ) >>>> B B B B B "/> >>>> B </xsl:function> >>>> >>>> When a variable does not exist in $conf, I expect an error being >>>> raised, and expect to catch it in a xsl:try / xsl:catch. >>>> >>>> But, in this case, I get this : >>>> >>>> XTTE0780: Conditional expression: The condition is not satisfied, >>>> so an empty sequence is returned, but this is not allowed as the >>>> result of call to conf:getConfVar >>>> in xsl:sequence/@select .... >>>> >>>> * I understand that error() function never return a value, so >>>> return value does not satisfies xsl:function/@as constrint. Is >>>> it correct ? >>>> * How could I write this, as I want the return type being >>>> xs:string, and not xs:string?, and I want my error to be raised >>>> when entry is missing ? >>>> >>>> Best regards, >>>> Christophe >>>> >>>> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list> >>>> EasyUnsubscribe >>>> <http://lists.mulberrytech.com/unsub/xsl-list/293509> (by email) >>> >>> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list> >>> EasyUnsubscribe >>> <http://lists.mulberrytech.com/unsub/xsl-list/2837134> (by email) >> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list> >> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/293509> >> (by email) > > XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list> > EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/2837134> > (by email <>)
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Signature of a function t, Michael Kay mike@xxx | Thread | Re: [xsl] Signature of a function t, Michele R Combs mrro |
[xsl] Re: From XML to Windows clipb, Larry Hayashi lhtree | Date | Re: [xsl] Signature of a function t, Michele R Combs mrro |
Month |