Subject: Re: [xsl] Calculating groups of repeating elements From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Thu, 11 Dec 2008 15:18:30 -0500 |
It seems to me that if you are wanting to collect groups of 2+ words that appear in 2+ places, a useful first step would be to collect the set of intersections of words occuring in every pairing of places. This would be a large number, n(n-1)/2 for n places, but not the huge exponent of 2 cited by Michael, and hence possibly a more direct route to your goal.
Great! This looks like a much more useful approach to the problem!
<xsl:template match="atlas"> <collection> <xsl:for-each select="place"> <xsl:variable name="first" select="."/> <xsl:for-each select="key('place-by-word',.//word)[. << $first]"> <xsl:variable name="second" select="."/> <common_words> <xsl:copy-of select="$first/place_number, $second/place_number"/> <words> <xsl:copy-of select="$first/words/word[.=$second/words/word]"/> </words> </common_words> </xsl:for-each> </xsl:for-each> </collection> </xsl:template>
While this isn't quite what you want, the results you want could be derived by grouping these lists further, skipping pairings that contain less than two 'word' elements, and collecting together those have have the same sets (and thus represent sets of words that occur in more than two places).
Yes. But I think you must still generate the subsets, because if you have, say, three occurrences of (a,b,c) and two of (a,b,d), you have five occurrences of (a,b), which is interesting, if my understanding of the requirement is correct.
This continues to be interesting.
Cheers, Wendell
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Calculating groups of rep, Michael Ludwig | Thread | Re: [xsl] Calculating groups of rep, Quinn Dombrowski |
RE: [xsl] Calculating groups of rep, Michael Kay | Date | [xsl] XSL and UML, Philip Vallone |
Month |