p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > XML > XSLT
I forgot my password Register Now
Register | FAQ | Members List | Calendar | 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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 15th, 2009, 01:10 AM
Authorized User
Points: 130, Level: 2
Points: 130, Level: 2 Points: 130, Level: 2 Points: 130, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old May 15th, 2009, 02:31 AM
Friend of Wrox
Points: 949, Level: 11
Points: 949, Level: 11 Points: 949, Level: 11 Points: 949, Level: 11
Activity: 20%
Activity: 20% Activity: 20% Activity: 20%
 
Join Date: Jun 2008
Location: Pondicherry, India
Posts: 205
Thanks: 9
Thanked 22 Times in 22 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old May 15th, 2009, 04:22 AM
Authorized User
Points: 130, Level: 2
Points: 130, Level: 2 Points: 130, Level: 2 Points: 130, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old May 15th, 2009, 04:37 AM
joefawcett's Avatar
Wrox Author
Points: 8,994, Level: 40
Points: 8,994, Level: 40 Points: 8,994, Level: 40 Points: 8,994, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 2,922
Thanks: 0
Thanked 13 Times in 12 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #5 (permalink)  
Old May 15th, 2009, 05:51 AM
mhkay's Avatar
Wrox Author
Points: 12,735, Level: 48
Points: 12,735, Level: 48 Points: 12,735, Level: 48 Points: 12,735, Level: 48
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 3,923
Thanks: 0
Thanked 82 Times in 80 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

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 10:03 AM
SAXON Ques dev.user06 XSLT 4 July 26th, 2006 11:44 AM
Saxon variable go4java XSLT 1 July 6th, 2006 11:12 AM



All times are GMT -4. The time now is 02:53 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc