76 lines
3.0 KiB
Plaintext
76 lines
3.0 KiB
Plaintext
|
<?xml version="1.0" encoding="UTF-8"?>
|
||
|
<!--
|
||
|
Additional checks for platform taxonomies.
|
||
|
|
||
|
Author: Andrew Sales
|
||
|
Date: 20170523
|
||
|
Project: Self-service platform
|
||
|
Comments:
|
||
|
-->
|
||
|
<schema xmlns="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2"
|
||
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||
|
xmlns:bmy='http://www.bloomsbury.com/ns/xsl'>
|
||
|
|
||
|
<ns uri="http://rdf.bloomsbury.com/ssp/search#relevance" prefix="rel"/>
|
||
|
<ns uri="http://www.bloomsbury.com/ns/xsl" prefix='bmy' />
|
||
|
|
||
|
<xsl:key name='facet-by-id' match='facet' use='@xml:id'/>
|
||
|
|
||
|
<phase id="propagator-platform">
|
||
|
<active pattern="empty-alternateID"/>
|
||
|
</phase>
|
||
|
|
||
|
<pattern id='relevancePrologue'>
|
||
|
<rule context="/taxonomy">
|
||
|
<assert test="rel:relatedContent">A product taxonomy for the Self-Service Platform MUST include a related content prologue.</assert>
|
||
|
</rule>
|
||
|
</pattern>
|
||
|
|
||
|
<pattern id='rankingType'>
|
||
|
<rule context="/taxonomy/rel:relatedContent/rel:ranking">
|
||
|
<assert test="@type[.='relevance']">A related content prologue for the Self-Service Platform MUST include a <name/>/@ type='relevance'.</assert>
|
||
|
</rule>
|
||
|
</pattern>
|
||
|
|
||
|
<pattern id="minimumMatchLevel">
|
||
|
<rule context="facet[@rel:minimumMatchLevel]">
|
||
|
<let name="level" value="@rel:minimumMatchLevel"/>
|
||
|
<let name="facet" value="key('facet-by-id', @xref)"/>
|
||
|
<let name="facet-depth" value="bmy:max-depth($facet/*)"/>
|
||
|
<assert test="$level castable as xs:int
|
||
|
and
|
||
|
xs:int($level) le $facet-depth">Value of minimum match level (<value-of select="$level"/>) is higher than the number of non-top-level facets available (<value-of select="$facet-depth"/>); (see facet/@xml:id='<value-of select="$facet/@xml:id"/>').</assert>
|
||
|
</rule>
|
||
|
</pattern>
|
||
|
|
||
|
<pattern id='suppressInBrowse'>
|
||
|
<rule context="taxonomy">
|
||
|
<assert test="facet/@suppressInBrowse[.='true']" role="warning">A product taxonomy will usually have at least one top-level facet with @suppressInBrowse='true'.</assert>
|
||
|
</rule>
|
||
|
</pattern>
|
||
|
|
||
|
<pattern id='displayHint'>
|
||
|
<rule context="taxonomy">
|
||
|
<assert test="facet/@displayHint[.='alphaSorted']" role="warning">A product taxonomy may have at least one top-level facet with @displayHint='true'.</assert>
|
||
|
</rule>
|
||
|
</pattern>
|
||
|
|
||
|
<!-- Propagator platform-specific -->
|
||
|
<pattern id="empty-alternateID">
|
||
|
<rule context="alternateIDs/id">
|
||
|
<assert test="normalize-space() != ''">Alternate ID must contain a text value.</assert>
|
||
|
</rule>
|
||
|
</pattern>
|
||
|
|
||
|
<!-- FUNCTIONS -->
|
||
|
|
||
|
<!-- see http://www.xqueryfunctions.com/xq/functx_max-depth.html -->
|
||
|
<xsl:function name='bmy:max-depth'>
|
||
|
<xsl:param name='root'/>
|
||
|
|
||
|
<xsl:sequence select='if ($root/*)
|
||
|
then max($root/*/bmy:max-depth(.)) + 1
|
||
|
else 1'/>
|
||
|
</xsl:function>
|
||
|
|
||
|
</schema>
|