Re: Catching message from xsl:message terminate =yes in function

AirQuick <[email protected]>
Newsgroups gmane.text.xml.saxon.help
Message-ID <[email protected]>
Hi, Christophe

"Note that Saxon inserts a processing instruction into the xsl:message document containing the error code and the location of the xsl:message instruction. This is convenient, but not strictly according to spec.", per https://saxonica.plan.io/issues/4376#note-2 


----- Original message -----
From: Christophe Marchand <[email protected]>
To: [email protected]
Subject: Re: [saxon] Catching message from xsl:message terminate=yes in function
Date: Monday, June 29, 2020 16:25

Sorry AirQuick, but why do you expect a value element containing a PI ? 
I can not see in specs a PI being written to outpout...

Best,
Christophe

Le 29/06/2020 à 08:46, AirQuick a écrit :
> I expected Saxon 10.1 and 9.9.1.7 with the stylesheet below to output
>
> <value><?error-code Q{http://www.w3.org/2005/xqt-errors}XTMM9000?>my error message</value>
>
> but the actual output is
>
> $ java -jar SaxonHE10-1J/saxon-he-10.1.jar -it -xsl:test.xsl
> my error message
> <?xml version="1.0" encoding="UTF-8"?>
> <err>
>     <code>err:XTMM9000</code>
>     <description>Processing terminated by xsl:message at line 28 in test.xsl. Found while atomizing the result of a call to my:test#0</description>
>     <value/>
> </err>
>
>
> Stylesheet:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet exclude-result-prefixes="#all" version="3.0"
>     xmlns:err="http://www.w3.org/2005/xqt-errors" xmlns:my="my"
>     xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>
>     <xsl:output indent="yes" />
>
>     <xsl:template name="xsl:initial-template">
>        <xsl:try>
>           <xsl:sequence select="my:test()" />
>           <xsl:catch>
>              <err>
>                 <code>
>                    <xsl:value-of select="$err:code" />
>                 </code>
>                 <description>
>                    <xsl:value-of select="$err:description" />
>                 </description>
>                 <value>
>                    <xsl:sequence select="$err:value" />
>                 </value>
>              </err>
>           </xsl:catch>
>        </xsl:try>
>     </xsl:template>
>
>     <xsl:function as="xs:integer" name="my:test">
>        <xsl:message select="'my error message'" terminate="yes" />
>        <xsl:sequence select="1" />
>     </xsl:function>
>
> </xsl:stylesheet>
>
>
> _______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/saxon-help


_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[email protected]
https://lists.sourceforge.net/lists/listinfo/saxon-help


_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[email protected]
https://lists.sourceforge.net/lists/listinfo/saxon-help
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.