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

How to stream-process non-XML text using unparsed-tex

Subject: How to stream-process non-XML text using unparsed-text-lines( ) ?
From: "Costello, Roger L. costello@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 24 Jul 2014 09:16:05 -0000
 How to stream-process non-XML text using  unparsed-tex
Hi Folks,

In Abel Braaksma's XML London paper he writes:

This paper discusses streaming of XML, but XPath 3.0
introduces a new function, fn:unparsed-text-lines,
which takes an external resource as input and parses it
line by line. The original intent of that function was to
allow unparsed data to be streamed; however, the
Working Group at some point decided to not formalize
this requirement. But, the specification leaves
enough room for implementers to allow streamed
processing of data read through this function. When
your intention is to do streaming of unparsed input, you
should check the capabilities of your processor to find
out whether it can do streaming using this function.


So, I have two questions:

1. Do any XSLT processors support streaming of non-XML text using
unparsed-text-lines( )?

2. Suppose the XSLT processor is streaming the strings returned from calling
unparsed-text-lines( ), how would I construct the XSLT program?

Example: Here is a non-XML text file:

Six Great Ideas/Mortimer J. Adler/1981/0-02-072020-3/Macmillan Publishing
Illusions/Richard Bach/1977/0-440-34319-4/Dell Publishing Co.
The First and Last Freedom/J. Krishnamurti/1954/0-06-064831-7/Harper &amp;

I want to stream-process it. I want to count the number of lines. Below is my
attempt at an XSLT program to implement this. I am not sure that the code even
makes sense. Does it? What is the right way to do it?  /Roger

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

    <xsl:output method="xml" />

    <xsl:template match="/">
        <xsl:stream href="unparsed-text-lines('BookCatalogue.txt')">
                <xsl:value-of select="count(tokenize(., '\n'))" />


Current Thread


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.
First Name
Last Name
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.