xslt:transform-report result
Wednesday, 4 May 2022 · 8 messages · last reply 11 Mar 2024
AB
Andy Bunce4 May 2022 15:12 #
Hi,
Using BaseX 9.7.1 and saxon9he-9.9.1.jar
The documentation suggests the ?result from
xslt:transform-report should be *a* document-node where possible [1]
This seems not quite to be the case when there are processing instructions or comments at the top level. In these cases a sequence of document-nodes is returned.
/Andy
[1] https://docs.basex.org/wiki/XSLT_Module#xslt:transform-reportlet $xslt:=<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="3.0">
<xsl:mode on-no-match="shallow-copy"/>
</xsl:stylesheet>
let $xml:=document{ <?something type="compact"?>, <foo/>}
return xslt:transform-report($xml,$xslt)Returns
map {
"messages": (),
"result": (<?something type="compact"?>, <foo/>)
}
CG
Christian Grün4 May 2022 17:58 #
Thanks, Andy, I’ve updated the documentation.
Quoted text · Andy Bunce · 31 lines
On Wed, May 4, 2022 at 3:12 PM Andy Bunce <bunce.andy at gmail.com> wrote: > Hi, > > Using BaseX 9.7.1 and saxon9he-9.9.1.jar > The documentation suggests the ?result from xslt:transform-report should > be *a* document-node where possible [1] > This seems not quite to be the case when there are processing instructions > or comments at the top level. In these cases a sequence of document-nodes > is returned. > > /Andy > [1] https://docs.basex.org/wiki/XSLT_Module#xslt:transform-report > > let $xslt:=<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > version="3.0"> > <xsl:mode on-no-match="shallow-copy"/> > </xsl:stylesheet> > > let $xml:=document{ <?something type="compact"?>, <foo/>} > return xslt:transform-report($xml,$xslt) > > Returns > map { > "messages": (), > "result": (<?something type="compact"?>, <foo/>) > } > > > > >
AB
Andy Bunce4 May 2022 23:11 #
Ok thanks. I thought this might have been unintended behavior. if($report?result instance of document-node()+) then
document{$report?result} else $report?result
seems to give me what I expected here.
/Andy
Quoted text · Christian Grün · 36 lines
On Wed, 4 May 2022 at 16:58, Christian Grün <christian.gruen at gmail.com> wrote: > Thanks, Andy, I’ve updated the documentation. > > On Wed, May 4, 2022 at 3:12 PM Andy Bunce <bunce.andy at gmail.com> wrote: > >> Hi, >> >> Using BaseX 9.7.1 and saxon9he-9.9.1.jar >> The documentation suggests the ?result from xslt:transform-report should >> be *a* document-node where possible [1] >> This seems not quite to be the case when there are processing >> instructions or comments at the top level. In these cases a sequence of >> document-nodes is returned. >> >> /Andy >> [1] https://docs.basex.org/wiki/XSLT_Module#xslt:transform-report >> >> let $xslt:=<xsl:stylesheet xmlns:xsl=" >> http://www.w3.org/1999/XSL/Transform" version="3.0"> >> <xsl:mode on-no-match="shallow-copy"/> >> </xsl:stylesheet> >> >> let $xml:=document{ <?something type="compact"?>, <foo/>} >> return xslt:transform-report($xml,$xslt) >> >> Returns >> map { >> "messages": (), >> "result": (<?something type="compact"?>, <foo/>) >> } >> >> >> >> >>
CG
Christian Grün4 May 2022 23:16 #
I agree it's somewhat unexpected. As we are working on the string result that is returned by Saxon, it's currently not that easy indeed to decide how to interpret the character stream.
Quoted text · Andy Bunce · 45 lines
Andy Bunce <bunce.andy at gmail.com> schrieb am Mi., 4. Mai 2022, 23:11: > Ok thanks. I thought this might have been unintended behavior. > if($report?result instance of document-node()+) then > document{$report?result} else $report?result > seems to give me what I expected here. > /Andy > > > On Wed, 4 May 2022 at 16:58, Christian Grün <christian.gruen at gmail.com> > wrote: > >> Thanks, Andy, I’ve updated the documentation. >> >> On Wed, May 4, 2022 at 3:12 PM Andy Bunce <bunce.andy at gmail.com> wrote: >> >>> Hi, >>> >>> Using BaseX 9.7.1 and saxon9he-9.9.1.jar >>> The documentation suggests the ?result from xslt:transform-report should >>> be *a* document-node where possible [1] >>> This seems not quite to be the case when there are processing >>> instructions or comments at the top level. In these cases a sequence of >>> document-nodes is returned. >>> >>> /Andy >>> [1] https://docs.basex.org/wiki/XSLT_Module#xslt:transform-report >>> >>> let $xslt:=<xsl:stylesheet xmlns:xsl=" >>> http://www.w3.org/1999/XSL/Transform" version="3.0"> >>> <xsl:mode on-no-match="shallow-copy"/> >>> </xsl:stylesheet> >>> >>> let $xml:=document{ <?something type="compact"?>, <foo/>} >>> return xslt:transform-report($xml,$xslt) >>> >>> Returns >>> map { >>> "messages": (), >>> "result": (<?something type="compact"?>, <foo/>) >>> } >>> >>> >>> >>> >>>
AB
Andy Bunce8 Mar 2024 18:56 #
Hi,
I have recently been using
xslt:transform-report to get xsl:message reports. I am using BaseX 10.7 with various versions of Saxon-he. I have run example 4 from[1]
with
- saxon-he-10.9.jar
- saxon-he-11.6.jar
- saxon-he-12.4.jar
Only saxon-he-10 captures the messages for me. (although when using BaseX 11 I seem to recall only Saxon 12 captured them)
Is this correct and expected?
I understand the Saxon API may be a moving target.
Perhaps the documentation could indicate a recommended Saxon version for a given BaseX version, rather than "For the moment, messages can only be returned with recent versions of Saxon."
I have made minor updates to [2] to this effect. Please edit or revert if my understanding is incorrect.
/Andy
.
[1] https://docs.basex.org/wiki/XSLT_Module#Examples
[2] https://help.basex.org/main/XSLT_ModuleQuoted text · Christian Grün · 54 lines
On Wed, 4 May 2022 at 22:16, Christian Grün <christian.gruen at gmail.com> wrote: > I agree it's somewhat unexpected. As we are working on the string result > that is returned by Saxon, it's currently not that easy indeed to decide > how to interpret the character stream. > > > > Andy Bunce <bunce.andy at gmail.com> schrieb am Mi., 4. Mai 2022, 23:11: > >> Ok thanks. I thought this might have been unintended behavior. >> if($report?result instance of document-node()+) then >> document{$report?result} else $report?result >> seems to give me what I expected here. >> /Andy >> >> >> On Wed, 4 May 2022 at 16:58, Christian Grün <christian.gruen at gmail.com> >> wrote: >> >>> Thanks, Andy, I’ve updated the documentation. >>> >>> On Wed, May 4, 2022 at 3:12 PM Andy Bunce <bunce.andy at gmail.com> wrote: >>> >>>> Hi, >>>> >>>> Using BaseX 9.7.1 and saxon9he-9.9.1.jar >>>> The documentation suggests the ?result from xslt:transform-report >>>> should be *a* document-node where possible [1] >>>> This seems not quite to be the case when there are processing >>>> instructions or comments at the top level. In these cases a sequence of >>>> document-nodes is returned. >>>> >>>> /Andy >>>> [1] https://docs.basex.org/wiki/XSLT_Module#xslt:transform-report >>>> >>>> let $xslt:=<xsl:stylesheet xmlns:xsl=" >>>> http://www.w3.org/1999/XSL/Transform" version="3.0"> >>>> <xsl:mode on-no-match="shallow-copy"/> >>>> </xsl:stylesheet> >>>> >>>> let $xml:=document{ <?something type="compact"?>, <foo/>} >>>> return xslt:transform-report($xml,$xslt) >>>> >>>> Returns >>>> map { >>>> "messages": (), >>>> "result": (<?something type="compact"?>, <foo/>) >>>> } >>>> >>>> >>>> >>>> >>>>
CG
Christian Grün11 Mar 2024 08:12 #
Hi Andy,
Thanks for your edits, which I’ve just revised: It turns out that Saxon 10 is required for
xslt:transform-report for both BaseX 10 and 11 beta. As you’ve indicated, the Saxon API seems to change with new versions. We haven’t checked yet what exactly has changed, and whether the API has changed again from version 11 to 12 .
Best,
ChristianQuoted text · Andy Bunce · 85 lines
On Fri, Mar 8, 2024 at 6:57 PM Andy Bunce <bunce.andy at gmail.com> wrote: > Hi, > > I have recently been using xslt:transform-report to get xsl:message > reports. > I am using BaseX 10.7 with various versions of Saxon-he. I have run > example 4 from[1] > with > > - saxon-he-10.9.jar > - saxon-he-11.6.jar > - saxon-he-12.4.jar > > Only saxon-he-10 captures the messages for me. (although when using BaseX > 11 I seem to recall only Saxon 12 captured them) > Is this correct and expected? > > I understand the Saxon API may be a moving target. > Perhaps the documentation could indicate a recommended Saxon version for a > given BaseX version, rather than "For the moment, messages can only be > returned with recent versions of Saxon." > I have made minor updates to [2] to this effect. Please edit or revert if > my understanding is incorrect. > > /Andy > . > [1] https://docs.basex.org/wiki/XSLT_Module#Examples > [2] https://help.basex.org/main/XSLT_Module > > > On Wed, 4 May 2022 at 22:16, Christian Grün <christian.gruen at gmail.com> > wrote: > >> I agree it's somewhat unexpected. As we are working on the string result >> that is returned by Saxon, it's currently not that easy indeed to decide >> how to interpret the character stream. >> >> >> >> Andy Bunce <bunce.andy at gmail.com> schrieb am Mi., 4. Mai 2022, 23:11: >> >>> Ok thanks. I thought this might have been unintended behavior. >>> if($report?result instance of document-node()+) then >>> document{$report?result} else $report?result >>> seems to give me what I expected here. >>> /Andy >>> >>> >>> On Wed, 4 May 2022 at 16:58, Christian Grün <christian.gruen at gmail.com> >>> wrote: >>> >>>> Thanks, Andy, I’ve updated the documentation. >>>> >>>> On Wed, May 4, 2022 at 3:12 PM Andy Bunce <bunce.andy at gmail.com> wrote: >>>> >>>>> Hi, >>>>> >>>>> Using BaseX 9.7.1 and saxon9he-9.9.1.jar >>>>> The documentation suggests the ?result from xslt:transform-report >>>>> should be *a* document-node where possible [1] >>>>> This seems not quite to be the case when there are processing >>>>> instructions or comments at the top level. In these cases a sequence of >>>>> document-nodes is returned. >>>>> >>>>> /Andy >>>>> [1] https://docs.basex.org/wiki/XSLT_Module#xslt:transform-report >>>>> >>>>> let $xslt:=<xsl:stylesheet xmlns:xsl=" >>>>> http://www.w3.org/1999/XSL/Transform" version="3.0"> >>>>> <xsl:mode on-no-match="shallow-copy"/> >>>>> </xsl:stylesheet> >>>>> >>>>> let $xml:=document{ <?something type="compact"?>, <foo/>} >>>>> return xslt:transform-report($xml,$xslt) >>>>> >>>>> Returns >>>>> map { >>>>> "messages": (), >>>>> "result": (<?something type="compact"?>, <foo/>) >>>>> } >>>>> >>>>> >>>>> >>>>> >>>>>
MG
Murray, Gregory11 Mar 2024 17:40 #
Hi Christian,
I made two tweaks in the documentation for
xslt:transform-report. First, the function returns a map, but the documentation indicated xs:string as the return type, so I changed it to map(*). Second, the function seems to work fine as long as the stylesheet doesn’t rely on <xsl:message>, so indicating “Requires Saxon 10” at the beginning of the “Summary” for the entire function seems misleading. Based on what you’ve said below, only the “messages” value of the map doesn’t work without Saxon 10. So, I moved “Requires Saxon 10” to the “messages” description. (Using <b>Requires Saxon 10</b> causes a display oddity, so I omitted the <b> wrapper.)
Please revert or fix my changes as you deem best.
Thanks,
GregQuoted text · BaseX-Talk · 52 lines
From: BaseX-Talk <basex-talk-bounces at mailman.uni-konstanz.de> on behalf of Christian Grün <christian.gruen at gmail.com> Date: Monday, March 11, 2024 at 3:12 AM To: Andy Bunce <bunce.andy at gmail.com> Cc: BaseX <basex-talk at mailman.uni-konstanz.de> Subject: Re: [basex-talk] xslt:transform-report result Hi Andy, Thanks for your edits, which I’ve just revised: It turns out that Saxon 10 is required for xslt:transform-report for both BaseX 10 and 11 beta. As you’ve indicated, the Saxon API seems to change with new versions. We haven’t checked yet what exactly has changed, and whether the API has changed again from version 11 to 12 . Best, Christian On Fri, Mar 8, 2024 at 6:57 PM Andy Bunce <bunce.andy at gmail.com<mailto:bunce.andy at gmail.com>> wrote: Hi, I have recently been using xslt:transform-report to get xsl:message reports. I am using BaseX 10.7 with various versions of Saxon-he. I have run example 4 from[1] with * saxon-he-10.9.jar * saxon-he-11.6.jar * saxon-he-12.4.jar Only saxon-he-10 captures the messages for me. (although when using BaseX 11 I seem to recall only Saxon 12 captured them) Is this correct and expected? I understand the Saxon API may be a moving target. Perhaps the documentation could indicate a recommended Saxon version for a given BaseX version, rather than "For the moment, messages can only be returned with recent versions of Saxon." I have made minor updates to [2] to this effect. Please edit or revert if my understanding is incorrect. /Andy . [1] https://docs.basex.org/wiki/XSLT_Module#Examples [2] https://help.basex.org/main/XSLT_Module On Wed, 4 May 2022 at 22:16, Christian Grün <christian.gruen at gmail.com<mailto:christian.gruen at gmail.com>> wrote: I agree it's somewhat unexpected. As we are working on the string result that is returned by Saxon, it's currently not that easy indeed to decide how to interpret the character stream. Andy Bunce <bunce.andy at gmail.com<mailto:bunce.andy at gmail.com>> schrieb am Mi., 4. Mai 2022, 23:11: Ok thanks. I thought this might have been unintended behavior. if($report?result instance of document-node()+) then document{$report?result} else $report?result seems to give me what I expected here. /Andy On Wed, 4 May 2022 at 16:58, Christian Grün <christian.gruen at gmail.com<mailto:christian.gruen at gmail.com>> wrote: Thanks, Andy, I’ve updated the documentation. On Wed, May 4, 2022 at 3:12 PM Andy Bunce <bunce.andy at gmail.com<mailto:bunce.andy at gmail.com>> wrote: Hi, Using BaseX 9.7.1 and saxon9he-9.9.1.jar The documentation suggests the ?result from xslt:transform-report should be a document-node where possible [1] This seems not quite to be the case when there are processing instructions or comments at the top level. In these cases a sequence of document-nodes is returned. /Andy [1] https://docs.basex.org/wiki/XSLT_Module#xslt:transform-report let $xslt:=<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0"> <xsl:mode on-no-match="shallow-copy"/> </xsl:stylesheet> let $xml:=document{ <?something type="compact"?>, <foo/>} return xslt:transform-report($xml,$xslt) Returns map { "messages": (), "result": (<?something type="compact"?>, <foo/>) }
CG
Christian Grün11 Mar 2024 17:58 #
…very appreciated, Greg! Your edits look completely fine. Thanks.
Quoted text · Gregory · 185 lines
On Mon, Mar 11, 2024 at 5:49 PM Murray, Gregory <gregory.murray at ptsem.edu> wrote: > Hi Christian, > > > > I made two tweaks in the documentation for xslt:transform-report. First, > the function returns a map, but the documentation indicated xs:string as > the return type, so I changed it to map(*). Second, the function seems to > work fine as long as the stylesheet doesn’t rely on <xsl:message>, so > indicating “Requires Saxon 10” at the beginning of the “Summary” for the > entire function seems misleading. Based on what you’ve said below, only the > “messages” value of the map doesn’t work without Saxon 10. So, I moved > “Requires Saxon 10” to the “messages” description. (Using <b>Requires Saxon > 10</b> causes a display oddity, so I omitted the <b> wrapper.) > > > > Please revert or fix my changes as you deem best. > > > > Thanks, > > Greg > > > > *From: *BaseX-Talk <basex-talk-bounces at mailman.uni-konstanz.de> on behalf > of Christian Grün <christian.gruen at gmail.com> > *Date: *Monday, March 11, 2024 at 3:12 AM > *To: *Andy Bunce <bunce.andy at gmail.com> > *Cc: *BaseX <basex-talk at mailman.uni-konstanz.de> > *Subject: *Re: [basex-talk] xslt:transform-report result > > Hi Andy, > > > > Thanks for your edits, which I’ve just revised: It turns out that Saxon 10 > is required for xslt:transform-report for both BaseX 10 and 11 beta. As > you’ve indicated, the Saxon API seems to change with new versions. We > haven’t checked yet what exactly has changed, and whether the API has > changed again from version 11 to 12 . > > > > Best, > > Christian > > > > > > On Fri, Mar 8, 2024 at 6:57 PM Andy Bunce <bunce.andy at gmail.com> wrote: > > Hi, > > > > I have recently been using xslt:transform-report to get xsl:message > reports. > I am using BaseX 10.7 with various versions of Saxon-he. I have run > example 4 from[1] > with > > - saxon-he-10.9.jar > - saxon-he-11.6.jar > - saxon-he-12.4.jar > > Only saxon-he-10 captures the messages for me. (although when using BaseX > 11 I seem to recall only Saxon 12 captured them) > > Is this correct and expected? > > > > I understand the Saxon API may be a moving target. > > Perhaps the documentation could indicate a recommended Saxon version for a > given BaseX version, rather than "For the moment, messages can only be > returned with recent versions of Saxon." > > I have made minor updates to [2] to this effect. Please edit or revert if > my understanding is incorrect. > > > > /Andy > > . > > [1] https://docs.basex.org/wiki/XSLT_Module#Examples > > [2] https://help.basex.org/main/XSLT_Module > > > > On Wed, 4 May 2022 at 22:16, Christian Grün <christian.gruen at gmail.com> > wrote: > > I agree it's somewhat unexpected. As we are working on the string result > that is returned by Saxon, it's currently not that easy indeed to decide > how to interpret the character stream. > > > > > > > > Andy Bunce <bunce.andy at gmail.com> schrieb am Mi., 4. Mai 2022, 23:11: > > Ok thanks. I thought this might have been unintended behavior. > > if($report?result instance of document-node()+) then > document{$report?result} else $report?result > > seems to give me what I expected here. > > /Andy > > > > > > On Wed, 4 May 2022 at 16:58, Christian Grün <christian.gruen at gmail.com> > wrote: > > Thanks, Andy, I’ve updated the documentation. > > > > On Wed, May 4, 2022 at 3:12 PM Andy Bunce <bunce.andy at gmail.com> wrote: > > Hi, > > > > Using BaseX 9.7.1 and saxon9he-9.9.1.jar > > The documentation suggests the ?result from xslt:transform-report should > be *a* document-node where possible [1] > > This seems not quite to be the case when there are processing instructions > or comments at the top level. In these cases a sequence of document-nodes > is returned. > > > > /Andy > > [1] https://docs.basex.org/wiki/XSLT_Module#xslt:transform-report > > > > let $xslt:=<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > version="3.0"> > <xsl:mode on-no-match="shallow-copy"/> > </xsl:stylesheet> > > > > let $xml:=document{ <?something type="compact"?>, <foo/>} > return xslt:transform-report($xml,$xslt) > > > > Returns > > map { > "messages": (), > "result": (<?something type="compact"?>, <foo/>) > } > > > > > > > > > >
Written for BaseX 9.7, 10.7. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery