[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XSLT Streaming: circumvent the one downward select

Subject: Re: XSLT Streaming: circumvent the one downward selection rule using xsl:fork
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Sat, 7 Dec 2013 17:30:45 +0000
Re:  XSLT Streaming: circumvent the one downward select
It's a design that attempts to find a compromise between conflicting goals.

Consider

<xsl:template match="doc">
  <xsl:apply-templates mode="toc"/>
  <xsl:apply-templates mode="body"/>
</xsl:template>

This makes two downward selections: it processes the entire document twice,
once to create the table of contents, once to create the body. The spec deems
this not streamable, because the output order isn't the same as the input
order.

But that's inconvenient for people who want to do this kind of transformation,
so we allow you to do

<xsl:template match="doc">
  <xsl:fork>
    <xsl:sequence>
      <xsl:apply-templates mode="toc"/>
    </xsl:sequence>
    <xsl:sequence>
      <xsl:apply-templates mode="body"/>
    </xsl:sequence>
  </xsl:fork>
</xsl:template>

The expected processing model for this is that the input is processed in such
a way that both prongs of the fork are executed during the same pass over the
input document. This means that to assemble the result tree, the *output* of
these two prongs (or at any rate, the output of all but the first) must be
buffered in memory. So the amount of memory needed is not independent of
document size; it's not a pure streaming approach. We wanted to make it
possible to do this kind of processing, but we also wanted "pure streaming" to
be the norm; we didn't want processors to do this kind of buffering
automatically without the user explicitly requesting it.

Michael Kay
Saxonica




On 7 Dec 2013, at 10:33, Costello, Roger L. <costello@xxxxxxxxx> wrote:

> Hi Folks,
>
> I am learning about the new xsl:fork element.
>
> It allows you to simultaneously perform multiple instructions on the input
as it is being streamed.
>
> Hmm ...
>
> So the one downward selection rule *prohibits* accessing more than one child
or descendent node from the context node. The xsl:fork element *enables*
accessing more than one child or descendent node from the context node.
>
> That's weird.
>
> It seems conflicting/contradicting. Yes?
>
> Please help me to understand.
>
> /Roger

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.