RE: problems using tokenize()

Jim Barnett <[email protected]>
Newsgroups gmane.text.xml.xerces-j.user
Message-ID <57A15FAF9E58F841B2B1651FFE16D281039AF2@GENSJZMBX02.msg.int.genesyslab.com>
Mukul,
Yes, you are right.  Count() works as you say.

Thank you for your help.


-          Jim

From: Mukul Gandhi [mailto:[email protected]]
Sent: Friday, April 19, 2013 12:30 AM
To: [email protected]
Subject: Re: problems using tokenize()

Hi Jim,
 With a boolean() function around 'tokenize' call, an "effective boolean value" of xs:string* result of 'tokenize' will be returned. But this would result in an error as per XPath 2.0 spec, for your example. I imagine, an 'exists' or 'count' function around tokenize() would let you achieve the same purpose as matches().


Sent from a mobile device.

On Thursday, April 18, 2013, Jim Barnett <[email protected]<mailto:[email protected]>> wrote:
> I'm having trouble getting tokenize() to behave the way I expect it to.  As before, I have an element with an attribute @target with type idrefs.  I want to split the value into the individual idrefs (I will run more complicated tests on them, but for the moment I'm just trying to get access to them).  In the attached document and schema, I have two assertions.  The first, using matches() succeeds, but the second, using tokenize(), fails:
>
>
>
> <xsd:assert test="matches(string(@target), '\S+(\s+\S+)+')" xpathDefaultNamespace="##targetNamespace"/>
>
> <xsd:assert test="boolean(tokenize(string(@target), '\s+'))"  xpathDefaultNamespace="##targetNamespace"/>
>
>
>
> What am I doing wrong?
>
>
>
> Thanks,
>
> Jim

--
Regards,
Mukul Gandhi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.