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

Re: Grouping ?

Subject: Re: Grouping ?
From: "Kanthi Damodaran" <kanthi_damodaran@xxxxxxxxxxx>
Date: Fri, 08 Jun 2001 14:15:32
kanthi damodaran
Hi Xiaocun

Thanks for the insight, it worked!

Kanthi
From: Xiaocun Xu <xiaocunxu@xxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
CC: kanthi_damodaran@xxxxxxxxxxx
Subject: Re:  Grouping ?
Date: Fri, 8 Jun 2001 06:54:10 -0700 (PDT)

Hi, Kanthi:

  This is much simpler than the grouping problems we
usually see.  All you need is matching up @id, the
following template should do the trick:
<xsl:template match="OuterTag">
  <xsl:for-each select="Books/Book">
    <xsl:variable name="bookid" select="@id"/>
    <xsl:text>Title: </xsl:text>
    <xsl:value-of select="Title"/>
    <xsl:text>
</xsl:text>
    <xsl:text>Author: </xsl:text>
    <xsl:value-of select="Author"/>
    <xsl:text>
</xsl:text>
    <xsl:text>Address: </xsl:text>
    <xsl:value-of select="../../Addresses/Address[@id
= $bookid]/Street"/>
    <xsl:text>, </xsl:text>
    <xsl:value-of select="../../Addresses/Address[@id
= $bookid]/Country"/>
    <xsl:text>
</xsl:text>
    <xsl:value-of
select="../../Publishers/Publisher[@id =
$bookid]/Name"/>
    <xsl:text>

</xsl:text>
  </xsl:for-each>
</xsl:template>

Hope this helps,
Xiaocun

--- Kanthi Damodaran <kanthi_damodaran@xxxxxxxxxxx>
wrote:
> Hello everyone -
>
> I am having a problem with what I believe is a
> grouping issue. My XML looks
> something like this
>
> <OuterTag>
> <Books>
> 	<Book id = "1">
> 		<Title>XML</Title>
> 		<Author>ABC</Author>
> 	</Book>
> 	<Book id ="2">
> 		<Title>XSL</Title>
> 		<Author>DEF</Author>
> 	</Book>
> :
> :
> </Books>
> <Addresses>
> 	<Address id = "1">
> 		<Street>Washington Street</Street>
> 		<Country>USA</Country>
> 	</Address>
> 	<Address id = "2">
> 		<Street>Oxford Street</Street>
> 		<Country>United Kingdom</Country>
> 	</Address>
> :
> :
> </Addresses>
> <Publishers>
> 	<Publisher id ="1">
> 		<Name>MacMillan Inc</Name>
> 	</Publisher>
> 	<Publisher id ="2">
> 		<Name>Publishers Inc</Name>
> 	</Publisher>
> :
> :
> </Publishers>
> </OuterTag>
>
> And the output I am looking for is something like
> this [if the id's match
> for the childnodes then group it together]
>
> First
> Title : XML
> Author : ABC
> Address : Washington Street, USA
> Publisher : MacMillan Inc
>
> Second
> Title : XSL
> Author : DEF
> Address : Oxford Street, United Kingdom
> Publisher : Publishers Inc
>
> and so on ....
>
> Any idea will be appreciated.
>
> Thanks
> K
>
_________________________________________________________________
> Get your FREE download of MSN Explorer at
> http://explorer.msn.com
>
>
>  XSL-List info and archive:
> http://www.mulberrytech.com/xsl/xsl-list
>


__________________________________________________ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.yahoo.com/

XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


_________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread
  • Grouping ?
    • Kanthi Damodaran - Fri, 8 Jun 2001 08:48:01 -0400 (EDT)
      • Sreeram - Fri, 8 Jun 2001 09:08:25 -0400 (EDT)
      • Xiaocun Xu - Fri, 8 Jun 2001 09:51:42 -0400 (EDT)
      • <Possible follow-ups>
      • Kanthi Damodaran - Fri, 8 Jun 2001 10:13:40 -0400 (EDT) <=

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.