forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgard...@apache.org
Subject svn commit: r698383 - in /forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.tei: output.xmap resources/stylesheets/document-to-teiLite.xsl src/documentation/content/xdocs/index.xml
Date Tue, 23 Sep 2008 22:48:10 GMT
Author: rgardler
Date: Tue Sep 23 15:48:10 2008
New Revision: 698383

URL: http://svn.apache.org/viewvc?rev=698383&view=rev
Log:
Add properties for configuring optional items in TEI output. Thanks to Pablo Barerra, FOR-1111
and FOR-1113

Modified:
    forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.tei/output.xmap
    forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.tei/resources/stylesheets/document-to-teiLite.xsl
    forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.tei/src/documentation/content/xdocs/index.xml

Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.tei/output.xmap
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.tei/output.xmap?rev=698383&r1=698382&r2=698383&view=diff
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.tei/output.xmap (original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.tei/output.xmap Tue
Sep 23 15:48:10 2008
@@ -21,12 +21,17 @@
 
   <map:pipeline>
 
-    <map:match pattern="**.tei">      
-        <map:generate src="cocoon://{1}.xml"/>
-        <map:transform src="{lm:tei.transform.document.teiLite}"/>
-        <map:serialize type="xml"/>
+    <map:match pattern="**.tei">
+      <map:aggregate element="site">
+        <map:part src="cocoon://module.properties.properties"/>
+        <map:part src="cocoon://{1}.xml"/>
+      </map:aggregate>
+      <map:transform src="{lm:tei.transform.document.teiLite}"/>
+      <map:serialize type="xml"/>
     </map:match>  
+
   </map:pipeline>
+
 </map:pipelines>
 
 </map:sitemap>

Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.tei/resources/stylesheets/document-to-teiLite.xsl
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.tei/resources/stylesheets/document-to-teiLite.xsl?rev=698383&r1=698382&r2=698383&view=diff
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.tei/resources/stylesheets/document-to-teiLite.xsl
(original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.tei/resources/stylesheets/document-to-teiLite.xsl
Tue Sep 23 15:48:10 2008
@@ -1,9 +1,19 @@
 <?xml version='1.0'?>
-<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
-  xmlns:datetime="http://exslt.org/dates-and-times"
-  version='1.0'>
+<xsl:stylesheet
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:datetime="http://exslt.org/dates-and-times"
+    xmlns:prop="http://apache.org/forrest/properties/1.0"
+    version="1.0">
+
+  <xsl:variable
+        name="properties"
+        select="//prop:properties" />
+
+  <xsl:variable
+        name="reference-section"
+        select="$properties/*[@name='output.tei.reference-section']/@value" />
 
-  <xsl:template match='document'>
+  <xsl:template match='/'>
     <xsl:text disable-output-escaping="yes">
   <![CDATA[
   <!DOCTYPE TEI.2 PUBLIC "-//TEI//DTD TEI Lite 1.0//EN" "">
@@ -11,7 +21,7 @@
 </xsl:text>
     
     <TEI.2>
-      <xsl:apply-templates />
+      <xsl:apply-templates select="/site/document" />
     </TEI.2>
   </xsl:template>
 
@@ -25,14 +35,20 @@
         </titleStmt>
 
         <publicationStmt>
-          <publisher>OSS Watch, Oxford University</publisher>
-          <authority>OSS Watch</authority>
+          <publisher>
+            <xsl:value-of select="$properties/*[@name='output.tei.publisher']/@value"/>
+          </publisher>
+          <authority>
+            <xsl:value-of select="$properties/*[@name='output.tei.authority']/@value"/>
+          </authority>
           <address>
-            <email>info@oss-watch.ac.uk</email>
+            <email>
+              <xsl:value-of select="$properties/*[@name='output.tei.email']/@value"/>
+            </email>
           </address>
           <availability>
             <licence>
-              http://creativecommons.org/licenses/by-sa/2.0/uk/
+              <xsl:value-of select="$properties/*[@name='output.tei.licence']/@value"/>
             </licence>
           </availability>
           <date><xsl:value-of select="datetime:date()"/></date>
@@ -59,6 +75,11 @@
     <text>
       <body>
         <xsl:apply-templates />
+        <xsl:choose>
+          <xsl:when test="$reference-section = 'true'">
+            <xsl:call-template name="references"/>
+          </xsl:when>
+        </xsl:choose>
       </body>
     </text>
   </xsl:template>
@@ -132,4 +153,23 @@
     </xsl:choose>
   </xsl:template>
 
+  <!-- FIXME: add parameter to remove this field, remove duplicates, remove mailto field
-->
+  <xsl:template name="references">
+    <div>
+      <head>References</head>
+      <ul>
+        <xsl:for-each select="//link">
+          <xsl:sort select ="."/>
+          <li>
+            <a>
+              <xsl:attribute name="href">
+                <xsl:value-of select="@href"/>
+              </xsl:attribute>
+              <xsl:value-of select="."/>
+            </a>
+          </li>
+        </xsl:for-each>
+      </ul>
+    </div>
+  </xsl:template>
 </xsl:stylesheet>

Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.tei/src/documentation/content/xdocs/index.xml
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.tei/src/documentation/content/xdocs/index.xml?rev=698383&r1=698382&r2=698383&view=diff
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.tei/src/documentation/content/xdocs/index.xml
(original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.tei/src/documentation/content/xdocs/index.xml
Tue Sep 23 15:48:10 2008
@@ -27,6 +27,33 @@
       <p>See <a href="http://en.wikipedia.org/wiki/Text_Encoding_Initiative">Text
Encoding Initiative (TEI)</a>.</p>
     </section>
     
+    <section id="config">
+      <title>How to configure the plugin</title>
+      <p>The plugin reads some proporties to control some of the variables
+       at the output, as the publisher name or the contact email. The complete
+       list of properties and their default value could be found at
+       default.plugin.properties.xml into the plugin directory. At the moment
+       the properties are:</p>
+      <ul>
+        <li>output.tei.publisher</li>
+        <li>output.tei.authority</li>
+        <li>output.tei.email</li>
+        <li>output.tei.licence</li>
+      </ul>
+      <p>The variables could be modified in the forrest.properties.xml file.
+      Those variables are automatically included in TEI field, in the
+      <em>publicationStmt</em> section.</p>
+    </section>
+    <section id="referenceslist">
+      <title>List of references</title>
+      <p>Optionally the TEI output file could include a list of references at
+      the end. This section includes all the references in the text and present
+      them as a list sorted alphabetically. To enable this option it is necessary
+      to add this line to your forrest.properties.xml file:</p>
+      <source><![CDATA[
+<property name="output.tei.reference-section" value="true"/>
+]]></source>
+    </section>
     <section id="samples">
       <title>Samples</title>
       <p>This section includes links to a number of samples using this plugin. The



Mime
View raw message