XSL include and schematron

Here should go questions about transforming XML with XSLT and FOP.
bohansen
Posts: 6
Joined: Thu May 24, 2012 12:34 pm

XSL include and schematron

Post by bohansen »

Hi,

I have a schematron document which runs fine in Oxygen XML, but when I try to process the same schematron using commandline I'm having trouble with XSL functions included.
I'm including a bunch of functions to the schematron like this:

Code: Select all


<xsl:include href="custom_fct.xsl"/> 
<ns prefix="fct" uri="http://custom"/>
At first I had a problem with the "xsl:include"-tag:

Code: Select all

Warning: unrecognized element xsl:include
From setting up oxygenXML I remembered I had to add "allow-foreign=true". This removed the warning, but I still get errors like:

Code: Select all


Error at xsl:when on line 194 column 53 of out_1.xsl:
XPST0017 XPath syntax error at char 0 on line 194 in {fct:func_custom(.)}:
Cannot find a matching 1-argument function named {http://custom}func_custom()
My command line looks like this:

Code: Select all


$SAXON -o:out_1.xsl -s:$SCHEMATRON_FILE \
$ISO_SCHEMATRON_DIR/iso_schematron_skeleton_for_saxon.xsl allow-foreign=true

$SAXON -o:out.results -s:$XML_FILE out_1.xsl allow-foreign=true
I'm using the reference implementation from schematron.com for XSLT2 and saxon HE 9.4.0.3. I'm also using Saxon HE in OxygenXML.

Knowing this is a little out of scope of OxygenXML, but maybe I'm missing something obvious in my conversion or the way I'm importing the functions?

Thanks in advance,
Bo
adrian
Posts: 2879
Joined: Tue May 17, 2005 4:01 pm

Re: XSL include and schematron

Post by adrian »

Hi,

I've tried your transformations with Saxon-HE 9 both in Oxygen and in the command line and they worked fine.
Make sure that the output of the first transformation (out_1.xsl) is located in the same directory as the included .XSL file (custom_fct.xsl). This is necessary because the references to the included stylesheets are relative.

Note that the last transformation does not require "allow-foreign=true".

Have you tried to open out_1.xsl in Oxygen and see if it validates?
How are you declaring and how are you using the function in the schematron file?
Can you show me code snippets for both?

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
bohansen
Posts: 6
Joined: Thu May 24, 2012 12:34 pm

Re: XSL include and schematron

Post by bohansen »

Hi,

Thanks for pointing out I can use oxygenXML to debug each step (I'm still new to xml...). It gives a better overview. It was only in the last step which failed in oxygenXML also. Looking more closely at the error messages reveals the embarrasing fact that the XSL-file with the custom functions was not in sync on my test machine having the commandline tools installed :oops:.

It's working fine now, thanks again.

Best regards,
Bo
Post Reply