This repository has been archived by the owner on Nov 2, 2020. It is now read-only.
This repository has been archived by the owner on Nov 2, 2020. It is now read-only.
Creates invalid stylesheet if attribute value templates are used in foreign elements #82
Open
Description
Hi,
the skeleton creates an invalid stylessheet for this schema:
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2"
xmlns:sqf="http://www.schematron-quickfix.com/validator/process">
<sch:pattern>
<sch:rule context="any-context">
<!-- do some test -->
<sqf:fix id="fix">
<sqf:description>
<sqf:title>Sample fix</sqf:title>
</sqf:description>
<sch:let name="regex" value="'some regex'"/>
<sqf:stringReplace match="." regex="{$regex}" select="'replacement'"/>
</sqf:fix>
</sch:rule>
</sch:pattern>
</sch:schema>
The variable is not compiled as xsl:variable but the attribute value template is copied as it is, so the error is:
Error at sqf:stringReplace on line 197 column 87 of test.xsl:
XPST0008: XPath syntax error at char 7 on line 197 in {{$regex}}:
Variable $regex has not been declared
Failed to compile stylesheet. 1 error detected.
I think the problem is not that the variable is not compiled, but that the attribute value template is copied unchanged.
A workaround is, to add a global dummy variable with the same name:
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2"
xmlns:sqf="http://www.schematron-quickfix.com/validator/process">
<sch:let name="regex" value="'dummy'"/>