{"id":238,"date":"2006-04-28T09:43:20","date_gmt":"2006-04-28T14:43:20","guid":{"rendered":"http:\/\/blog.uvm.edu\/hag\/2006\/04\/28\/convert-p4-to-p5\/"},"modified":"2006-04-28T09:43:20","modified_gmt":"2006-04-28T14:43:20","slug":"convert-p4-to-p5","status":"publish","type":"post","link":"https:\/\/blog.uvm.edu\/hag\/2006\/04\/28\/convert-p4-to-p5\/","title":{"rendered":"Convert P4 to P5"},"content":{"rendered":"<p>An XSLT stylesheet for converting P4 to P5<br \/>\n<a href=\"http:\/\/www.tei-c.org\/Activities\/META\/p4top5.xsl\">http:\/\/www.tei-c.org\/Activities\/META\/p4top5.xsl<\/a><\/p>\n<p><!--more--><br \/>\nand some additional advice, and a book recommendation from  David Sewell:<br \/>\n&gt;&gt; a) all the references to TEI element names need namespacing, ie prefixing<br \/>\n&gt;&gt; with tei:. This is hard to automate (think of \/\/p[1]\/emph[@rend=&#8217;foo&#8217;]\/@id)<br \/>\n&gt;&gt; I believe XSLT 2.0 might make a 2-in-1 stylesheet possible.<br \/>\nXSLT 2.0 has one great advantage for people wanting to adapt P4-based<br \/>\nstylesheets to P5 TEI-XML: the  element can take an<br \/>\nattribute &#8220;xpath-default-namespace&#8221; that specifies the namespace to<br \/>\nuse for unprefixed elements. So starting a stylesheet with<\/p>\n<p>eliminates the need to insert all those &#8220;tei:&#8221; prefixes. (Even if<br \/>\nprefixing can be 100% automated, unprefixed XPath is easier for human<br \/>\nreaders.)<br \/>\nIt&#8217;s true that there is (for practical purposes? or genuinely? I&#8217;m not<br \/>\nsure) just one implementation of XSLT 2.0, Michael Kay&#8217;s Saxon 8<br \/>\n(www.saxonica.com), but it&#8217;s an awfully good one, it comes in a<br \/>\nplatform-independent Java version, and the basic Saxon-B version is open<br \/>\nsource and free.<br \/>\n[begin rant] I would urge, exhortate, plead with, annoyingly evangelize<br \/>\nanyone who uses XSLT 1.0 at all heavily to learn about version 2.0. It is<br \/>\nso much more powerful that you&#8217;ll never look back once you&#8217;ve started<br \/>\nusing the new features. For the TEI community&#8217;s purposes, a lot of the<br \/>\ndifference is the vast improvement in string handling from the new<br \/>\nfunctions introduced in XPath 2.0 (which underlies both XQuery 1.0 and<br \/>\nXSLT 2.0).<br \/>\nSo much so that the best way to transition to XSLT 2, I think, would be to<br \/>\nwork through the core chapters of Michael Kay&#8217;s book &#8220;XPath 2.0:<br \/>\nProgrammer&#8217;s Reference&#8221;.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>An XSLT stylesheet for converting P4 to P5 http:\/\/www.tei-c.org\/Activities\/META\/p4top5.xsl<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16784],"tags":[],"class_list":["post-238","post","type-post","status-publish","format-standard","hentry","category-digital-humanities"],"_links":{"self":[{"href":"https:\/\/blog.uvm.edu\/hag\/wp-json\/wp\/v2\/posts\/238","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.uvm.edu\/hag\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.uvm.edu\/hag\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.uvm.edu\/hag\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.uvm.edu\/hag\/wp-json\/wp\/v2\/comments?post=238"}],"version-history":[{"count":0,"href":"https:\/\/blog.uvm.edu\/hag\/wp-json\/wp\/v2\/posts\/238\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.uvm.edu\/hag\/wp-json\/wp\/v2\/media?parent=238"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.uvm.edu\/hag\/wp-json\/wp\/v2\/categories?post=238"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.uvm.edu\/hag\/wp-json\/wp\/v2\/tags?post=238"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}