xsl-list
[Top] [All Lists]

Re: [xsl] How to stream-process non-XML text using unparsed-text-lines( ) ?

2014-07-26 05:05:04
Michael Kay wrote:

        In Saxon, just use 
        xsl:for-each select="unparsed-text-lines(...)".

        IIRC the Saxon 9.5 implementation is streamed, 
        but its definition of "lines" is based on Java 
        readLine() which has some subtle differences 
        from the definition in the XPath spec as to 
        exactly what counts as a line ending.

        xsl:stream is only for use with XML input.

Great! Thank you very much.

Is unparsed-text-lines(...) always streaming, or is it streaming only when the 
XSLT contains:

        <xsl:mode streamable="yes" />

The below XSLT program works great. Would it work differently if I were to 
remove the xsl:mode? How do I know that the input is being streamed?  /Roger

------------------------------------------
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                version="3.0">
    
    <xsl:output method="xml" />
    
    <xsl:mode streamable="yes" />
    
    <xsl:template match="/">
        <Book-Titles>
            <xsl:for-each select="unparsed-text-lines('BookCatalogue.txt')">
                <Title>
                    <xsl:value-of select="substring-before(., '/')" />
                </Title>
            </xsl:for-each>
        </Book-Titles>
    </xsl:template>
    
</xsl:stylesheet>
------------------------------------------
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

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