[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Contains

Subject: RE: Contains
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 30 May 2005 19:41:01 +0100
RE:  Contains
> Having trouble with contains.  I have a set of elements derived from a
> source xml which contains the parts of an email that are bad, that I'd
> like to ignore in my result.  An example would be the domain of my
> hosting company like so it would be listed as "lfchosting.com" and
> another element might be "directnic.com".
> 
> So I have:
> 
>     <xsl:if test="not(contains($bad_emails_contains,.))">
>        ... do my result ...
>     </xsl:if>

If $bad_emails_contains is a set of elements, then this won't work. The
contains() function expects a string. I think you might be trying to test
whether a node-set contains a given node (*please* don't try to guess what a
function does from its name alone!), in which case the XSLT 1.0 solution is

count($nodeset | $node) = count($nodeset)

The 2.0 solution is

exists($nodeset[. is $node])

Michael Kay
http://www.saxonica.com/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.