Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creates invalid stylesheet if two patterns bind variables with the same name #76

dmj opened this Issue Nov 29, 2018 · 0 comments


None yet
1 participant
Copy link

dmj commented Nov 29, 2018

Given the following Schematron:

<schema xmlns="" queryBinding="xslt2">
  <pattern id="pattern-1">
    <let name="variable" value="'in-pattern-1'"/>
    <rule context="*">
      <assert test="true()"/>
  <pattern id="pattern-2">
    <let name="variable" value="'in-pattern-2'"/>
    <rule context="*">
      <assert test="true()"/>

The Skeleton implementation creates the following XSLT 2.0 stylesheet with two global variables with the same name:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xsl:stylesheet xmlns:xs=""

  <!-- ... -->


  <!--PATTERN pattern-1-->
  <xsl:variable name="variable" select="'in-pattern-1'"/>

  <!--RULE -->

  <xsl:template match="*" priority="1000" mode="M0">
    <!-- ... -->

  <!-- ... -->

  <!--PATTERN pattern-2-->
  <xsl:variable name="variable" select="'in-pattern-2'"/>

  <!--RULE -->
  <xsl:template match="*" priority="1000" mode="M1">
    <!-- ... -->

  <!-- ... -->


Section 9.5 (Global Variables and Parameters) of the XSLT 2.0 specification reads:

If a stylesheet contains more than one binding for a global variable of a particular name, then the binding with the highest import precedence is used.

[ERR XTSE0630] It is a static error if a stylesheet contains more than one binding of a global variable with the same name and same import precedence, unless it also contains another binding with the same name and higher import precedence.

Running the stylesheet with Saxon rightfully results in XTSE0630:

Static error at xsl:variable on line 198 column 59 of schema.sch-compiled.xsl:
  XTSE0630: Duplicate global variable/parameter declaration (see line 224 of

To reproduce run with the skeleton implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.