|
[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
> 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?
<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>
To do this directly in xpath you would need a generalisation of
current() that gave the node current outside the current filter
rather than the node current at the start of the expression.
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.
David
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








