[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: shuffling words in text content
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|