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

RE: No to display the values which are already existin

Subject: RE: No to display the values which are already existing
From: "Dhananjay Pitani" <dhanu1306@xxxxxxxxxxx>
Date: Wed, 25 Jun 2003 18:34:59 +0000
pitani
Hi Américo,

Thanks alot. Its working.
Ashis, My XML will have the data in consecutive order. So no problem.

Thanks,
Jay


From: "Tengshe, Ashish" <Tengshe.Ashish@xxxxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: RE:  No to display the values which are already existing
Date: Wed, 25 Jun 2003 13:13:31 -0500

This is not really accurate. This works only for th given sequence, try placing "Dan" and "Steve" Authors in different sequence and this breaks. Basically this works only if the Element on which the key is generated are in consecutive order.
I would like the answer too!
Thanks,
Ashish


-----Original Message-----
From: Américo Albuquerque [mailto:melinor@xxxxxxx]
Sent: Wednesday, June 25, 2003 12:48 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  No to display the values which are already existing


Hi


> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of
> Dhananjay Pitani
> Sent: Wednesday, June 25, 2003 6:23 PM
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  No to display the values which are already existing
>
>
> This is my xml
>
> <Store>
>   <Title>
>         <Author>Steve</Author>
>         <Name>XSL</Name>
>   </Title>
>   <Title>
>         <Author>Steve</Author>
>         <Name>XML</Name>
>   </Title>
>   <Title>
>         <Author>Dan</Author>
>         <Name>HTML</Name>
>   </Title>
>   <Title>
>         <Author>Dan</Author>
>         <Name>XSL</Name>
>   </Title>
> </Book>
>
> I want to display the above xml as a html table with two
> columns Author and
> Titlle. My task is to display the Author's name only once.
> The output should
> be like this
>
> Author      Title
>
> Steve        XSL
>                 XML
> Dan           HTML
>                 XSL
>

You could use a variation of the muenchian method

<xsl:key match="Title" name="list" use="Author"/>
<xsl:template match="Store">
<table>
<tr>
<td>Author</td>
<td>Title</td>
</tr>
<!-- instead of applying just to the first element of each group apply to
all -->
<xsl:apply-templates/>
</table>
</xsl:template>
<xsl:template match="Title">
<tr>
<td>
<!-- display the Author if this is the first element of the group -->
<xsl:if test="generate-id()=generate-id(key('list',Author))">
<xsl:apply-templates select="Author"/>
</xsl:if>
</td>
<td>
<xsl:apply-templates select="Name"/>
</td>
</tr>
</xsl:template>



Hope this helps you.




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


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



_________________________________________________________________
Gift yourself a holiday. Treat your family like royalty. http://www.flexihols.com/2003/index.php



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.