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

Option/variable bindings unavailable when evaluating p:viewport/@match #264

Open
gimsieke opened this issue Nov 4, 2017 · 0 comments
Open

Comments

@gimsieke
Copy link
Contributor

gimsieke commented Nov 4, 2017

This pipeline does a directory listing of the directory that it resides in, and it is supposed to load all files whose names match the regex \.x[mps]l$:

<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
  xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0">
  <p:output port="result" primary="true"/>
  <p:serialization port="result" indent="true" omit-xml-declaration="false"/>
  <p:option name="regex" select="'\.x[mps]l$'"/>
  <p:directory-list path="."/>
  <p:viewport match="c:file[matches(@name, $regex)]" name="vp">
    <p:load name="load">
      <p:with-option name="href" select="/*/@name"/>
    </p:load>
    <p:sink/>
    <p:insert match="/*" position="last-child">
      <p:input port="source">
        <p:pipe port="current" step="vp"/>
      </p:input>
      <p:input port="insertion">
        <p:pipe port="result" step="load"/>
      </p:input>
    </p:insert>
  </p:viewport>
</p:declare-step>

Morgana gives a correct result without raising an error. Calabash, on the other hand, complains:

ERROR: net.sf.saxon.trans.XPathException: Undeclared variable in XPath expression: $regex

The 1.0 spec makes it clear, in Sect. 2.6, that all bindings be available when evaluating p:viewport/@match.

Tested with XML Calabash 1.1.15-96 and 1.1.16-97.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant