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

Re: Sorting + unique copy problem

Subject: Re: Sorting + unique copy problem
From: "Thomas B. Passin" <tpassin@xxxxxxxxxxxx>
Date: Thu, 8 Nov 2001 14:11:07 -0500
unique copy
In fact, your stylesheet does work except for one thing.  It isn't
well-formed because the <form> element isn't closed.  You need to add the
closing tag for it - which you need even in html - and preferably also
declare

<xsl:output method='html'/>

After I made that fix, the select box does have the keywords sorted
alphabetically as you want.  Without the fix, the stylesheet cannot run.

Cheers,

Tom P

[Annalisa Ricci]

> Hallo all,
> I have a problem with sorting too and I couldn't solve it.
> My XML contains a <Filmlist>.
> Every <Film> in the <Filmlist> can have 1..* <KeyWord> tags.
> I would to use the KeyWord values as <OPTION> of a <SELECT> input.
> I would every KeyWord value to be present in a unique copy, and sorted in
> alphabetic order.
> Something like :
>
> <option value="{Keyword1}"> Keyword1</option>
> <option value="{Keyword2}"> Keyword2</option>
> <option value="{Keyword3}"> Keyword3</option>
> <option value="{Keyword4}"> Keyword4</option>
> <option value="{Keyword5}"> Keyword5</option>
>
> I tried the code XSL below and the KeyWord values are present in un unique
> copy, but they aren't sorted.
>
> What is wrong?
> TIA, annalisa
> ====My XML ================================
> <Filmlist>
>     <Film>
>         <KeyWord>Keyword1</KeyWord>
>         <KeyWord>Keyword2</KeyWord>
>         <KeyWord>Keyword3</KeyWord>
>         <KeyWord>Keyword4</KeyWord>
>     </Film>
>     <Film>
>         <KeyWord>Keyword5</KeyWord>
>         <KeyWord>Keyword1</KeyWord>
>         <KeyWord>Keyword3</KeyWord>
>         <KeyWord>Keyword6</KeyWord>
>     </Film>
>     <Film>
>         <KeyWord>Keyword3</KeyWord>
>         <KeyWord>Keyword7</KeyWord>
>     </Film>
> </Filmlist>
>
>
> ====My XSL ================================
> <xsl:key name="kw" match="KeyWord" use="."/>
>
> <xsl:template match="/">
>     <form action="process_user.jsp" TARGET="result" method="get">
>            <select type="text" name="kw" size="1" maxlength="125">
>                     <option value="empty"/>
>                      <xsl:apply-templates select="//KeyWord"/>
>             </select>
> </xsl:template>
>
> <xsl:template match="KeyWord">
>     <xsl:for-each
select="self::node()[generate-id(.)=generate-id(key('kw',
> .)[1])]">
>     <xsl:sort select="." />
>     <option value="{.}"><xsl:value-of select="."/></option>
>     </xsl:for-each>
> </xsl:template>
>
>


 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.