Hi David,
You said it didn't work, but you didn't say what you did or what effect
you saw.
I used the XPath expression within the new XML Schema 1.1 <assert> element:
<xs:element name="meeting">
<xs:complexType>
<xs:sequence>
<xs:element name="start" type="xs:time" />
<xs:element name="end" type="xs:time" />
</xs:sequence>
<xs:assert test="if (xs:time(start) gt xs:time(end)) then
true()
else
trace(false(), 'Hey, the
meeting ends before it begins!')" />
</xs:complexType>
</xs:element>
Here is a <meeting> with bad data:
<meeting>
<start>10:00:00</start>
<end>09:00:00</end>
</meeting>
I want an error to be thrown on this bad data. That will happen only if the
"else" part returns a false. Since no error was thrown, I infer that the
trace() function did not return false().
What are your thoughts on this?
/Roger
-----Original Message-----
From: David Carlisle [mailto:davidc(_at_)nag(_dot_)co(_dot_)uk]
Sent: Monday, April 25, 2011 5:46 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Cc: Costello, Roger L.
Subject: Re: [xsl] XPath expression that generates false plus a message?
On 25/04/2011 10:38, Costello, Roger L. wrote:
If there any way to return a false, but have a string come along with it?
The code you posted.
You said it didn't work, but you didn't say what you did or what effect
you saw.
David
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--