473,241 Members | 1,608 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,241 software developers and data experts.

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 1283


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
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
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...

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.