[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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


Subject: Re: [xsl] How to stream-process non-XML text using unparsed-text-lines( ) ?
From: "Costello, Roger L. costello@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 26 Jul 2014 10:04:53 -0000

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>
------------------------------------------


Current Thread
Keywords