473,498 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XSL generating a summary of several files

I have a directory which contains many xml files as a result of some
analysis. I would like to have an XSL which loops over all these files
and generates a web page indicating some summary information from each
one of these files.

Is there any way of doing this in XSLT entirely, or am I forced to go to
perl/python for this kind of task? I am aware of the "document" command
in xsl but cannot see how to pipe it a whole series of files such that
one transform can loop over them.

The files all have a similar name, like JiveXML_runNumber_eventNumber.xml

cheers
shaun
May 21 '06 #1
4 1288


shaun roe wrote:
I have a directory which contains many xml files as a result of some
analysis. I would like to have an XSL which loops over all these files
and generates a web page indicating some summary information from each
one of these files.

Is there any way of doing this in XSLT entirely, or am I forced to go to
perl/python for this kind of task? I am aware of the "document" command
in xsl but cannot see how to pipe it a whole series of files such that
one transform can loop over them.


You need to pass the file names to the document function so if you have
a static list of file names you can simply code them inside of the
stylesheet. If the list of file names is not static then you could use
some programming language like Perl or Python to create an XML document
with the file names and read that document in with the XSLT document
function.
--

Martin Honnen
http://JavaScript.FAQTs.com/
May 21 '06 #2
Martin Honnen wrote:


shaun roe wrote:
I have a directory which contains many xml files as a result of some
analysis. I would like to have an XSL which loops over all these files
and generates a web page indicating some summary information from each
one of these files.

Is there any way of doing this in XSLT entirely, or am I forced to go
to perl/python for this kind of task? I am aware of the "document"
command in xsl but cannot see how to pipe it a whole series of files
such that one transform can loop over them.


You need to pass the file names to the document function so if you have
a static list of file names you can simply code them inside of the
stylesheet. If the list of file names is not static then you could use
some programming language like Perl or Python to create an XML document
with the file names and read that document in with the XSLT document
function.


Or perhaps write 2-3 lines of {your favourite scripting language} to
output the list of filenames you want to process into a temporary XML
file, eg

<files>
<file>foo.xml</file>
<file>bar.xml</file>
...
</files>

Then access that from within your XSLT program using document().

///Peter
--
XML FAQ: http://xml.silmaril.ie/
May 21 '06 #3
Or, if you don't want to generate a "script" file, pass in a list of
files as a stylesheet parameter and do the string processing necessary
to parse it into separate filenames/URIs you can call document() on.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
May 21 '06 #4
If you use Saxon 8 then you can use the collection funtion to process
the files from a directory. For example the following stylesheet

<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<result>
<xsl:for-each select="collection('.?recurse=no;select=*.xml')">
<xsl:copy-of select="."/>
</xsl:for-each>
</result>
</xsl:template>
</xsl:stylesheet>

copies all the XML files content from the current directory inside a
"result" element.

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

May 22 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1232
by: R.A.M. | last post by:
Hello, I am learning .NET 2.0. I need to learn how to create documentation from /// comments. I downloaded sample project XMLsample from Web and I generated XML documentation XMLsample.xml: ...
0
7121
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7162
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7375
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4899
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4584
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1411
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
650
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
287
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.