xsl-list
[Top] [All Lists]

[xsl] I beseech thee, please give me intuition on XSLT Streaming

2013-09-06 11:43:40
Hi Folks,

... motionless ... sweep ... free-ranging ... group-consuming ...

Those are some of the terms used in the XSLT specification for describing 
streaming.

Ouch!

I am having a hard time slogging through the explanation of XSLT streaming. 

Surely there are some simple intuitions regarding the kind of XSLT/XPath code 
that is (isn't) valid when doing streaming? 

I seek simple rules-of-thumb that will guide me in writing XSLT/XPath code for 
streaming. 

Can you provide such intuitions? Can you provide simple rules-of-thumb?

For example, I have found that it is valid to iterate over each Book and output 
its Title:

<xsl:mode streamable="yes" />
    
<xsl:template match="BookCatalogue">
        <Books>
            <xsl:iterate select="Book">
                <Title><xsl:value-of select="Title" /></Title>
            </xsl:iterate>
        </Books>
</xsl:template>

But it's not valid to output both Title and Author:

<xsl:mode streamable="yes" />
    
<xsl:template match="BookCatalogue">
        <Books>
            <xsl:iterate select="Book">
                <Title><xsl:value-of select="Title" /></Title>
                <Author><xsl:value-of select="Author" /></Author>
            </xsl:iterate>
        </Books>
</xsl:template>

Why?

I have no intuition on why the first is valid and the second is invalid.

No doubt somewhere in the XSLT specification there is some precise rule which 
explains why.

I'll never remember all the rules. 

But if I have some intuition to guide me ... ah, that will last a lifetime.

So what is the intuition behind allowing access to one child element but not 
two?

However, I am seeking more than just intuition about that specific example. I 
am seeking intuition about writing XSLT/XPath code in general for streaming. 
Can you provide an intuition so that as I write code I can think: 

        Well, I don't know the specific rule in the XSLT 
        specification, but from my general intuition 
        about streaming I know that this code is (isn't) 
        valid for streaming.

/Roger



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


<Prev in Thread] Current Thread [Next in Thread>