« Educause Online | Main | Sarah and Friend »
April 28, 2006
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
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".
Posted by hag at April 28, 2006 9:43 AM
Comments
Post a comment
Thanks for signing in, . Now you can comment. (sign out)
(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)