Convert P4 to P5

An XSLT stylesheet for converting P4 to P5
http://www.tei-c.org/Activities/META/p4top5.xsl


and some additional advice, and a book recommendation from David Sewell:
>> a) all the references to TEI element names need namespacing, ie prefixing
>> with tei:. This is hard to automate (think of //p[1]/emph[@rend=’foo’]/@id)
>> I believe XSLT 2.0 might make a 2-in-1 stylesheet possible.
XSLT 2.0 has one great advantage for people wanting to adapt P4-based
stylesheets to P5 TEI-XML: the element can take an
attribute “xpath-default-namespace” that specifies the namespace to
use for unprefixed elements. So starting a stylesheet with

eliminates the need to insert all those “tei:” prefixes. (Even if
prefixing can be 100% automated, unprefixed XPath is easier for human
readers.)
It’s true that there is (for practical purposes? or genuinely? I’m not
sure) just one implementation of XSLT 2.0, Michael Kay’s Saxon 8
(www.saxonica.com), but it’s an awfully good one, it comes in a
platform-independent Java version, and the basic Saxon-B version is open
source and free.
[begin rant] I would urge, exhortate, plead with, annoyingly evangelize
anyone who uses XSLT 1.0 at all heavily to learn about version 2.0. It is
so much more powerful that you’ll never look back once you’ve started
using the new features. For the TEI community’s purposes, a lot of the
difference is the vast improvement in string handling from the new
functions introduced in XPath 2.0 (which underlies both XQuery 1.0 and
XSLT 2.0).
So much so that the best way to transition to XSLT 2, I think, would be to
work through the core chapters of Michael Kay’s book “XPath 2.0:
Programmer’s Reference”.

Be Sociable, Share!
This entry was posted in Digital Humanities. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *