You are viewing a plain text version of this content. The canonical link for it is here.
Posted to svn@forrest.apache.org by bd...@apache.org on 2007/06/19 08:56:41 UTC

svn commit: r548615 - /forrest/trunk/main/webapp/skins/common/xslt/fo/document-to-fo.xsl

Author: bdube
Date: Mon Jun 18 23:56:40 2007
New Revision: 548615

URL: http://svn.apache.org/viewvc?view=rev&rev=548615
Log:
Allow skinconf.xml setting to provide absolute URLs in PDF. Thanks to Patrick Ohly.
Issue FOR-1013

Modified:
    forrest/trunk/main/webapp/skins/common/xslt/fo/document-to-fo.xsl

Modified: forrest/trunk/main/webapp/skins/common/xslt/fo/document-to-fo.xsl
URL: http://svn.apache.org/viewvc/forrest/trunk/main/webapp/skins/common/xslt/fo/document-to-fo.xsl?view=diff&rev=548615&r1=548614&r2=548615
==============================================================================
--- forrest/trunk/main/webapp/skins/common/xslt/fo/document-to-fo.xsl (original)
+++ forrest/trunk/main/webapp/skins/common/xslt/fo/document-to-fo.xsl Mon Jun 18 23:56:40 2007
@@ -20,6 +20,8 @@
                 version="1.0">
 <!-- left, justify, right -->
   <xsl:variable name="text-align" select="string(//skinconfig/pdf/page/@text-align)"/>
+<!-- prefix which turns relative URLs into absolute ones, empty by default -->
+  <xsl:variable name="url-prefix" select="string(//skinconfig/pdf/url-prefix)"/>
 <!-- print URL of external links -->
   <xsl:variable name="show-external-urls" select="//skinconfig/pdf/show-external-urls"/>
 <!-- disable the table of content (enabled by default) -->
@@ -707,11 +709,28 @@
         </fo:basic-link>
       </xsl:when>
       <xsl:otherwise>
-        <fo:basic-link color="{$color}" text-decoration="underline" external-destination="{@href}">
+        <!-- Make relative URLs absolute -->
+        <xsl:variable name="href">
+          <xsl:choose>
+            <!-- already absolute -->
+            <xsl:when test="contains(@href,'://')">
+              <xsl:value-of select="@href"/>
+            </xsl:when>
+            <!-- add prefix if one is set -->
+            <xsl:when test="$url-prefix != ''">
+              <xsl:value-of select="concat($url-prefix,@href)"/>
+            </xsl:when>
+            <!-- keep as is -->
+            <xsl:otherwise>
+              <xsl:value-of select="@href"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:variable>
+        <fo:basic-link color="{$color}" text-decoration="underline" external-destination="{$href}">
           <xsl:apply-templates/>
         </fo:basic-link>
         <xsl:if test="$show-external-urls = 'true' and @href != string(.)">
-          (<xsl:value-of select="@href"/>)
+          (<xsl:value-of select="$href"/>)
         </xsl:if>
       </xsl:otherwise>
     </xsl:choose>



Re: svn commit: r548615 - /forrest/trunk/main/webapp/skins/common/xslt/fo/document-to-fo.xsl

Posted by Ross Gardler <rg...@apache.org>.
On 19/06/07, bdube@apache.org <bd...@apache.org> wrote:
> Author: bdube
> Date: Mon Jun 18 23:56:40 2007
> New Revision: 548615
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=548615
> Log:
> Allow skinconf.xml setting to provide absolute URLs in PDF. Thanks to Patrick Ohly.
> Issue FOR-1013

Don't forget an entry in status.xml, that is how we notify of
improvements and also how we record contributions from none
committers.

Ross