|
[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
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>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart


![[XSLT Streaming] How do I know that my input document](/images/get_stylus.gif)





