RE: Xerces-J 2.12.0 vs. Saxon: XSD 1.1 gYearMonth comparison is failing
Yitzhak Khabinsky <[email protected]> Thu, 9 Aug 2018 13:54:12 +0000
| Newsgroups | gmane.text.xml.xerces-j.user |
|---|---|
| Message-ID | <AM6PR09MB262915E066355906F2DC920B8D250@AM6PR09MB2629.eurprd09.prod.outlook.com> |
Hi Mukul, The expression in the assert is working in Saxon with flying colors. The idea is to use the gYearMonth data type so it will check correctness of both year and month portions of it. The real limitation is that the XSD 1.1 standard prevents use of the inheritable attributes in the asserts which is the opposite from what CTAs allow. So it forces the assert to work just once in one-to-many fashion, i.e. <root> where @DataFeed attribute resides vs. multiple <r> with the Date elements in this case. Please see the screenshots below. They show that there is nothing wrong with the XPath expression. [cid:[email protected]] [cid:[email protected]] Regards, Yitzhak Khabinsky From: Mukul Gandhi [mailto:[email protected]] Sent: Thursday, August 9, 2018 1:18 AM To: Yitzhak Khabinsky <[email protected]> Cc: [email protected] Subject: Re: Xerces-J 2.12.0 vs. Saxon: XSD 1.1 gYearMonth comparison is failing Hi Yitzhak, On Wed, Aug 8, 2018 at 8:41 PM, Yitzhak Khabinsky <[email protected]<mailto:[email protected]>> wrote: <xs:assert test="empty(r/Date[xs:gYearMonth(xs:date(.)) ne ../../xs:gYearMonth(@DataFeed)])" I can't exactly debug your above XPath expression quickly. I'm sure, someone from Xerces team or community will offer advise about above XPath expression asap, in relation to XSD 1.1 <assert>. In the meantime, I can offer following XPath 2.0 expressions as workaround for your usecase, which seem to work with Xerces. empty(r/Date[substring(string(.),0,8) ne string(../../@DataFeed)<mailto:../../@DataFeed)>]) or every $d in r/Date satisfies substring(string($d),0,8) eq string(@DataFeed) -- Regards, Mukul Gandhi This message (including any attachments) may contain confidential, proprietary, privileged and/or private information. The information is intended to be for the use of the individual or entity designated above. If you are not the intended recipient of this message or have received this transmission in error, please notify the sender immediately, and delete the message and any attachments. Any disclosure, reproduction, distribution or other use of this message or any attachments by an individual or entity other than the intended recipient is prohibited. Este mensaje (incluido cualquiera de sus anexos) puede contener información confidencial, privilegiada, propietaria, y/o privada. La información está destinada para el uso del individuo o la entidad designada arriba. Si usted no es el destinatario de este mensaje o ha recibido este mensaje por error, por favor notifique a su remitente inmediatamente, y elimine el mensaje y cualquiera de sus anexos. Se prohíbe cualquier revelación, reproducción, distribución u otro uso de este mensaje o cualquiera de sus anexos que sea realizado por un individuo o una entidad diferente al destinatario.
image001.png
(image/png, 51.6 KB) - not displayed
image002.png
(image/png, 50.2 KB) - not displayed