Difference between revisions of "Category:P4toP5"

From TEIWiki
Jump to navigation Jump to search
m (Add "no whitespace before XML decl" instructions)
m
Line 8: Line 8:
 
particular aspect) would conform to P5. (Which release, you ask?
 
particular aspect) would conform to P5. (Which release, you ask?
 
Whichever one is current at the time you write the stylesheet will
 
Whichever one is current at the time you write the stylesheet will
have to do — but please document the release number in your
+
have to do
stylesheet.)  Currently there is not a full set of conversion stylesheets, so please add some!
 
 
 
== Rationale ==
 
The idea is not to build a single, monolithic stylesheet that
 
converts P4 to P5, but rather to build a long pipeline of smaller
 
transformations that will do the job. This makes division of labor
 
easier, makes debugging much easier, and permits multiple
 
possibilities for a given task (e.g., one person might write a
 
stylesheet that converts lang= to xml:lang=, and just deletes all
 
<language> elements; another might write a similar stylesheet that
 
retains <language> elements).
 
 
 
== Shell Scripts to Help Transformation ==
 
The shell script [[P4_enroute_to_P5.bash]] is provided to make it easy to execute
 
all of these in a row on a single input file.
 
For an alternative, more flexible method of executing a sequence of stylesheets one after the other, see [[PipedStylesheets.bash]].
 
 
 
== Adding Your Own Stylesheets ==
 
If you add a new stylesheet to this category, please either update [[P4_enroute_to_P5.bash]] (by adding your stylesheet to the STYLESHEETS variable before Dot-two.xslt) or ask [mailto:stylesheets@tei-c.org stylesheets@tei-c.org] to do so for you.
 
There is no need to put "P4toP5" or anything like that in the name of your stylesheet &mdash; that much is implied by its being on this page!
 
 
 
You should include the stylesheet itself inside a &lt;nowiki> element inside a &lt;pre> element. Do not put any whitespace between the &lt;pre> start-tag and the XML declaration of your stylesheet. I.e., the stylesheet itself should start with
 
<pre><nowiki>&lt;pre>&lt;nowiki>&lt;?xml ...</nowiki></pre>
 
 
 
To make your stylesheet appear in this sub-section simply include at the top of the page:
 
  <nowiki>[[Category:P4toP5]]</nowiki>
 
 
 
If your stylesheet is also of use to those doing something other than just
 
P4 to P5 conversion, you might also want to include:
 
  <nowiki>[[Category:XSLT]]</nowiki>
 
 
 
== Stylesheet Assumptions ==
 
 
 
The XSLT stylesheets available here make certain assumptions, and we should all make the same assumptions so that they inter-operate well:
 
 
 
=== Copying Existing Elements ===
 
Because all of these stylesheets need to copy all elements that they are not dealing with, you should
 
include a:
 
<nowiki><xsl:import href="Copy-All.xsl"/></nowiki>
 
at the beginning of your stylesheets -- see the existing stylesheets below for examples.  If you are going to use any of the stylesheets, then you should also download that one.
 
 
 
=== Namespaces ===
 
TEI P5 uses the http://www.tei-c.org/ns/1.0 namespace.  However, since it is more complicated to write stylesheets which cope with both possibilities of the incoming data either already being in a namespace or not, we have standardized on leaving the transfer of the elements to the TEI namespace to the final stylesheet 'Dot-two.xslt'.  This changes the TEI P4 element 'TEI.2' to 'TEI' and imports the rest of the document into the TEI namespace.  So if you are writing P4toP5 stylesheets you should output everything without a namespace, and assume the input had no namespace.
 

Revision as of 03:25, 3 June 2007


Introduction

Stylesheets in this subcategory should handle a particular aspect of P4 to P5 translation. That is, the stylesheet should expect to read in an XML instance that conforms to a P4:2004 vanilla DTD, and write out the same document with one particular aspect changed so that it (the particular aspect) would conform to P5. (Which release, you ask? Whichever one is current at the time you write the stylesheet will have to do