Quantcast

Question about streamability of pattern *[copy-of()[ends-with(., ':')]]

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Question about streamability of pattern *[copy-of()[ends-with(., ':')]]

Martin Honnen-2

When trying to run Saxon 9.7.0.4 EE with the stylesheet

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        xmlns:math="http://www.w3.org/2005/xpath-functions/math"
exclude-result-prefixes="xs math"
        version="3.0">
       
        <xsl:mode streamable="yes"/>
       
        <xsl:output indent="yes"/>
       
        <xsl:template match="note">
                <xsl:copy>
                        <xsl:for-each-group select="*"
group-starting-with="*[copy-of()[ends-with(., ':')]]">
                                <group>
                                        <xsl:copy-of select="current-group()"/>
                                </group>
                        </xsl:for-each-group>
                </xsl:copy>
        </xsl:template>
       
</xsl:stylesheet>

against the input

<note>
        <para>customer name :</para>
        <para>mr. Joe Someone</para>
        <para>calling from :</para>
        <para>1234567</para>
        <para>device model :</para>
        <para>ABC-123</para>
        <para>issue:</para>
        <para>some info</para>
        <para>some more info</para>
        <para>and even more info</para>
        <para>solution :</para>
        <para>some solutions</para>
        <para>and some more solutions</para>
</note>

Saxon complains "The xsl:for-each-group/@group-starting-with pattern is
not motionless".

I had hoped that the use of "copy-of" in the predicate makes the pattern
streamable. Exselt runs the stylesheet fine.

Is there any way to write a streamable group-starting-with pattern where
the predicate examines the text contents of the matched element?

---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Question about streamability of pattern *[copy-of()[ends-with(., ':')]]

Michael Kay
> Is there any way to write a streamable group-starting-with pattern where
> the predicate examines the text contents of the matched element?

I think the answer is probably no. If you need to consume an element in order to decide whether it forms the start of a new group (or the continuation of the old one) that would represent a look-ahead. Of course a look-ahead is implementable in theory, but with streaming, "theoretically feasible" and "easy to implement" can be a very long way apart from each other.

One way of handling this might be a SAX filter that turns the text nodes into attributes (in effect, your SAX filter would be doing the look-ahead). The pattern would then be examining attributes, which would make it motionless. In principle the SAX filter could instead be a streaming transformation, but pipelines of streamed transformations are not something we've experimented with much - I'm sure it can be done, but it's unexplored territory.

Michael Kay
Saxonica


> On 15 Apr 2016, at 19:04, Martin Honnen <[hidden email]> wrote:
>
>
> When trying to run Saxon 9.7.0.4 EE with the stylesheet
>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:math="http://www.w3.org/2005/xpath-functions/math"
> exclude-result-prefixes="xs math"
> version="3.0">
>
> <xsl:mode streamable="yes"/>
>
> <xsl:output indent="yes"/>
>
> <xsl:template match="note">
> <xsl:copy>
> <xsl:for-each-group select="*"
> group-starting-with="*[copy-of()[ends-with(., ':')]]">
> <group>
> <xsl:copy-of select="current-group()"/>
> </group>
> </xsl:for-each-group>
> </xsl:copy>
> </xsl:template>
>
> </xsl:stylesheet>
>
> against the input
>
> <note>
> <para>customer name :</para>
> <para>mr. Joe Someone</para>
> <para>calling from :</para>
> <para>1234567</para>
> <para>device model :</para>
> <para>ABC-123</para>
> <para>issue:</para>
> <para>some info</para>
> <para>some more info</para>
> <para>and even more info</para>
> <para>solution :</para>
> <para>some solutions</para>
> <para>and some more solutions</para>
> </note>
>
> Saxon complains "The xsl:for-each-group/@group-starting-with pattern is
> not motionless".
>
> I had hoped that the use of "copy-of" in the predicate makes the pattern
> streamable. Exselt runs the stylesheet fine.
>
> Is there any way to write a streamable group-starting-with pattern where
> the predicate examines the text contents of the matched element?
>
> ---
> Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
> https://www.avast.com/antivirus
>
>
> ------------------------------------------------------------------------------
> Find and fix application performance issues faster with Applications Manager
> Applications Manager provides deep performance insights into multiple tiers of
> your business applications. It resolves application problems quickly and
> reduces your MTTR. Get your free trial!
> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
> _______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/saxon-help



------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Loading...