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

RE: retrieve elements with same attribute values

Subject: RE: retrieve elements with same attribute values
From: "Joe Fawcett" <joefawcett@xxxxxxxxxxx>
Date: Tue, 08 May 2007 07:55:14 +0100
RE:  retrieve elements with same attribute values
Charles

That seems like a standard grouping problem with the added proviso that you only display groups that have at least three members. If that's correct and you are using XSLT version 1.0 then this link shows how to group: http://www.jenitennison.com/xslt/grouping/muenchian.html

You then need to add a test, count(<group in question>) > 2 before outputting the results in the inner xsl:for-each.

If you are lucky enough to be using version 2.0 then it's easier, use xsl:for-each-group to start with and then count(current-group() > 2) before outputting.

Regards

Joe

http://joe.fawcett.name


From: "Charles Ohana" <charles.ohana@xxxxxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject:  retrieve elements with same attribute values
Date: Mon, 7 May 2007 22:26:32 -0400

Hello friends,
I'm trying to retrieve all element that have the same values for specific attributes more (or equal) than 3 times (for example).
See example below that explains what I'm trying to achieve.
Any help would be appreciated.
Thanx


I trying to get the output like

70 : Queen : we are the champions
70 : Queen : Bohemian Rhapsody
70 : Queen : radio gaga
reggae : Bob Marley : No woman no cry
reggae : Bob Marley : one love
reggae : Bob Marley : Jammin

From this xml

<catalogue>
  <category name="70's">
     <item name="we are the champions">
        <author>Queen</author>
     </item>
     <item name="Roxane">
        <author>Police</author>
     </item>
     <item name="Bohemian Rhapsody">
        <author>Queen</author>
     </item>
     <item name="radio gaga">
        <author>Queen</author>
     </item>
  </category>

  <category name="reggae">
     <item name="red red wine">
        <author>UB40</author>
     </item>
     <item name="kingston town">
        <author>UB40</author>
     </item>
     <item name="No woman no cry">
        <author>Bob Marley</author>
     </item>
     <item name="one love">
        <author>Bob Marley</author>
     </item>
     <item name="Jammin">
        <author>Bob Marley</author>
     </item>
  </category>
</catalogue>

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-2007 All Rights Reserved.