|
Subject: [xsl] On-the-fly case-conversion w. translate() From: Shivani Goel <goelshivani@xxxxxxxxx> Date: Wed, 6 Apr 2005 14:07:51 -0700 (PDT) |
I've been through this list (and also googled my
query), but am wits end as why my code doesnt work:
This is a fragment from my XML file:
<Program name="project oregon">
...
..
</Program>
<Program name="project oregon">
..
...
.......
</Program>
<Program name="Project Oregon">
.......
........
.......
</Program>
<Program name="Spring Beach Cleanup">
..............
.........
</Program>
<Program name="Spring Beach Cleanup">
...
</Program>
I want to display the value of attr 'name', in an HTML
<select> element (aka drop down list), while
eliminating duplicates, for which, I do this:
<select class="formDropDown1" name="program"
id="program">
<xsl:if test= "@name [not (self::node() =
following::Program/@name)]">
<option>
<xsl:attribute name="value"><xsl:value-of
select="@name"/></xsl:attribute>
<xsl:value-of select="@name" />
</option>
</xsl:if>
The above works flawlesslessly to eliminate duplicates
(though from what I've read, using 'following' axis
may lead to pefomance issues with very large XML
files...).
However, *and this is my reason for posting to the
list*, I want to have "project oregon" and "Project
Oregon" display only once! I tried the following to
translate the respective nodes to identical (upper)
case, as follows:
<xsl:if test="@name[not(translate (self::node(),
abcdefghijklmnopqrstuvwxyz,
ABCDEFGHIJKLMNOPQRSTUVWXYZ) = translate
(following::Program/@name, abcdefghijklmnopqrstuvwxyz,
ABCDEFGHIJKLMNOPQRSTUVWXYZ))]" >
This does NOT work! Duplicates are eliminated,
however, "project oregon" & "Project Oregon " are
treated as separate /unique strings. What am I doing
wrong?
Any suggestions will be gratefully welcome.
Shivani.
__________________________________
Do you Yahoo!?
Yahoo! Personals - Better first dates. More second dates.
http://personals.yahoo.com
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Getting a distinct list o, Paul Koppen | Thread | Re: [xsl] On-the-fly case-conversio, David Carlisle |
| Re: [xsl] How to use multiple xsl:i, Dimitre Novatchev | Date | Re: [xsl] On-the-fly case-conversio, David Carlisle |
| Month |