Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 15th, 2009, 12:10 AM
Authorized User
 
Join Date: Apr 2009
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need Saxon help!!!!

Hi all,

i'm using the xslt processor is "saxon9". How to automate to run the saxon in the command prompt due to avoid manually run... I need to convert myxml file name and outputxml file name in the same name. or convert *.xml input file.

example code:

Code:
java -jar saxon9.jar -t -s:*.xml -xsl:Sample.xsl -o:Output.xml
The above code is not working... Any one please help passing any xml file in to saxon....????

Thanks,
Nagaraj
 
Old May 15th, 2009, 01:31 AM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 291
Thanks: 9
Thanked 29 Times in 29 Posts
Thumbs up

If you want to run a single xml file then use

java -jar saxon9.jar -t 1.xml 1.xsl > 1.html

else if you want to run a batch of files then create a batch file like 1.bat, in which add multiple lines like;
java -jar saxon9.jar -t 1.xml 1.xsl > 1.html
java -jar saxon9.jar -t 2.xml 1.xsl > 2.html

And then run that 1.bat in command line.
__________________
Rummy
 
Old May 15th, 2009, 03:22 AM
Authorized User
 
Join Date: Apr 2009
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi rummy,

You suggest:

I give the list of files to be processing, that file names has to be given in the bat script. -- we avoid manual process???

Is there any other easy way to run all the xml files in that particular directory using saxon xslt processor.

Help me anybodies......

Thanks
Nagaraj
 
Old May 15th, 2009, 03:37 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

You can re-write your transformation to use the collection function to bring in the XML files that need processing. This allows you to specify just files that have the .xml extension. There are examples of this in the documentation.

Alternatively use the Saxon API, either from Java or .NET.

Finally Kernow is a GUI over Saxon, It allows processing of entire folders but I'm not sure how far you can automate it.
__________________
Joe
http://joe.fawcett.name/
 
Old May 15th, 2009, 04:51 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Firstly, questions specific to a product are best asked on the help forum for that product. Saxon has a saxon-help forum and a saxon-help mailing both accessible via the SourceForge page for the saxon project.

There are several ways you could tackle this.

(a) The Saxon command line has an option to process all files in a directory. Just specify the directory name in the -s argument (and a directory for the output in -o).

(b) Learn how to use shell programming to locate all the files in a directory and process them iteratively

(c) Write a single XSLT transformation that accesses all the files in a directory using the collection() function

(d) Write a Java application as a shell around the XSLT transformation

(e) Use Kernow, which has the ability to process multiple source files with the same stylesheet.

Note that invoking Saxon repeatedly from the command line is very inefficient: not only does it recompile the stylesheet each time, it also incurs heavy overheads in initializing the Java VM. But this may not matter to you.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Saxon Parser ravi_sri24 XSLT 7 February 8th, 2008 06:25 AM
Saxon 9.0 question ojasrege XSLT 1 November 27th, 2007 06:32 PM
error on saxon 8.8 rjonk XSLT 1 October 24th, 2006 09:03 AM
SAXON Ques dev.user06 XSLT 4 July 26th, 2006 10:44 AM
Saxon variable go4java XSLT 1 July 6th, 2006 10:12 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.