dizzzz / jing-trang

Automatically exported from code.google.com/p/jing-trang
Other
0 stars 0 forks source link

variable reference in <diagnostic> element is not expanded properly. #183

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
On Schematron validation, XPath expression in the select attribute of
<value-of> element in <diagnostic> element can't refer the variable
defined in <rule> element.

> What steps will reproduce the problem?

write following schematron schema to 'test-NG.sch':
<schema xmlns="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
  <let name="to" value="string('NG')"/>

  <pattern id="test.hello">
    <rule context="hello">
      <let name="to" value="./@to"/>
      <assert test="false()" diagnostics="hello-world"/>
    </rule>
  </pattern>

  <diagnostics>
    <diagnostic id="hello-world">
      "Hello <value-of select="$to"/>!"
    </diagnostic>
  </diagnostics>
</schema>

write following xml document to 'test.xml':
<?xml version="1.0"?>
<root>
  <hello to="World"/>
</root>

run jing validator with -d option:
  jing.sh -d test-NG.sch test.xml

> What is the expected output? What do you see instead?

expected output:
  "Hello World!"

result output:
  "Hello NG!"

> What version of the product are you using? On what operating system?

jing-trang: trunk r2368.

OS: Mac OS X 10.9.3

java -version:
  java version "1.6.0_65"
  Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
  Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

> Please provide any additional information below.

Reference implementation of ISO Schematron makes expected output.
http://www.schematron.com/implementation.html

run:
  iso-schematron-xslt2.sh test-NG.sch test.xml
  # using SaxonHE 9.5.1.5 for XSLT2 processor.

result output:
  <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  <svrl:schematron-output xmlns:svrl="http://purl.oclc.org/dsdl/svrl"
    ...snip...
    <svrl:failed-assert test="false()" location="/root[1]/hello[1]">
      <svrl:text/>
      <svrl:diagnostic-reference diagnostic="hello-world">

      "Hello World!"
      </svrl:diagnostic-reference>
    </svrl:failed-assert>
  </svrl:schematron-output>

Original issue reported on code.google.com by na...@4dn.co.jp on 1 Jul 2014 at 4:04

Attachments: