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

Re: New twist: eliminating nodes with duplicate content, cas

Subject: Re: New twist: eliminating nodes with duplicate content, case-insensi tive
From: Phil Lanch <phil@xxxxxxxxxxxxxxx>
Date: Tue, 07 Dec 1999 12:06:19 +0000
new product lanch
David Carlisle wrote:
> 
> > The code below does it in one pass (it was indeed a brave assertion!),
> 
> I suspect that was multiple passes by Michael's counting (as is the code
> below) I don't think that you can do it in a single xpath expression,
> for the reasons given, but I don't think you need to use explicit
> recursion. Isn't this more or less what is wanted?

I thought Michael meant it couldn't be done without piping the source
through 2 stylesheets. - Anyway, your solution is much more readable
than mine, and more efficient at least until XSL processors are smart
enough to optimize that recursion into iteration - which I assume they
aren't yet.

> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                 version="1.0"
>                 >
> 
> <xsl:variable name="up" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
> <xsl:variable name="lo" select="'abcdefghijklmnopqrstuvwxyz'"/>
> 
> <xsl:template match="/">
> <xsl:apply-templates select="//handle"/>
> </xsl:template>
> 
> <xsl:template match="handle">
> <xsl:if test="not(following::handle[translate(.,$up,$lo)=
>                                     translate(current(),$up,$lo)])">
>   <xsl:copy-of select="."/>
> </xsl:if>
> </xsl:template>
> 
> </xsl:stylesheet>
> 
> Of course the above probably results in the current node being downcased
> multiple times and it would be better anyway not to use
> current() at all and just put the lowercase of the current node value
> into a variable.

-- 

bahhumbug

phil

*witness relocation program alumnus*


 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.