Moving to saxon9

40 views
Skip to first unread message

Chris Maloney

unread,
Oct 7, 2012, 10:33:10 PM10/7/12
to dtdan...@googlegroups.com
Hi, Demian,

Maybe you can help, I'm just a little bit stuck, but I have the feeling this should be very easy, and I'm missing something simple.  I was trying to move our code to saxon9he.jar instead of saxon.jar (version 6) so that we can use XSLT 2, and it is not working.  

I tried just switching to the new jar file in CLASSPATH, but it didn't change the symptoms at all.  When I execute this from the test/split-example directory (both with saxon.jar and saxon9he.jar):
    dtdanalyzer -s split-example.dtd -m -x ../../xslt/dtddocumentor.xsl 
I get "Unknown system function: format-date()"

Now, I am confused, because I just discovered that if I delete both saxon.jar and saxon9he.jar from the lib directory, that the XSLT 1.0 transformations are still working.  For example, I can still run the "identity.xsl" transform with this:
    dtdanalyzer -s split-example.dtd -m -x ../../xslt/identity.xsl 

So, is the Java using something other than Saxon for the XSLT transform?  Maybe it depends on my installation (although, as I said, I've tried it in two different places, with the exact same results).  If so, how can we force it to use saxon?

Any ideas?
Thanks,
Chris

Chris Maloney

unread,
Oct 7, 2012, 11:10:59 PM10/7/12
to dtdan...@googlegroups.com
Never mind!  I figured it out -- something simple, as I expected.  I just needed to change the TRANSFORMER_FACTORY_DEFAULT value in DtdAnalyzer.java.  That's done now, and I added the newer saxon9he.jar to the lib directory and updated the setenv scripts, and committed everything.  

So you can now run the documentor from within the dtdanalyzer with the "-x" option.

Dave Pawson

unread,
Oct 8, 2012, 6:45:06 AM10/8/12
to dtdan...@googlegroups.com
On 8 October 2012 03:33, Chris Maloney <vold...@gmail.com> wrote:
> Hi, Demian,
>
> Maybe you can help, I'm just a little bit stuck, but I have the feeling this
> should be very easy, and I'm missing something simple. I was trying to move
> our code to saxon9he.jar instead of saxon.jar (version 6) so that we can use
> XSLT 2, and it is not working.
>
> I tried just switching to the new jar file in CLASSPATH, but it didn't
> change the symptoms at all. When I execute this from the test/split-example
> directory (both with saxon.jar and saxon9he.jar):
> dtdanalyzer -s split-example.dtd -m -x ../../xslt/dtddocumentor.xsl
> I get "Unknown system function: format-date()"

Have you changed the class you call?
net.sf.saxon.Transform

>
> Now, I am confused, because I just discovered that if I delete both
> saxon.jar and saxon9he.jar from the lib directory, that the XSLT 1.0
> transformations are still working.

> So, is the Java using something other than Saxon for the XSLT transform?

If you have a standard Sun java install, then the apache xslt engine
is available,
which won't have the format-date() function, being xslt 1.0
btw, you don't want the function: prefix in place

I use
cp=/myjava/saxon9he.jar:/myjava:/myjava/xercesImpl.jar

java -Xmx1200m -cp ${cp}:. net.sf.saxon.Transform -xi
-x:org.apache.xerces.parsers.SAXParser -o:$3 -s:$1 -xsl:$2 $4 $5 $6
$7

clearly change the classpath to suite your environment

HTH


--
Dave Pawson
XSLT XSL-FO FAQ.
Docbook FAQ.
http://www.dpawson.co.uk

Demian Hess

unread,
Oct 8, 2012, 7:36:24 AM10/8/12
to dtdan...@googlegroups.com
just saw this thread and looks like you sussed it!

On Sun, Oct 7, 2012 at 10:33 PM, Chris Maloney <vold...@gmail.com> wrote:

--
You received this message because you are subscribed to the Google Groups "DtdAnalyzer" group.
To post to this group, send email to dtdan...@googlegroups.com.
To unsubscribe from this group, send email to dtdanalyzer...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/dtdanalyzer?hl=en.



--
Demian Hess

Avalon Consulting, LLC
527 Maple Avenue East, Suite 200, Vienna, VA 22180

Mobile: 301-943-8307
Fax: 845-367-5496
he...@avalonconsult.com



Chris Maloney

unread,
Oct 8, 2012, 12:13:28 PM10/8/12
to dtdan...@googlegroups.com
Hi, Dave,

Thanks for this feedback!  Yes, in effect, I changed the class of the transformer factory in the code, with:
    public static final String TRANSFORMER_FACTORY_DEFAULT = 
        "net.sf.saxon.TransformerFactoryImpl";     

Does it look reasonable?

Chris

Dave Pawson

unread,
Oct 9, 2012, 2:41:17 AM10/9/12
to dtdan...@googlegroups.com
On 8 October 2012 17:13, Chris Maloney <vold...@gmail.com> wrote:
> Hi, Dave,
>
> Thanks for this feedback! Yes, in effect, I changed the class of the
> transformer factory in the code, with:
> public static final String TRANSFORMER_FACTORY_DEFAULT =
> "net.sf.saxon.TransformerFactoryImpl";
>
> Our script to run the tool is here:
> https://github.com/NCBITools/DtdAnalyzer/blob/master/dtdanalyzer.
> Does it look reasonable?
>
> Chris


Yes... couple of comments.
You rely on log4j yet don't check for the jar (minor)
Is 1GB reasonable with a system which may be 'small' by todays standard?
How big are DTD's today?
Perhaps something smaller?

if [ ! -e "$jar" ]; then continue; fi
If a jar file obtained by the for statement doesn't exist?
Is this line redundant? The for statement will terminate after the jar
by default?

Chris Maloney

unread,
Oct 9, 2012, 9:58:29 PM10/9/12
to dtdan...@googlegroups.com
Thanks!  I changed the heap sizes to 256M (which was plenty for one of our JATS DTDs, which are quite large), and removed that redundant line.

I copied and hacked these from https://github.com/d2rq/d2rq, and never really looked at them closely.

Cheers!

Reply all
Reply to author
Forward
0 new messages