Subject: Re: [xsl] string set difference From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Thu, 16 Dec 2010 13:17:02 -0500 |
Please help how to calculate set difference between string sequences in XSLT 2.0? (not node-sets)
t:\ftemp>type andriy.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:template match="/"> <xsl:variable name="s1" as="xsd:string*" select="'a','b','c','d','e','f'"/> <xsl:variable name="s2" as="xsd:string*" select="'c','d','e','f','g','h'"/> Difference: <xsl:value-of select="$s1[not(.=$s2)],$s2[not(.=$s1)]"/> Intersection: <xsl:value-of select="$s1[.=$s2]"/> </xsl:template>
Difference: a b g h Intersection: c d e f t:\ftemp>
-- Contact us for world-wide XML consulting & instructor-led training Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] string set difference, Andriy Gerasika | Thread | Re: [xsl] string set difference, Andriy Gerasika |
[xsl] string set difference, Andriy Gerasika | Date | [xsl] Using XSL variable in XQuery , mlcook |
Month |