[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] group-by sorting and paging problem...
I've been struggling with this for days. The problem seems simple, but I've had no luck...Here's what I'm trying to do: - Group the <msgblocks> by attribute 'id' - Use the current grouping id (@id) to sort the data - Arrange the data I want to extract from each sorted <msgblock> (errnum and message) into a series of balanced 4 column tables limited to a maximum of x number of rows, based on the value of the global param $cols - Write (or page) each table to a result-document A subset of the xml looks like this: <messages> <msgblock id="2000"> <msg-num>0</msg-num> <errnum>2000</errnum> <message> No message</message> </msgblock> <msgblock id="2001"> <msg-num>100</msg-num> <errnum>2001</errnum> <message> "Row not found"</message> </msgblock> <msgblock id="2002"> <msg-num>101</msg-num> <errnum>2002</errnum> <message> "Value truncated"</message> </msgblock> <msgblock id="2003"> <msg-num>102</msg-num> <errnum>2003</errnum> <message> "Using temporary table"</message> </msgblock> <msgblock id="2004"> <msg-num>103</msg-num> <errnum>2004</errnum> <message> "Invalid data conversion"</message> </msgblock> <msgblock id="2559"> <msg-num>130</msg-num> <errnum>2559</errnum> <message> "A row could not be converted to the new schema format"</message> </msgblock> <msgblock id="2532"> <msg-num>124</msg-num> <errnum>2532</errnum> <message> "Invalid data conversion: NULL was inserted for column '%1' on line %2."</message> </msgblock> <msgblock id="2005"> <msg-num>104</msg-num> <errnum>2005</errnum> <message> "Row has been updated since last time read"</message> </msgblock> <msgblock id="2006"> <msg-num>105</msg-num> <errnum>2006</errnum> <message> "Procedure has completed"</message> </msgblock> <msgblock id="2007"> <msg-num>106</msg-num> <errnum>2007</errnum> <message> "Value for column '%1' in table '%2' has changed"</ message> </msgblock> <msgblock id="2008"> <msg-num>111</msg-num> <errnum>2008</errnum> <message> "Statement cannot be executed"</message> </msgblock> <msgblock id="2530"> <msg-num>123</msg-num> <errnum>2530</errnum> <message> "Database created without any schema"</message> </msgblock> <msgblock id="2009"> <msg-num>200</msg-num> <errnum>2009</errnum> <message> "Warning"</message> </msgblock> <msgblock id="2011"> <msg-num>80</msg-num> <errnum>2011</errnum> <message> "Unable to start database server"</message> </msgblock> <msgblock id="2702"> <msg-num>1033</msg-num> <errnum>2702</errnum> <message> "Unable to start database server: Server fatal error"</ message> </msgblock> <msgblock id="2012"> <msg-num>81</msg-num> <errnum>2012</errnum> <message> "Invalid database server command line"</message> </msgblock> </messages>
<xsl:for-each-group select="msgblock" group-by="@id"> <xsl:sort select="current-grouping-key()"/> <for-each select=current-group()/> <xsl:value-of select =errnum/> <xsl:vale-of select=message/> </for each> <for-each-group> I can limit the number of table items by testing the global parameters $start-index (1) and $group-size (40) with something like this: <xsl:if test="position() >= $start-index and position() <= $group-size"> . . . </xsl:if> (Thank you, Ms. Tennison) I can see the logic in Micheal Kay's examples (town-by-columns, town- by-rows, towns-sorted-by-rows) in the XSLT 2.0 Programmer's Reference. But I can't seem to put them all together. (I always seem to end up dividing by zero). I seemed close a couple of times, but I've had no luck. In fact, I seem to be going backwards. Does anyone know how to do this? Thanks in advance.... ------- bob wilkins ------
|
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
|