Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


[xsl] Problem finding set difference on string values

From: "Mukul Gandhi" <gandhi.mukul@--------->
To:
Date: 1/1/2008 10:20:00 AM
Hi all,
   I am facing some problem calculating set difference on string values.

The problem details are below.

I have a text file, data.txt which contain information as below:
abc
pqr
mno
uvw
(here, each data element is delimited by a newline)

My XSLT 2.0 stylesheet is following:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                        version="2.0">

 <xsl:output method="text" />

 <xsl:variable name="list1"
select="tokenize(unparsed-text('data.txt'), '\n')" />
 <xsl:variable name="list2" select="('abc', 'pqr', 'ok')" />

 <xsl:template match="/">
   <xsl:for-each select="$list2[not(. = $list1)]">
     <xsl:value-of select="." /><xsl:text>&#xa;</xsl:text>
   </xsl:for-each>
 </xsl:template>

</xsl:stylesheet>

I want to find elements in 'list2' which are not present in text file.

I am expecting answer:
ok

But the output produced is:
abc
pqr
ok

What am I doing wrong?

I would appreciate help for this problem ...

I am using Saxon 9-b.

-- 
Regards,
Mukul Gandhi


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent