Skip to content
This repository was archived by the owner on Nov 2, 2020. It is now read-only.
This repository was 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

Description

@nkutsche

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'"/>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugDescription of a bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions