Mukul,
  Yes, that fixed it.  Thank you for your prompt reply.

- Jim

-----Original Message-----
From: Mukul Gandhi [mailto:muk...@apache.org] 
Sent: Wednesday, April 17, 2013 12:26 PM
To: j-users@xerces.apache.org
Subject: Re: regular expression matching in <assert>

Hi Jim,
    Thanks for sending across the schema and XML instance documents. I looked 
at the schema document you've shared.

The following fix seems to work for your problem <assert>,

<xsd:assert test="if (matches(string(@target), '.*')) then true() else false()" 
 xpathDefaultNamespace="##targetNamespace"/>

i.e, we use a string() function around attribute node @target. The 'target' 
attribute within your schema has type annotation of xsd:IDREFS, therefore we 
seem to need this workaround.

On Wed, Apr 17, 2013 at 9:06 PM, Jim Barnett <jim.barn...@genesyslab.com> wrote:
> Mukul,
>   Thanks for your response.  I've attached a sample schema and test file (the 
> schema is edited down from a much larger document, so it's structure may not 
> make much sense.)   The problem is in the <assert> in line 74 of the schema.  
> (The simpler <assert> in line 73 works properly.)
>
> I suspect that you may be right about there being a namespace problem, 
> because the <assert> in line 74 fails even if I wrap not() around it.  
> So both
>
> <xsd:assert test="if (matches(@target, '.*')) then true() else 
> false()"  xpathDefaultNamespace="##targetNamespace"/>
> And
> <xsd:assert test="if not((matches(@target, '.*'))) then true() else 
> false()"  xpathDefaultNamespace="##targetNamespace"/>
>
> both fail, which makes it look like the processor is not finding the 
> matches() function.
>
> The 'xpathDefaultNamespace="##targetNamespace"' attribute is something I 
> stumbled across when trying to get some other assertions to work, but I admit 
> that I don't really understand what effects it may be having.
>
> Thank you for your help.
>
> - Jim




--
Regards,
Mukul Gandhi

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-users-h...@xerces.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-users-h...@xerces.apache.org

Reply via email to