Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
XML
data.xmlanalysis
mappoint.webservice
msf
msxml-webrelease
netmyservices.sdk
passport.sdk
soap
soapsdk
uddi.general
uddi.programming
uddi.specification
xml
xmlsqlwebrelease
xsl
  
 
date: Thu, 7 Feb 2008 00:19:52 -0800 (PST),    group: microsoft.public.xsl        back       


distinct output   
Hello,

I have a xml like this:

<root>
   <item name="111">
      <subitem name="aaa">
      <subitem name="bbb">
   </item>....

Now I want to output the item names for some subitems.
example: I want all item names with a subitem "aaa"

I can do that. Now comes the but:
I want them only be outputted once.

How can I do that?

bye bembi
date: Thu, 7 Feb 2008 00:19:52 -0800 (PST)   author:   unknown

Re: distinct output   
Index items and then take only first one:

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

   <xsl:key name="item" match="item" use="subitem/@name"/>

   <xsl:template match="/">
     <out>
       <xsl:value-of select="key('item', 'aaa')[1]/@name"/>
     </out>
   </xsl:template>

</xsl:stylesheet>


-- 
Oleg

bbembi_de@lycos.de wrote:
> Hello,
> 
> I have a xml like this:
> 
> <root>
>    <item name="111">
>       <subitem name="aaa">
>       <subitem name="bbb">
>    </item>....
> 
> Now I want to output the item names for some subitems.
> example: I want all item names with a subitem "aaa"
> 
> I can do that. Now comes the but:
> I want them only be outputted once.
> 
> How can I do that?
> 
> bye bembi
date: Thu, 07 Feb 2008 13:16:49 +0200   author:   Oleg Tkachenko

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us