[xsl] Streamability of rounding effects

Subject: [xsl] Streamability of rounding effects
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 11 Jun 2017 21:40:49 -0000
Idle relaxation after XML London. Here is some random text generated using the
vocabulary of the XSLT 3.0 spec:

This  means cases where a parameter to match certain function are copied node
matches replace all the pattern is no such a valid relative to declarations in
which is used to the expression. That the right lies the instruction may also
be. If the same. If no schema for extract the way in the function. The
functions and result tree. A and others are considered as the context of the p
element is changed to variables in an adverse effect because both operands as
a dynamic. Static. Type. Annotation the component of where the functions
references that a stylesheet then and elements and. CIT is no and then and
fails to then is any even though this is an output definitions and stylesheets
that is not a using its sweep of the types defined in an. EQName that has a as
the and if there are given knowledge of the. An optional as a. In this
specification defines the rules require implementations are described in
static error using see. The usage is. Where the node in memory can however
share the applicable to handle but which the required type is not necessarily.
Rule. Suppose that facilities also. Streamability of rounding effects.

Probably makes about as much sense to the average reader as the original...

Here's the code (try it on a document of your choice...). It builds a data
structure holding all pairs of adjacent words and then selects the successor
of each word from these pairs at random.

<xsl:template match="/">
        <xsl:variable name="words"
                      select="//text()!tokenize(., '\s+')[matches(.,
        <xsl:variable name="histogram" as="map(*)">
            <xsl:iterate select="tail($words)">
                <xsl:param name="previous" select="head($words)"/>
                <xsl:param name="histogram" select="map{}"/>
                <xsl:on-completion select="$histogram"/>
                <xsl:variable name="new-entry" select="if
(map:contains($histogram, $previous)) then (map:get($histogram, $previous), .)
else (.)"/>
                    <xsl:with-param name="previous" select="."/>
                    <xsl:with-param name="histogram"
select="map:put($histogram, $previous, $new-entry)"/>
            <xsl:text>This </xsl:text>
            <xsl:iterate select="1 to 200">
                <xsl:param name="word" select="'This'"/>
                <xsl:variable name="options" select="map:get($histogram,
$word), 'the'"/>
                <xsl:variable name="next"
                <xsl:value-of select="(if (matches($next, '^[A-Z]')) then '. '
else ' ') || $next"/>
                    <xsl:with-param name="word" select="$next"/>

Current Thread