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

RE: grouping question

Subject: RE: grouping question
From: Patrick Moore <patrickm@xxxxxxxxxxx>
Date: Thu, 12 Apr 2001 18:33:36 -0700
xmlns jdate
Hi All --

Addendum to my earlier question. This xsl seems to be a good start but I am
having problems with use of "following-sibling". I am operating under the
assumption that I can get the database to tell me how many tracks are in
each product. I am hoping that this will help me.

-Pat Moore-

<?xml version="1.0"?>

<xsl:stylesheet
        version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:sql="org.apache.xalan.lib.sql.XConnection"
        xmlns:rioport="com.rioport.util.xsl.XSLUtil"
        xmlns:jDate="java.util.Date"
        extension-element-prefixes="sql rioport jDate" >

    <xsl:output method="xml" indent="yes" />

    <xsl:template match="/" >
        <results>
            <xsl:apply-templates
select="document/row[not(preceding-sibling::row[1]/album = album)]" />
        </results>
    </xsl:template>
    <xsl:template match="row">
        <product>
            <xsl:for-each select="current() | following-sibling::row[1]" >
            <track>
                <xsl:copy-of select="."/>
            </track>
            </xsl:for-each>
        </product>
    </xsl:template>
</xsl:stylesheet>
~
~
~

> -----Original Message-----
> From: Patrick Moore [mailto:patrickm@xxxxxxxxxxx]
> Sent: Thursday, April 12, 2001 5:45 PM
> To: Xsl List (E-mail)
> Subject:  grouping question
> 
> 
> Hi there --
> 
> I have looked through the email about grouping withput 
> finding this question
> being answered.
> 
> I am using Xalan sql extension to generate the data that will 
> be processed
> by the xsl stylesheet. Because it is a database query I have 
> constructed the
> query so the results are sorted based on the element that I 
> wish to group
> by. Because this extension lets me look at only one row at a 
> time, and I
> cannot go back, the Mueschean method is not possible. (Or at least not
> prefered).
> 
> I was wondering if anyone had some thoughts on a way I can 
> take advantage of
> the ordering that SQL can do to come up with a simpler 
> method. Some sample
> data:
> 
> <rowset>
> 	
> <row><album>1</album><track_id>1</track_id><artist>Rush</artist></row>
> 	
> <row><album>1</album><track_id>2</track_id><artist>Rush</artist></row>
> 	
> <row><album>2</album><track_id>1</track_id><artist>Rush</artist></row>
> 	
> <row><album>2</album><track_id>2</track_id><artist>Rush</artist></row>
> </rowset>
> 
> As soon as I see the "Album 2" I know that there are no more
> <album>1</album>'s Can I take advantage of this in any manner?
> 
> My preliminary conclusion is no... but I am new enough to xsl 
> to wonder if
> this is indeed the case.
> 
> -Patrick Moore
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 

 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.