Re: XSLT 3.0 saxon9.9 assertion error on function parameter
Michael Kay <mike-JkSD5nQpfvpWk0Htik3J/[email protected]>
| Newsgroups | gmane.text.xml.saxon.help |
|---|---|
| Message-ID | <[email protected]> |
This has been raised as issue 4636, and fixed:
https://saxonica.plan.io/issues/4636
(I don't know why it took 5 hours for the email to be sent out: blame SourceForge)
Michael Kay
Saxonica
> On 8 Jul 2020, at 09:06, Matthieu RICAUD-DUSSARGET <m.ricaud-dussarget-y4x8KMh3xbas7OF8YUzxC26XGmf1S8Or@public.gmane.org> wrote:
>
> Hi all,
>
> When updating my Oxygen IDE from version 20.1 (using Saxon EE 9.8.0.12) to version 22.1 (using Saxon EE 9.9.1.7) I get an new “java.lang.AssertionError” on one of ma XSL library.
> It use to work find with Saxon 9.8, but I get this compilation error with Saxon 9.9.
> It was not easy to isolate this error within the whole bunch of imported xsl libraries we are using.
> But I finally find the line that causes this error :
> <xsl:sequence select="els:wrap-elements-starting-with(
> $context,
> function($e as element()) as xs:boolean {name($e) = $starts.names},
> $wrapper,
> $keep-context)"/>
>
> See below an XSLT to repro this compilation error.
> Is it a Saxon9.9 bug or something wrong in the XSLT (that was not identified by Saxon 9.8)?
>
> Thanks in advance
> Matthieu Ricaud-Dussarget
>
> -----------------------------------------
> XSLT to reproduce the error :
> -----------------------------------------
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform <http://www.w3.org/1999/XSL/Transform>"
> xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl <http://www.oxygenxml.com/ns/doc/xsl>"
> xmlns:xs="http://www.w3.org/2001/XMLSchema <http://www.w3.org/2001/XMLSchema>"
> xmlns:els="http://www.lefebvre-sarrut.eu/ns/els <http://www.lefebvre-sarrut.eu/ns/els>"
> exclude-result-prefixes="#all"
> version="3.0"
> >
>
> <xd:doc>
> <xd:desc>
> <xd:p>Wrap elements starting with specific names into a new element "wrapper" </xd:p>
> </xd:desc>
> <xd:param name="context">Parent of the elements to wrap</xd:param>
> <xd:param name="starts.names">sequence of names to set starting elements</xd:param>
> <xd:param name="wrapper">element wrapper</xd:param>
> <xd:param name="keep-context">Say if the context should be kept or not in the result</xd:param>
> <xd:return>context (or its content) with wrapped element</xd:return>
> </xd:doc>
> <xsl:function name="els:wrap-elements-starting-with-names" as="node()*">
> <xsl:param name="context" as="element()"/>
> <xsl:param name="starts.names" as="xs:string+"/>
> <xsl:param name="wrapper" as="element()"/>
> <xsl:param name="keep-context" as="xs:boolean"/>
> <xsl:sequence select="els:wrap-elements-starting-with(
> $context,
> function($e as element()) as xs:boolean {name($e) = $starts.names},
> $wrapper,
> $keep-context)"/>
> </xsl:function>
>
> <xd:doc>
> <xd:desc>
> <xd:p>Wrap elements starting with specific names into a new element "wrapper" </xd:p>
> </xd:desc>
> <xd:param name="context">Parent of the elements to wrap</xd:param>
> <xd:param name="starts.function">xpath function to set the starting group condition</xd:param>
> <xd:param name="wrapper">element wrapper</xd:param>
> <xd:param name="keep-context">Say if the context should be kept or not in the result</xd:param>
> <xd:return>context (or its content) with wrapped element</xd:return>
> </xd:doc>
> <xsl:function name="els:wrap-elements-starting-with" as="element()*">
> <xsl:param name="context" as="element()"/>
> <xsl:param name="starts.function"/> <!--as="xs:string"-->
> <xsl:param name="wrapper" as="element()"/>
> <xsl:param name="keep-context" as="xs:boolean"/>
> <xsl:variable name="content" as="item()*">
> <xsl:for-each-group select="$context/node()" group-starting-with="*[$starts.function(.)]">
> <xsl:variable name="cg" select="current-group()" as="node()*"/>
> <xsl:for-each select="$wrapper">
> <xsl:copy>
> <xsl:copy-of select="@*"/>
> <xsl:copy-of select="$cg"/>
> </xsl:copy>
> </xsl:for-each>
> </xsl:for-each-group>
> </xsl:variable>
> <xsl:choose>
> <xsl:when test="$keep-context">
> <xsl:for-each select="$context">
> <xsl:copy>
> <xsl:copy-of select="@*"/>
> <xsl:sequence select="$content"/>
> </xsl:copy>
> </xsl:for-each>
> </xsl:when>
> <xsl:otherwise>
> <xsl:sequence select="$content"/>
> </xsl:otherwise>
> </xsl:choose>
> </xsl:function>
>
> </xsl:stylesheet>
> _______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/ <http://saxon.markmail.org/>
> [email protected] <mailto:[email protected]>
> https://lists.sourceforge.net/lists/listinfo/saxon-help <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