Sebastian Rahtz wrote:
> Maybe its time for sharing Cocoon tricks on here - can
> anyone show me how to support TEI P4 and TEI P5 documents in
> the same directory, both with the .xml extension? I want to
> call different stylesheets depending on which version of the
> TEI the document is written in.
That's not very convenient in Cocoon is it? :-)
IIUC it was a conscious design decision of the Cocoon developers to
discourage the entire pattern where a processing pipeline is determined
by the source content, like when you have XML processing-instructions in
the source. There are ways to do it, of course, but they're not pretty.
You can use XSLT to transform a TEI document into an xinclude statement
with a new URI (part of which identifies what version of TEI it is),
then you just perform the xinclude, dereferencing the URI and invoking
the corresponding version-specific pipeline.
More Cocoon-friendly, if you can do it, is to keep the different
versions in different folders, or to use distinct file extensions, or
something, so you can refer to the different-version TEI files with
distinct URIs. e.g.
foo.p4
bar.p4
baz.p5
If you need to compose 2 pipelines for distinct versions of TEI into a
single pipeline that presents both versions, you can use the
ResourceExistsAction or the ResourceExistsSelector in the sitemap to
determine what version files are available.
http://wiki.apache.org/cocoon/ResourceExistsAction?highlight=resource-ex
ists
http://wiki.apache.org/cocoon/ResourceExistsSelector?highlight=resource-
exists
... or you can use javascript to see what files are available, and
invoke the correct pipeline. If your pipelines are already
javascript-controlled then this would be convenient, otherwise I'd just
use the ResourceExists stuff as above, and keep all the processing logic
in the sitemap.
|