[xsl] dates, databases, and multiple file outputs

Subject: [xsl] dates, databases, and multiple file outputs
From: Zack Brown <zbrown@xxxxxxxxxxxxx>
Date: Tue, 2 Jan 2001 21:03:04 -0800 (PST)

Thanks for all the help on my previous questions. Now I'm back with more...

I'm using the XML::XSLT perl module under Linux, reading the XSL, XSLT, and
XPath specs, and it looks as though I'll be able to accomplish almost
everything I want to, with a couple exceptions. I'm hoping someone will show
me how I'm wrong.

1) Dates. I have many input files, written by many different people across
the world, with <tag date=""> information using many different date formats.
More files are coming in, and it is not likely that these files will ever
standardize on one particular date format for these attributes, just because
of the way the files are created. I would like to translate these dates with
the parser, so that the output always uses one particular standard form if
the date is from the current year, and another particular standard form if
the date is from any other year. There already exists a perl module to do
those translations. As far as I can see, the way to do this in XSLT is to
extend XSLT by adding a function to the parser, to perform the necessary
parsing and translating of date formats. Is there any other way to do this
without extending the parser?

2) Databases. I have many input files with tags containing text that
includes names of people. These names are not wrapped in any tags, but sit
within blocks of text. Many of these people are included in a Postgres
database. What I want to do is to wrap all the names of people included in
the database, with an <a href=""></a> tag to link them to index files
containing more information about each of those people, but to do this I
need to (a) access the database to get the list of names, (b) search for
each of those names in the blocks of text, and (c) perform the
transformation using the data from the database. Again, it looks to me like
the only way to do this is to extend XSLT in the parser, by adding a
function according to the rules of extending XSLT.

3) multiple file output. This is actually less important, because I can work
around it by processing files twice. But multiple file output would be the
most natural solution to the problem. The problem is that, given a news file
in XML - i.e. a file containing news items dating back to some point in time
- I want to create one output file for recent items, and one output file for
older items. I don't see a way to do this without another XSLT function

So, if I'm not wrong about needing these function extensions, it seems like
XML::XSLT may not be the best tool, and I should be looking for something
that enables me to add those new functions as easily as possible.

Have I missed something?


Zack Brown, Linuxcare, Inc.
tel: 1-415-354-4878x284, fax: 1-415-701-7457
zbrown@xxxxxxxxxxxxx, http://www.linuxcare.com/
Linuxcare. Support for the revolution.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread