Re: Fwd: Spurious error on recursive invocation of fn:transform

Martin Honnen <[email protected]> Tue, 24 Nov 2020 22:04:33 +0100
Newsgroups gmane.text.xml.saxon.help
Organization Liberty Development
Message-ID <[email protected]>
On 24.11.2020 21:49, Martin Honnen wrote:
> On 24.11.2020 15:57, Ihe Onwuka wrote:
>>
>> On Tue, Nov 24, 2020 at 7:32 AM Michael Kay <[email protected]
>> <mailto:[email protected]>> wrote:
>
>>     Having said that, if you can put together a repro we'll be happy to
>>     look at it. I think it's fairly clear the problem is happening
>>     because the base URI is being lost through the call on
>>     fn:transform(), but whether losing it is a bug or an application
>>     error is something we can only determine if we study the detail.
>
>> Here.
>>
>> Here is bug.xsl
>> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform
>> <http://www.w3.org/1999/XSL/Transform>"
>>                  xmlns:fn="http://www.w3.org/2005/xpath-functions
>> <http://www.w3.org/2005/xpath-functions>"
>>         xmlns:xs="http://www.w3.org/2001/XMLSchema
>> <http://www.w3.org/2001/XMLSchema>"
>>         xmlns:local="urn:local"
>> version="3.0" >
>>
>>     <xsl:mode on-no-match="shallow-copy"/>
>>     <xsl:function name="local:generateNextVersion" as="document-node()">
>>        <xsl:param name="currentVersion" as="document-node()"/>
>>        <xsl:variable name="isFinalVersion" as="xs:boolean"
>> select="$currentVersion/* eq '3'"/>
>>        <xsl:sequence select="if ($isFinalVersion)
>>                              then $currentVersion
>>                              else
>> local:generateNextVersion(fn:transform(map {
>>
>>   'stylesheet-node' : doc(''),
>>                                                      'source-node'     :
>>   $currentVersion
>>
>> })?output)"/>
>>     </xsl:function>
>>
>>     <xsl:template match="*">
>>    <xsl:message select="."/>
>>        <xsl:copy>
>>           <xsl:sequence select="let $customizedResult :=
>> fn:transform(map {
>>
>> 'stylesheet-node' :  doc('bugs2.xsl'),
>>
>> 'source-node'     :  /
>>                                                                 })?output
>>                                 return
>>   local:generateNextVersion($customizedResult)"/>
>>         </xsl:copy>
>>     </xsl:template>
>>
>>   </xsl:stylesheet>
>>
>> Here is bugs2.xsl
>> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform
>> <http://www.w3.org/1999/XSL/Transform>"
>>                  xmlns:fn="http://www.w3.org/2005/xpath-functions
>> <http://www.w3.org/2005/xpath-functions>"
>> version="3.0" >
>>
>>     <xsl:mode on-no-match="shallow-copy"/>
>>     <xsl:template match="*">
>>        <xsl:copy>
>>           <xsl:value-of select=". + 1"/>
>>        </xsl:copy>
>>     </xsl:template>
>>
>>   </xsl:stylesheet>
>>
>> Here is input XML
>>
>> <bug>1</bug>
>>
>> Reproduction instructions.
>>
>> Run the transform bug.xsl against input bug.xml and see the xsl:message
>> output below
>>
>> <bug>1</bug>
>> <bug>2</bug>
>>
>> Change bug.xsl to test for $currentVersion eq '4' instead of 3
>>
>> crashes as below
>>
>> <bug>1</bug>
>> <bug>2</bug>
>> Error in bugs2.xsl:
>>    XTSE0150  The supplied file does not appear to be a stylesheet
>> Static error in bugs2.xsl:
>>    XTSE0150  The supplied file does not appear to be a stylesheet
>> Error in bugs2.xsl:
>>    XTSE0150  The supplied file does not appear to be a stylesheet
>> at function local:generateNextVersion in bug.xsl:
>>       invoked by function call
>>    In template rule with match="*" of bug.xsl
>>       invoked by built-in template rule (shallow-copy)
>> The supplied file does not appear to be a stylesheet
>
> It seems to be a regression in 10.3, with lower 10.x versions it runs
> through, with 9.9 (9.9.1.8J) as well.

Not quite, the posted code fails with lower 10.x versions as well, only
using doc('bug.xsl') instead of doc('') makes it work with previous
versions but only fail in 10.3



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