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

Re: Split and Found unique values

Subject: Re: Split and Found unique values
From: "David Carlisle" davidc@xxxxxxxxx
Date: Thu, 7 Dec 2006 14:42:01 GMT
unique values for each xsl
> your posted input doesn't match your code,  <target:row is in a target
> namespace but
> match=3D'xml/target' use=3D
> woul match an element target in no namespace.
> 
> I don't think you want to do this:
>                   <xsl:for-each select=3D'$Rowset[generate-id() =3D gen=
erate-id(key("Category", @Category))]'>
> as that handles each complete category separately, you want to stick
> them all togeter first and then split/sort. so
> 
> so something like
> 
> <xsl:stylesheet version=3D"1.0" xmlns:xsl=3D"http://www.w3.org/1999/XSL=
/Transform" xmlns:t=3D"t" >
> 
>  <xsl:output indent=3D"yes"/>
> 
> <xsl:key name=3D'Category' match=3D't:row' use=3D'@Category'/>
> <xsl:variable name=3D'seen' select=3D"''"/>
>  
>   <xsl:template match=3D"x">
>               <select name=3D"x" multiple=3D"multiple">
>                      <xsl:call-template name=3D"Split">
>                          <xsl:with-param name=3D"strInput">
> <xsl:for-each select=3D"t:row/@Category">
>   <xsl:value-of select=3D"."/>
>   <xsl:if test=3D"position()!=3Dlast()">-</xsl:if>
> </xsl:for-each>
> 			 </xsl:with-param>
>                      </xsl:call-template>
>               </select>
> </xsl:template>
> 
> if x is the parent of your target:row elements.
> 
> 
> In XSLT2 it's just
> 
> <x xmlns:target=3D"t">
> 
>        <target:row Category=3D'A-B-C-D'/>
>        <target:row Category=3D'A-B'/>
>        <target:row Category=3D'A-C-D'/>
>        <target:row Category=3D'C'/>
>        <target:row Category=3D'B-C-D'/>
>        <target:row Category=3D'A-t'/>
> </x>
> 
> 
> 
> 
> <xsl:stylesheet version=3D"2.0" xmlns:xsl=3D"http://www.w3.org/1999/XSL=
/Transform" xmlns:target=3D"t" >
> 
> <xsl:output indent=3D"yes"/>
> 
> <xsl:template match=3D"x">
>   <xsl:for-each select=3D"distinct-values(target:row/tokenize(@Category=
,'-'))">
>    <option><xsl:value-of select=3D"."/></option>
>   </xsl:for-each>
> </xsl:template>
> </xsl:stylesheet>
> 
> $ saxon8 spl.xml spl.xsl
> <?xml version=3D"1.0" encoding=3D"UTF-8"?>
> <option xmlns:target=3D"t">A</option>
> <option xmlns:target=3D"t">B</option>
> <option xmlns:target=3D"t">C</option>
> <option xmlns:target=3D"t">D</option>
> <option xmlns:target=3D"t">t</option>
> 
> =0A=0A=0A------------------------------------------------------=0APassa=
 a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom=0Ahttp=
://click.libero.it/infostrada07dic06=0A

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.