473,756 Members | 2,703 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_runNumb er_eventNumber. xml

cheers
shaun
May 21 '06 #1
4 1304


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:styleshe et version="2.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<result>
<xsl:for-each select="collect ion('.?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
1249
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: <?xml version="1.0"?> <doc> <assembly> <name>XMLdoc</name> </assembly>
0
9844
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9819
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9689
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8688
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7226
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5119
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5289
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3326
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2647
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.