I am new to xml and I am having difficulties in understanding what is happening in the below statement. The Schematron file is from https://schemas.wmo.int/iwxxm/3.0.0/rule/iwxxm.sch
<sch:rule context="//*[contains(name(),'MeteorologicalAerodromeTrendForecast')]/iwxxm:weather">
<sch:assert test="@xlink:href = document('codes.wmo.int-49-2-AerodromePresentOrForecastWeather.rdf')/rdf:RDF/*/skos:member/*/@*[local-name()='about'] or @nilReason">
MeteorologicalAerodromeTrendForecast iwxxm:weather elements should be a member of http://codes.wmo.int/49-2/AerodromePresentOrForecastWeather
</sch:assert>
</sch:rule>
I understand that there is a rule to check the element iwxxm:weather
, but i am unable to understand the test condition. Can anyone explain it to me please? For what value, the test will pass.
The test is failing at a line in the xml which is
<iwxxm:MeteorologicalAerodromeForecast gml:id="uuid.c42e9861-aed6-449f-b4cd-4789e96464d5" cloudAndVisibilityOK="false">
<iwxxm:prevailingVisibility uom="m">350</iwxxm:prevailingVisibility>
<iwxxm:surfaceWind>
<iwxxm:AerodromeSurfaceWindForecast variableWindDirection="false">
<iwxxm:meanWindDirection uom="deg">240</iwxxm:meanWindDirection>
<iwxxm:meanWindSpeed uom="[kn_i]">8</iwxxm:meanWindSpeed>
</iwxxm:AerodromeSurfaceWindForecast>
</iwxxm:surfaceWind>
Here ----> <iwxxm:weather xlink:href="http://codes.wmo.int/49-2/AerodromePresentOrForecastWeather/_RA"/>
<iwxxm:cloud>
Thanks
The Schematron assertion is verifying that one of the following two conditions are met:
the xlink:href
attribute value of the iwxxm:weather
context element is equal to that of the about
attribute from a particular RDF document:
document()
function is used to access an external XML document. In this case, it is the codes.wmo.int-49-2-AerodromePresentOrForecastWeather.rdf
RDF document. about
(doesn't matter if it is bound to a namespace or not) skos:member
element rdf:RDF
document element.For instance, if the RDF document looked like this:
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:skos="http://www.w3.org/2004/02/skos/core#">
<foo>
<skos:member>
<bar skos:about="http://codes.wmo.int/49-2/AerodromePresentOrForecastWeather/_RA"/>
</skos:member>
</foo>
</rdf:RDF>
iwxxm:weather
context element has a nilReason
attributeFor instance, if the element were to look like this:
<iwxxm:weather nilReason="true" />