|
[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
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
|
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
|

Cart








