You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Mukul Gandhi (Jira)" <xe...@xml.apache.org> on 2019/09/12 08:42:00 UTC
[jira] [Resolved] (XERCESJ-1675) Assert evaluation fails when using
distinct-values function
[ https://issues.apache.org/jira/browse/XERCESJ-1675?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mukul Gandhi resolved XERCESJ-1675.
-----------------------------------
Assignee: Mukul Gandhi
Resolution: Not A Problem
Apologies for a delayed response.
I think that, the assert test expression that you've written in your XSD document, should be following,
test="count(distinct-values(descendant::node()/@ADMID)) eq count(descendant::node()/@ADMID)"
instead of,
test="count(distinct-values(descendant::node()/@ADMID)) eq count(descendant::node()[@ADMID])"
I think, you wrongly write [@ADMID] instead of /@ADMID after 'eq'.
The example you've posted in your bug report, gives me expected result with XercesJ 2.12.0.
I'm resolving this Jira issue. Please reopen, if there's still a concern.
> Assert evaluation fails when using distinct-values function
> -----------------------------------------------------------
>
> Key: XERCESJ-1675
> URL: https://issues.apache.org/jira/browse/XERCESJ-1675
> Project: Xerces2-J
> Issue Type: Bug
> Affects Versions: 2.11.0
> Reporter: Patrick Gratz
> Assignee: Mukul Gandhi
> Priority: Major
>
> It seems that there is a problem with the usage of the function distinct-values in xs:assert tests. Validating the following schema-compliant example against the related schema fails with the error message:
> {noformat}
> cvc-assertion.3.13.4.1: Assertion evaluation ('count(distinct-values(descendant::node()/@ADMID)) eq count(descendant::node()[@ADMID])') for element 'mets' with type 'metsType' did not succeed.
> {noformat}
> {code:xml|title=example_schema.xsd}
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" xmlns="http://www.loc.gov/METS/"
> xmlns:mets="http://www.loc.gov/METS/"
> xmlns:cellar-mets="http://publications.europa.eu/cellar-mets-extensions"
> xmlns:xlink="http://www.w3.org/1999/xlink" targetNamespace="http://www.loc.gov/METS/"
> elementFormDefault="qualified" attributeFormDefault="unqualified" vc:minVersion="1.1"
> version="3.0">
> <xs:element name="mets">
> <xs:complexType>
> <xs:complexContent>
> <xs:extension base="metsType"/>
> </xs:complexContent>
> </xs:complexType>
> </xs:element>
>
> <xs:complexType name="metsType">
> <xs:sequence>
> <xs:any processContents="lax" maxOccurs="unbounded"/>
> </xs:sequence>
> <xs:anyAttribute processContents="lax"/>
> <xs:assert
> test="count(distinct-values(descendant::node()/@ADMID)) eq count(descendant::node()[@ADMID])"
> xpathDefaultNamespace="##targetNamespace">
> <xs:annotation>
> <xs:documentation xml:lang="en">The set of ADMID attributes has to contain only unique
> values.</xs:documentation>
> <xs:appinfo>
> <metsSection>multiSection</metsSection>
> </xs:appinfo>
> </xs:annotation>
> </xs:assert>
> </xs:complexType>
> </xs:schema>
> {code}
> {code:xml|title=example_instance.xml}
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <mets xmlns="http://www.loc.gov/METS/" xmlns:xlink="http://www.w3.org/1999/xlink" TYPE="create" cellar-mets:version="3.0" PROFILE="http://publications.europa.eu/mdr/mets/cellar-mets-3_profile.xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cellar-mets="http://publications.europa.eu/cellar-mets-extensions" xsi:schemaLocation="http://www.loc.gov/METS/ http://www.loc.gov/standards/mets/version111/mets.xsd">
> <metsHdr CREATEDATE="2016-08-22T10:30:01.540+02:00">
> <metsDocumentID>celex_02009R1223-20150716_create_item</metsDocumentID>
> </metsHdr>
> <dmdSec ID="md_fragment_item_tiff_3">
> <mdRef LOCTYPE="URL" MIMETYPE="application/rdf+xml" CHECKSUM="acbbccd7fd286dc00a65cb0c99c0e832579e631400fa495265fa943dcbd86851" CHECKSUMTYPE="SHA-256" xlink:href="md_L_2009342EN.01020304.tif.rdf" MDTYPE="OTHER" OTHERMDTYPE="CDM"/>
> </dmdSec>
> <amdSec ID="amd_fmx">
> <techMD ID="techMd_tiff_3">
> <mdRef LOCTYPE="URL" MIMETYPE="application/rdf+xml" CHECKSUM="803e7110abce30d535e0db8f305ec863afcd19858dd70692d304e20f9e2684a3" CHECKSUMTYPE="SHA-256" xlink:href="techMd_L_2009342EN.01020304.tif.rdf" MDTYPE="OTHER" OTHERMDTYPE="TDM"/>
> </techMD>
> </amdSec>
> <fileSec>
> <fileGrp>
> <file ID="file_tiff_3" MIMETYPE="image/tiff" CHECKSUM="3c0b9b898bc3e39f5b61946fd7e3977c98f9d3a139c7af29d5eedd688f91aa23" CHECKSUMTYPE="SHA-256" ADMID="techMd_tiff_3" DMDID="md_fragment_item_tiff_3">
> <FLocat LOCTYPE="URL" xlink:href="L_2009342EN.01020304.tif"/>
> </file>
>
> </fileGrp>
> </fileSec>
> <structMap ID="structMap_1">
> <div TYPE="work" CONTENTIDS="celex:02009R1223-20150716">
> <div TYPE="expression" CONTENTIDS="celex:02009R1223-20150716.ENG">
> <div TYPE="manifestation" CONTENTIDS="celex:02009R1223-20150716.ENG.fmx4">
> <fptr FILEID="file_tiff_3" CONTENTIDS="celex:02009R1223-20150716.ENG.fmx4.L_2009342EN.01020304.tif"/>
> </div>
> </div>
> </div>
> </structMap>
> </mets>
> {code}
--
This message was sent by Atlassian Jira
(v8.3.2#803003)
---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org