[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Split and Found unique values
> 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|