• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Transforming multiple XML/XHTML/HTML file with XSLT using Java (JAXP)

 
Rahul Divedi
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to take multiple input files (XML/HTML/XHTML) and corresponding XSLT to produce the output file for the corresponding Input file. If there is only one input XML file and one input XSLT file then from the following program I'm able to transform it successfully. E.g In the give program my input (X)HTML file is temp.html, input XSLT is temp.xsl which produces the output as temp_copy.html. What would be the best way if I have two or more input files temp1.html and temp2.html and corresponding XSLT temp1.xsl and temp2.xsl, then how can I generate the output temp1_copy.html and temp2_copy.html by using the corresponding input files? Thanking you!

 
Paul Clapham
Sheriff
Posts: 20980
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have two separate transformations, with separate input and output documents?

Then do the first transformation and then do the second transformation.

Or have I misunderstood something?
 
Rahul Divedi
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:You have two separate transformations, with separate input and output documents?

Then do the first transformation and then do the second transformation.

Or have I misunderstood something?


Thanks for the reply. Well, yes I have actually more than one (currently 3) tranformations with separate input and output. So I'm looking for the most precise way to it by executing single program. I have read that it can be achieved by compiling the style sheet with TransformerFactory.newTemplates() and using that template object repeatedly to transform multiple source documents and also using Templates.newTransformer() but I don't have
deep knowledge about this so unable to achieve this. Please help me out in this. Thanking you!
 
Paul Clapham
Sheriff
Posts: 20980
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, yes, you could do that. But it isn't compulsory. You could just take the code you already have and repeat it three times. Or write a loop. There is a trivial solution to your question and a complicated one. Use the trivial one until you find it's unsatisfactory.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic