Patrick Gratz created XERCESJ-1675: -------------------------------------- Summary: 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
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 (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: j-dev-unsubscr...@xerces.apache.org For additional commands, e-mail: j-dev-h...@xerces.apache.org