XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
RE: [xml-dev] I processed a 3GB XML file ... using XSLT streaming

Martin Honnen wrote:

> Where do you generate that list? The streaming version of 
> your program seems to just output a 'count' element but 
> not 'Schools' nor 'school' elements.

Oops! I guess that I sent an old version of my program. Sorry about that. Thanks for catching this Martin!

Here is the correct version:

<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="../huge-file/massachusetts.xml">
            <Schools>
                <xsl:for-each select="osm">
                    <xsl:iterate select="node">
                        <xsl:param name="count" select="1" as="xs:decimal"/>
                        <xsl:variable name="thisNode" select="copy-of(.)"/>
                        <xsl:choose>
                            <xsl:when test="$thisNode/tag[(@k eq 'amenity') and (@v eq 'school')]">
                                <school>
                                    <xsl:value-of select="$count" />
                                    <xsl:text>. </xsl:text>
                                    <xsl:value-of select="$thisNode/tag[@k eq 'name']/@v" />
                                </school>
                                <xsl:next-iteration>
                                    <xsl:with-param name="count" select="$count+1"/>
                                </xsl:next-iteration>
                            </xsl:when>
                            <xsl:otherwise>
                                <xsl:next-iteration>
                                    <xsl:with-param name="count" select="$count"/>
                                </xsl:next-iteration>
                            </xsl:otherwise>
                        </xsl:choose>
                    </xsl:iterate>
                </xsl:for-each>
            </Schools>
        </xsl:stream>
    </xsl:template>
    
</xsl:stylesheet>


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS