metadata101 / iso19139.ca.HNAP

ISO Harmonized North American Profile (HNAP)
GNU General Public License v2.0
4 stars 19 forks source link

validate for online resource protocol #263

Closed wangf1122 closed 2 years ago

wangf1122 commented 2 years ago

The issue is this field is mandatory and can still be saved as empty from the user input.

image

As result, the protocol will be filled with some default value "WWW:DOWNLOAD-1.0-http--download" which is not correct. There is correct value which is HTTP as quick compare.

image

The validation rule will catch this default incorrect value and output error message as: image

wangf1122 commented 2 years ago

@josegar74 @ianwallen

This seems to be a pending PR which we skipped.

ianwallen commented 2 years ago

@wangf1122 I can see in the compiled .xslt (from .sch file) that there is a line similar to the following to get the schematron locale data.

  <xsl:variable xmlns:svrl="http://purl.oclc.org/dsdl/svrl" name="loc"
                 select="document(concat('../loc/', $lang, '/', $rule, '.xml'))"/>

So I would expect that you should be able to do the following to get the labels.xml locales file

<xsl:variable name="locLabel" select="document(concat('../loc/', $lang, '/labels.xml'))"/>

In schematron rules, you cannot use <xsl:variable but you can use <sch:let and you can also use <xsl:function. So you can try with <sch:let. If you can't get <sch:let to work then you can try to create a <xsl:function to be used in the <sch:let. Look at the other schematrons for sample using <xsl:function