Saxon produces empty XML from Schematron
Asked Answered
L

1

0

I am trying to compile Schematron file through the XSLT file (iso_svrl_for_xslt2.xsl) with help of Saxon9HE as described here and there.

Here I am calling Saxon with 3 arguments:

-o:schema-compiled.xsl is the output file (XSLT script)

-s:example_schematron.xsl is the source file

iso-schematron-xslt2/iso_svrl_for_xslt2.xsl is the stylesheet file, used to compile schematron file into XSLT script

java -jar saxon9he.jar -o:schema-compiled.xsl -s:example_schematron.sch iso-schematron-xslt2/iso_svrl_for_xslt2.xsl

Here are the files:

example_schematron.sch:

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.ascc.net/xml/schematron">
  <title>Test Schematron</title>
  <pattern name="My rules">
      <rule context="User">
            <assert test="count(email) != 1">
                  User shall have exactly one email
            </assert>
      </rule>
</pattern>
</schema>

schema-compiled.xsl:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

Why am I getting empty schema-compiled.xsl?

Liederkranz answered 5/6, 2013 at 14:44 Comment(0)
B
1

I haven't looked at the stylesheet but I think (based on http://www.schematron.com/iso/iso-schematron.rnc.txt and http://en.wikipedia.org/wiki/Schematron#Versions) that the ISO Schematron language defines its elements in the namespace http://purl.oclc.org/dsdl/schematron while your file uses a different namespace. So perhaps you need to adapt your schema to use the ISO namespace or you need to use a different stylesheet for your schema than the ISO stylesheet.

Branny answered 5/6, 2013 at 14:51 Comment(1)
Thank you a lot! It finally worked. You are right, the namespace in my file is obsolete as it says here link. But I read it wrong and thought that it's the other way around: http://purl.oclc.org/dsdl/schematron had to be changed to http://www.ascc.net/xml/schematron. Silly me.Liederkranz

© 2022 - 2024 — McMap. All rights reserved.