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

[XSLT Streaming] How do I know that my input document

Subject: [XSLT Streaming] How do I know that my input document was processed in a streaming fashion?
From: "Costello, Roger L." <costello@xxxxxxxxx>
Date: Tue, 27 Aug 2013 19:02:57 +0000
 [XSLT Streaming] How do I know that my input document
Hi Folks,

I want to count the number of Book elements in BookCatalogue.

I want to do it using XSLT Streaming.

Below are two solutions. One uses <xsl:stream>, the other uses <xsl:mode>.

Two Questions Please:

1. Are my two solutions equivalent?

2. I ran my solutions and they produced the correct result. They ran fast, but
the input document is small (only 3 Books). How do I know that the input
document was actually processed in a streaming fashion?

I am running the transformations using the latest version of oXygen XML.

/Roger

-----------------------------------------------------------------------------
-----------------
Specify that stream processing is desired by embedding the
instructions within a <xsl:stream> element:
-----------------------------------------------------------------------------
-----------------
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                         xmlns:xs="http://www.w3.org/2001/XMLSchema"
                         exclude-result-prefixes="#all"
                         version="3.0">

    <xsl:output method="xml" />

    <xsl:template match="/">
        <xsl:stream href="BookCatalogue.xml">
            <count>
                <xsl:for-each select="BookCatalogue">
                    <xsl:iterate select="Book">
                        <xsl:param name="count" select="0" as="xs:decimal"/>
                        <xsl:next-iteration>
                            <xsl:with-param name="count" select="$count+1"/>
                        </xsl:next-iteration>
                        <xsl:on-completion>
                            <xsl:value-of select="$count"/>
                        </xsl:on-completion>
                    </xsl:iterate>
                </xsl:for-each>
            </count>
        </xsl:stream>
    </xsl:template>

</xsl:stylesheet>

-----------------------------------------------------------------------------
-----------------
Specify that stream processing is desired by specifying streaming
in the initial mode:
-----------------------------------------------------------------------------
-----------------
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                         xmlns:xs="http://www.w3.org/2001/XMLSchema"
                         exclude-result-prefixes="#all"
                         version="3.0">

    <xsl:output method="xml" />

    <xsl:mode streamable="yes" />

    <xsl:template match="BookCatalogue">
        <count>
            <xsl:iterate select="Book">
                <xsl:param name="count" select="0" as="xs:decimal"/>
                <xsl:next-iteration>
                    <xsl:with-param name="count" select="$count+1"/>
                </xsl:next-iteration>
                <xsl:on-completion>
                    <xsl:value-of select="$count"/>
                </xsl:on-completion>
            </xsl:iterate>
        </count>
    </xsl:template>

</xsl:stylesheet>

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.