|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Retrieving sequence of unique strings from another
At 2010-01-05 13:41 -0500, Houghton,Andrew wrote:
I have a sequence of strings, e.g., ('abc', 'def', 'def', 'ghi'), and I want to create a new sequence that will have only the unique strings in it. The XSL 2.0 function distinct-values is not what I want because: I hope the solution below helps. . . . . . . . Ken T:\ftemp>xslt2 andy.xsl andy.xsl
abc ghi
T:\ftemp>type andy.xsl
<?xml version="1.0" encoding="US-ASCII"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
version="2.0"><xsl:output method="text"/> <xsl:template match="/">
<xsl:variable name="list" as="xsd:string*"
select="('abc', 'def', 'def', 'ghi')"/>
<xsl:variable name="uniq" as="xsd:string*"
select="for $each in $list return
if( count($list[.=$each])=1 ) then $each else ()"/>
<xsl:value-of select="$uniq"/>
</xsl:template></xsl:stylesheet> T:\ftemp>
|
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








