Re: [xsl] Is there a better way to produce a single html via XSLT from multiple xml files ?

Subject: Re: [xsl] Is there a better way to produce a single html via XSLT from multiple xml files ?
From: Kamal <kbhatt@xxxxxxxxx>
Date: Sun, 23 Mar 2008 12:10:35 +1100
Z W wrote:
Kamal
Thanks for your answers. The stuff I need to get done is somewhat more
complicated
than what I posted here. With sleepless night, experimenting, I think
I made some
progress before I got your response. But I'm still stuck at this problem.

How do I make an ant <xslt> call that accepts 2 different input xml
files in different directories
such that the xsl could know which file with for-each to perform calculations.


Inside y.xsl <xsl:for-each select="/testResults/*[not(@label = preceding::*/@label)]">

From Ant x.xml file
<xslt style="detail.xsl"
	  		in="C:\test_report\test_input_3.jtl"
	  		destdir="C:\test_report"
	  		basedir="C:\test_report"
	  		out="C:\test_input_3.html" 		
	  		force="true">
			<param name="currentJTL" expression="C:\test_report\test_input_3.jtl"/>
			<param name="previousJTL" expression="C:\test_input.jtl"/>
			<param name="curBuildVersion" expression="${currentBuildVersion}"/>
			<param name="pBuildVersion" expression="${previousBuildVersion}"/>
			<param name="latestDir" expression="${Detail_latestTPSDir}"/>
			<classpath location="C:\apache-ant-1.7.0\lib\saxon9.jar" />

Is there a way where I could include with for-each specifying to
include a specific file.
I want to make use of currentJTL and previousJTL as you can see above
in Ant xml file but
the xsl could only interpret file from in="C:\test_report\test_input_3.jtl".

How do I do what you suggested earlier ?
If I understand correctly, you want to query on currentJTL and previousJTL. You had code that did that (using document). What you may have been missing is the <xsl:param name="currentJTL"/> and <xsl:param name="previousJTL"/> at the start of your file. Before you define any templates, put those values in the file. As you are using absolute path, this should work.

Alternatively, you can combine all three files into a mega XML file, but that is probably not what you need.
b) Because of (a), I thought I should make 2 separate calls to the
same xls for the 2 xml files, whose outputs are html files
But this create the problem to find a way to combine these 2 html files.

Is there a better way to do this - ie could I just use a single xsl
and produce results from 2 different xml inputs
I have also posted an earlier question about min, max problem.

Thank you very much for your help.


In one of your other posts, you mention you are using Ant.

My recommendation here (if it is still relevant) is to not try and combine two HTML outputs, but combine the inputs. You mentioned using Ant, I would have a two pass process, first pass combines the two files into one, the second parse does whatever you really want to do. I do something similar with XSDs. It shouldn't be too hard to do. As I said, don't know if you need to actually do that.

Current Thread