|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Splitting already-grouped output into two parts
Hi. I'm having problems with XSLT and was hoping someone here could help me troubleshoot or offer advice. Here's a sample of my XML (edited to remove superfluous stuff): ============================================ <RECORDS> <RECORD> <name>Anderson, Bob</name> <AssetID>1426419</AssetID> </RECORD> <RECORD> <name>Anderson, Bob</name> <AssetID>1440105</AssetID> </RECORD> <RECORD> <name>Brock, Jessica</name> <AssetID>1429062</AssetID> </RECORD> <RECORD> <name>Carlisle, Jen</name> <AssetID>1426278</AssetID> </RECORD> <RECORD> <name>Carlisle, Jen</name> <AssetID>1436229</AssetID> </RECORD> <RECORDS> ============================================ I'm using the Muenchian Method to group my results by surname. Here's my stylesheet (again, edited to remove lots of superfluous stuff): ============================================ <xsl:key name="videos-by-surname" match="RECORD" use="name" /> <xsl:template match="RECORDS"> <xsl:for-each select="RECORD[count(. | key('videos-by-surname', name)[1]) = 1]"> <xsl:sort select="name" /> <xsl:element name="h3"><xsl:value-of select="name" />:</xsl:element> <xsl:element name="ul"> <xsl:for-each select="key('videos-by-surname', name)"> <xsl:sort select="AssetID" /> <xsl:element name="li"><xsl:value-of select="AssetID" /></xsl:element> </xsl:for-each> </xsl:element> </xsl:for-each> </xsl:template> ============================================ So far, it all works fine; the output looks sort of like this: ============================================ <h3>Anderson, Bob:</h3> <ul> <li>1426419</li> <li>1440105</li> </ul> <h3>Brock, Jessica:</h3> <ul> <li>1429062</li> </ul> <h3>Carlisle, Jen:</h3> <ul> <li>1426278</li> <li>1436229</li> </ul> ============================================ But what I'd like to do is take this grouped output and divide it into two roughly-equally sized groups. That is, I'd like to create two DIV's, each with about half the data in them. I do not want to use tables. And I don't want to break up the UL's/LI's across the columns; each of the tops of the columns need to start with a new H3 name and its associated grouping, not be continued from the previous column. So, how can I count up all the resulting H3's/names from my Muenchian grouping, divide it by two, and then wrap each of the two new groups in DIV's? It's likely something simple, but I'm flummoxed. Please help a fuzzy newbie! (Explanations using small words would be much appreciated.) Thanks! - Brooke Schreier Ganz
|
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
|






