basic xsl:result-document problem
Added by Anonymous over 15 years ago
Legacy ID: #7557413 Legacy Poster: Jerzy Jalocha N (jjalocha)
Hi, eveyone. I am very sorry to post such a basic issue, but I feel like I've been hitting my head against a wall since Monday with this. I guess it's a basic noob error, but I've tried everything, and searched all over the manual/documentation/web without success. So please, bear with me. I am trying to use the Saxon Basic XSLT 2.0 processor with xsl:result-document to output to different files. But I just can't get to work a basic example. Here are two examples: Test 1 ========== $ saxonb-xslt -t -o:out -xsl:test.xsl -s:test.xml Saxon 9.0.0.4J from Saxonica Java version 1.6.0_14 Output is a directory, but input is not 'out' is an existing directory. That's where I want the new files to go. According to the manual the -o option is the right place for specifying this. The manual also mentions a constraint about the -o and -s options. When -s is a directory, -o must be a directory, too --that makes sense. But no mention about the other way around (which wouldn't make sense to me): "When -s identifies a directory, also -o should identify one. All the output documents will then be written under such a directory." ??? Test 2 ========== $ saxonb-xslt -xsl:test.xsl -s:test.xml Error at xsl:result-document on line 5 of file:/home/jerzy/xml/tests/test.xsl: xsl:result-document is disabled when extension functions are disabled Failed to compile stylesheet. 1 error detected. As far as I know, I didn't disable any functions. I haven't been able to discover in the manual or in the documentation how to enable them. From what I understand, 'saxonb' conforms as a basic XSLT processor, and from what I understand in the XSLT specification, xsl:result-document is part of the basic spec. ??? Files ========== test.xsl <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="value"> <xsl:result-document href="something.xml"> <test> <xsl:value-of select="."/> </test> </xsl:result-document> </xsl:template> </xsl:stylesheet> test.xml <?xml version='1.0' encoding='UTF-8'?> <data> <value>A1</value> <value>B1</value> <value>C1</value> <value>A2</value> <value>B2</value> <value>C2</value> </data> System ========== Vanilla libsaxon-java from Ubuntu 9.04 Jaunty Jackalope repositories. (version 9.0.0.4) Not sure about Java, because there are so many installed. But -t option gives 1.6.0_14.
Replies (4)
Please register to reply
RE: basic xsl:result-document problem - Added by Anonymous over 15 years ago
Legacy ID: #7557436 Legacy Poster: Michael Kay (mhkay)
Test 1: if -s specifies a single input file, then -o should specify the principal output file (the destination for output produced when no xsl:result-document is active. If there isn't any such output, try -o:out/dummy.xml. Note that the -t option will tell you where the output files have been written. Test 2: I'm puzzled by this one. But I can't see what options the script saxonb-xslt is setting - you haven't shown us the actual call to Saxon (this script is not part of the Saxon product. I've no idea what "Jaunty Jackalope" is, or how it might have packaged Saxon up. My suspicion is that the script is setting the -noext option which disables use of extension functions and result-document for security reasons.
RE: basic xsl:result-document problem - Added by Anonymous over 15 years ago
Legacy ID: #7557466 Legacy Poster: Jerzy Jalocha N (jjalocha)
Test 1: You are right, -o:out/dummy.xml gets accepted. I guess, that the output would be sent to the 'out' directory now, as desired. Test 2: I am sorry, the 'saxonb-xslt' is a script implemented and shipped by Debian. They also created the manual pages I was referring to. Strangely, the script looks very 'plain': #!/bin/sh exec java -classpath /usr/share/java/saxonb.jar net.sf.saxon.Transform "$@" Thank you, Michael for the prompt reply! -Jerzy
RE: basic xsl:result-document problem - Added by Anonymous over 15 years ago
Legacy ID: #7557517 Legacy Poster: Michael Kay (mhkay)
I'm surprised that it is "saxonb.jar" rather than "saxon9.jar". I wonder if they've changed the JAR file? I can't think why they should do so, but I can't think of any other explanation. Try setting -ext:on on the command line. If that fails, could I ask you to try it with Saxon as downloaded directly from sourceforge?
RE: basic xsl:result-document problem - Added by Anonymous over 15 years ago
Legacy ID: #7557559 Legacy Poster: Jerzy Jalocha N (jjalocha)
Michael, I was just testing the official sourceforge download, and it works perfectly. I will keep using this one, now. The -ext:on option does finally process the example as expected with the Debian version. I've already filed a bug report for Ubuntu (https://bugs.launchpad.net/ubuntu/+source/saxonb/+bug/412517). Now I'll correct it and add this new info. Thank you very much for your kind help! Regards, Jerzy
Please register to reply