TEI XML and XSL

J

JLP

Hello everyone,

I'm new to XML/XSL.

The situation:
I have about 150 XML files in TEI and they are valid.

The Goal:
I want to output the title and author of these files in one location.
I can very easily write XSL that will do work for one file, but I
really need kind of a bibliography or manifest that details each file.
The information is there, it's just a matter of how I can get to it!

I thought about using document() in conjunction with javascript. The
trouble is that I'm not sure if this will work. My initial idea was to
create an XML manifest file and link that to XSL and do the
transformation that way.

Ideally this would be done in a platform independent manner and would
work server-side as it may be put to use in a website soon.

Can someone please comment on how this might be accomplished?

Thank you!

Jeremy
 
?

=?ISO-8859-1?Q?J=FCrgen_Kahrs?=

JLP said:
I want to output the title and author of these files in one location.
I can very easily write XSL that will do work for one file, but I
really need kind of a bibliography or manifest that details each file.
The information is there, it's just a matter of how I can get to it!

Use an ordinary script languag.
The standard Unix shell (Bourne shell) is quite good
at going over a long list of files in a directory
and initiating a process to read each file.

for i in *xml do
# the following may be an invokation of an XSL processor
my_tool $i
done | process_summary_of_all_files
 
J

JLP

Well, I'm running on Windows so I think a UNIX script will not work
for me! I can use javascript--the trouble is that I don't know if it
is possible to generate xml like this then transform it.

What I think would work is the following:

1. Create an xml document that includes a script to get all the files
as required. Can I include a script in an xml file?

2. Write a transform to format and display the above xml file

I'm not sure how transforms are executed. Is it the xml is transformed
then scripts on the page are run, or they other way round?

Thanks!

Jeremy
 
M

Martin Honnen

JLP wrote:

The situation:
I have about 150 XML files in TEI and they are valid.

The Goal:
I want to output the title and author of these files in one location.
I can very easily write XSL that will do work for one file, but I
really need kind of a bibliography or manifest that details each file.
The information is there, it's just a matter of how I can get to it!

XSLT 1.0 can process multiple XML files, use the document() function to
access those files
http://www.w3.org/TR/xslt#document
 
?

=?ISO-8859-1?Q?J=FCrgen_Kahrs?=

JLP said:
Well, I'm running on Windows so I think a UNIX script will not work
for me! I can use javascript--the trouble is that I don't know if it
is possible to generate xml like this then transform it.

MS-DOS had a batch language (autoexec.bat etc).
MS Windows should also have a similar batch/script language.
If you install Cygwin, you can indeed run Unix scripts like this:
 
J

JLP

Can you or anyone else elaborate on this? I like the idea of using the
document() function. The contents of the directory will change over
time and I'd like to not have to constantly edit a document to make
sure it matches the contents. I was thinking that I could write a
script to generate the xml and link it to an xsl and do the transform
for presentation. Can I do that?

Thanks!

Jeremy
 
M

Mikhail Grouchinsky

Take a look at this utility called XmlStarlet (http://xmlstar.sourceforge.net/).
It works on Windows and includes all the features you need
to perform the task you described (including listing directory as XML
in case if you decide writting one XSLT and use document() function in
it to process each file individually).

Or you could just use XmlStarlet's 'select' option.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top