xsl-list
[Top] [All Lists]

Re: [xsl] Calculating groups of repeating elements

2008-12-11 09:56:49
Thanks for the warning, Ken. I'll scratch that approach off my list.

This is great, Michael! If I can sort the <word-group>s in some standard way (alphabetically?) across all the places, I should be able then to group the data processed from your xsl based on how many places have a given <word-group>.



G. Ken Holman wrote:
At 2008-12-10 18:42 -0600, Quinn Dombrowski wrote:
Thanks for looking at this! Sorry for not being as clear as I could've been with what I'm looking for. For the example data set, I'm trying to automatically generate an output something like this:

Aa + C + Qqq: 2 places (1, 3)
Aa + C: 3 places (1, 2, 3)
Aa + Zz: 2 places (2, 3)
C + Qqq: 2 places (1, 3)

So it lists all the groups of 2+ words that appear together in 2+ places. This list is sorted by length of the group (3 words is the maximum number of words that occurs in 2+ places in the sample data), but it'd be nice to also be able to sort by number of places:

Aa + C: 3 places (1, 2, 3)
Aa + Zz: 2 places (2, 3)
etc.

Sorry, that would be beyond my volunteer allocation for this morning ... too much going on right now.

I was using intersects to get places with Aa AND C AND Qqq (<xsl:value-of select="count(atlas/place/place_number[../words/word='Aa'] intersect atlas/place/place_number[../words/word='C'])"/>), but got overwhelmed by the number of ways I'd have to plug in all the different words to go through the data exhaustively-- the real data has 250+ places and 75+ words.

But for you and the archive, be aware that your concept of intersect above wouldn't help in the case of XSLT 2.0:

   $a intersect $b

   returns those tree nodes in node set $a that are the same tree nodes
   found in node set $b ... not by value, but the nodes themselves.

For this reason an "Aa" node in place 1 would not be recognized as being the same as the "Aa" node in place 2 and would not be returned in an intersection.

I hope this steers you away from an unsuccessful approach.

. . . . . . . . . Ken

--
Upcoming XSLT/XSL-FO, UBL and code list hands-on training classes:
:  Sydney, AU 2009-01/02; Brussels, BE 2009-03; Prague, CZ 2009-03
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video sample lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg
Video course overview:  http://www.youtube.com/watch?v=VTiodiij6gE
G. Ken Holman                 mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--