Author: sjur
Date: Wed Dec  9 12:49:25 2009
New Revision: 888789

URL: http://svn.apache.org/viewvc?rev=888789&view=rev
Log:
FO contract to add document version info based on $Revision tag.

Added:
    
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/themer/themes/common/fo/content-version.contract.xml
   (with props)

Added: 
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/themer/themes/common/fo/content-version.contract.xml
URL: 
http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/themer/themes/common/fo/content-version.contract.xml?rev=888789&view=auto
==============================================================================
--- 
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/themer/themes/common/fo/content-version.contract.xml
 (added)
+++ 
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/themer/themes/common/fo/content-version.contract.xml
 Wed Dec  9 12:49:25 2009
@@ -0,0 +1,74 @@
+<?xml version="1.0"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<forrest:contract
+  xmlns:i18n="http://apache.org/cocoon/i18n/2.1";
+  xmlns:forrest="http://apache.org/forrest/templates/1.0";
+  name="content-version">
+  <description>
+    <p>
+      content-version will output the version of the document.
+    </p>
+  </description>
+  <usage>
+<![CDATA[<forrest:contract name="content-version" 
dataURI="cocoon://#{$getRequest}.version.xml"/>]]>
+  </usage>
+  <forrest:template
+    xmlns:forrest="http://apache.org/forrest/templates/1.0";
+    name="content-version" inputFormat="xsl">
+    <xsl:stylesheet
+      xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
+      xmlns:fo="http://www.w3.org/1999/XSL/Format";
+      version="1.0">
+      <xsl:param name="defaultVariables" select="'test.html'"/>
+      <xsl:param name="sans-serif" 
select="$defaultVariables/*/*...@name='output.pdf.fontFamily.sansSerif']/@value"
 />
+      <xsl:param name="versionFontFamily">
+        <xsl:choose>
+          <xsl:when 
test="$defaultVariables/*/*...@name='output.pdf.fontFamily.versionFontFamily']">
+            <xsl:value-of 
select="$defaultVariables/*/*...@name='output.pdf.fontFamily.versionFontFamily']/@value"/>
+          </xsl:when>
+          <xsl:otherwise><xsl:value-of select="$sans-serif"/></xsl:otherwise>
+        </xsl:choose>
+      </xsl:param>
+      <xsl:include href="lm://pdf.transform.helper.pageBreaks" />
+      <xsl:template match="/">
+        <forrest:content>
+          <forrest:part xpath="/fo/xsl-region-body/title">
+            <fo:block
+              font-family="{$versionFontFamily}"
+              font-weight="bold"
+              font-size="smaller">
+              <xsl:call-template name="insertPageBreaks"/>
+              <xsl:apply-templates select="@major"/>
+              <xsl:apply-templates select="@minor"/>
+              <xsl:apply-templates select="@fix"/>
+              <xsl:apply-templates select="@tag"/>
+              <xsl:choose>
+                <xsl:when test="starts-with(., '$Revision: ')">
+<!-- insert i18n stuff here --> Version <xsl:value-of select="substring(., 12, 
string-length(.) -11-2)"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:value-of select="."/>
+                </xsl:otherwise>
+              </xsl:choose>
+            </fo:block>
+          </forrest:part>
+        </forrest:content>
+      </xsl:template>
+    </xsl:stylesheet>
+  </forrest:template>
+</forrest:contract>

Propchange: 
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/themer/themes/common/fo/content-version.contract.xml
------------------------------------------------------------------------------
    svn:eol-style = native