ndw/xmlcalabash1

p:validate-with-schematron: xslt not processed in sch:assert messages

Closed this issue · 2 comments

tl;dr: Please set <xsl:param name="allow-foreign">true</xsl:param> when running iso_svrl_for_xslt2.xsl internally as part of your implementation of p:validate-with-schematron:

When using p:validate-with-schematron I noticed that xsl instructions in the assert messages were not preserve. For example, when the following rule was triggered, the message would never include the value of the offending linkend:

    <sch:pattern id="footnoterefCheck">
        <sch:rule context="db:footnoteref[@linkend]">
            <sch:let name="this" value="@linkend"/>
            <sch:assert id="e0010" flag="0010" role="error" test="//db:footnote/@xml:id = $this">Error: The footnoteref/@linkend "<xsl:value-of select="$this"/>" does not point to a footnote element. This error is fatal because it causes the pdf renderer to fail. </sch:assert>
        </sch:rule>
    </sch:pattern>

I worked around this by converting the schematron to xslt and using p:xslt to generate a svrl report. In doing so, I noticed that the resulting xslt would omit the xsl instructions in sch:asserts unless I set allow-foreign to true when running the xslt. I have to assume that p:validate-with-schematron is using the same xslts internally, but isn't setting allow-foreign to true.

ndw commented

You should be able to do this yourself by passing it as a parameter.

Oh, it has a parameters port. I get it. Funny, this also came up like two weeks ago in the context of xspec where I finally figured out that I can just do the following in my xspec:

<x:param name="allow-foreign">true</x:param>