Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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
Reply With Quote
  #2 (permalink)  
Old May 15th, 2009, 01:31 AM
Friend of Wrox
Points: 1,306, Level: 14
Points: 1,306, Level: 14 Points: 1,306, Level: 14 Points: 1,306, Level: 14
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2008
Location: Pondicherry, India
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
Reply With Quote
  #3 (permalink)  
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
Reply With Quote
  #4 (permalink)  
Old May 15th, 2009, 03:37 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
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/
Reply With Quote
  #5 (permalink)  
Old May 15th, 2009, 04:51 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 02:16 PM.


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