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

grouping after filtering plus a little more...

Subject: grouping after filtering plus a little more...
From: =?big5?b?qkwgpGyq5A==?= <minikittygo@xxxxxxxxxxx>
Date: Mon, 08 Jul 2002 14:18:29 +0000
names ashu gender
Hi joerg,
thanks for your reply. I have try the solution you've provided however, it seems to give me the same results as before (i.e. some data can not be display)... i had a look at the source file, it did not displays some result because the processor (i am using xalan-c 1.3) already spotted the data beforehand. (actually i had just spotted a mistake in my example ... i was suppose to group the type only, given that author='author2'. So my key should be <xsl:key name="books" match="book" use="type"/>
)


in my example ...
<book>
<author>
<name>author1</name>
<gender>m</gender>
</author>
<name>x box</name>
<type>sc-fi</type>
</book>
<book>
<author>
<name>author2</name>
<gender>f</gender>
</author> <name>elf story</name>
<type>adventure</type>
</book>
<book>
<author>
<name>author1</name>
<gender>m</gender>
</author>
<name>the return of Dr who</name>
<type>sc-fi</type>
</book>
<book>
<author>
<name>author2</name>
<gender>f</gender>
</author>
<name>something2</name>
<type>sc-fi</type>
</book>
...


say i was looking for all the type of books written by aurthor2, using the following call the processor will skip the type which it sees before (e.g. sc-fi will not be shown as it already appears previously for author1)

<xsl:apply-template select="book[author='author2']][generate-id() = generate-id(key('books', type))]"/>

therefore i was wondering is there a way to overcome this? (as you suggested) i though by filtering the data first before using the mucheun method (via multiple predicate) could solve the problem, however, it seems it doesn't like. please could you give me some advise over this?

furthermore, i was wondering it is possible to use preceding-silbing axis whilst it requires to match more than one element? for example using keys you can do this:
<xsl:key name="books" match="book" use="concat(author/name, '::', author/gender)"/>
and grouping via <xsl:apply-template select="book[generate-id() = generate-id(key('books', concat(author/name, '::', author/gender)))]"/>


however using preceding axis algorithum

<xsl:for-each select="/book[not(concat(author/name, '::', author/gender)=preceding-sibling::book/???
i am lost at that point....


please help


Many thanks


Regards Kit



_________________________________________________________________
MSN ¬Ûï´£¨Ñ±z³Ì²³æªº¤è¦¡¤À¨É¨Ã¦C¦L±zªº¬Û¤ù¡A½Ð²¾¦Ü¡G
http://photos.msn.com.hk/support/worldwide.aspx


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.