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

text() word lists

Subject: text() word lists
From: James Cummings <James.Cummings@xxxxxxxxxxxxxx>
Date: Fri, 6 Feb 2004 15:35:26 +0000 (GMT)
text word list
Hi there,

I'm sure this is a faq, and I've checked the faq and archive.
I swear I remember someone asking about it, but I couldn't
find it, so here goes.

I want to take an XML file of unknown elements and create
a word frequency list / word list.  Now, an entry on sorting
in the xslt faq says this is just what xslt is bad at.  (And
I'm sure there are some that would say 'just go use perl',
but let's say I want to do it in xslt(1 or 2).

XSLT2 makes the tokenization of strings much easier, so
assuming I'm using that, if I have:

<foo>
<blort> This is a <wibble>Test</wibble>, only a test!</blort>
<blort> This really is a <wibble>great big test</wibble>, only a test!</blort>
</foo>

I don't know that foo|wibble|blort  will be the element names.

But I want to produce both:

a  -- 4
test  -- 4
only -- 2
is  -- 2
this  -- 2
big -- 1
great -- 1
really -- 1

Which (unless I've missed something) should be
a case-insensitive list grouped by frequency
sorted alphabetically within this, and ignoring
punctuation.

But also:

a  -- 4
big -- 1
great -- 1
is  -- 2
only -- 2
test  -- 4
this  -- 2
really -- 1

Which is the same list by not grouped
by frequency.

Suggestions? Solutions?

Many thanks for any help,
-James
---
Dr James Cummings, Oxford Text Archive, University of Oxford
James.Cummings at ota.ahds.ac.uk http://users.ox.ac.uk/~jamesc/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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