|
Subject: Re: [xsl] shuffling words in text content From: "Chris Papademetrious christopher.papademetrious@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Tue, 7 Sep 2021 21:31:30 -0000 |
Hi everyone,
I replaced the reordering variable definition with the following:
<!-- perturb the word order -->
<xsl:variable name="shuffled-words" as="xs:string*">
<xsl:sequence select="random-number-generator()?permute($words)"/>
</xsl:variable>
and ran the transformation in Oxygen, and it works great!
I think the current implementation is good, but not great. There are two
limitations to my approach.
Limitation 1: Words are shuffled within each text() element, but not across
them. This doesn't scramble at all:
<p>Use <code>true</code> and <code>false</code> carefully.</p>
I think this would be a really, really hard problem to solve, especially for
arbitrarily nested element content like multi-level lists or CALS tables.
Limitation 2: random-number-generator() is deterministic within a given run
(and is documented as such). Within a run, each of these lines is scrambled in
the same order:
<p>a b c</p>
<p>A B C</p>
<p>x y z</p>
<p>X Y Z</p>
I think I could solve this by somehow setting the seed value to the result of
generate-id() each time, but I haven't figured out the mechanics of that yet.
- Chris
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] shuffling words in text c, Chris Papademetrious | Thread | Re: [xsl] shuffling words in text c, Michael Kay mike@xxx |
| Re: [xsl] shuffling words in text c, Chris Papademetrious | Date | [xsl] [ANN] XSLT 3 training - Septe, Liam R. E. Quin liam |
| Month |