xsl-list
[Top] [All Lists]

On-the-fly case-conversion w. translate()

2005-04-06 14:07:51
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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>