forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject svn commit: r106842 - /forrest/trunk/plugins/text-output/resources/stylesheets/txt/document2txt.xsl
Date Sun, 28 Nov 2004 19:34:31 GMT
Author: rick
Date: Sun Nov 28 11:34:30 2004
New Revision: 106842

URL: http://svn.apache.org/viewcvs?view=rev&rev=106842
Log:
Pass the current width down through all templates.  This way, nested
items still fall within the desired width.  The default width for any
template will the the document-width - (current level * indentation per
level)


Modified:
   forrest/trunk/plugins/text-output/resources/stylesheets/txt/document2txt.xsl

Modified: forrest/trunk/plugins/text-output/resources/stylesheets/txt/document2txt.xsl
Url: http://svn.apache.org/viewcvs/forrest/trunk/plugins/text-output/resources/stylesheets/txt/document2txt.xsl?view=diff&rev=106842&p1=forrest/trunk/plugins/text-output/resources/stylesheets/txt/document2txt.xsl&r1=106841&p2=forrest/trunk/plugins/text-output/resources/stylesheets/txt/document2txt.xsl&r2=106842
==============================================================================
--- forrest/trunk/plugins/text-output/resources/stylesheets/txt/document2txt.xsl	(original)
+++ forrest/trunk/plugins/text-output/resources/stylesheets/txt/document2txt.xsl	Sun Nov 28
11:34:30 2004
@@ -210,7 +210,8 @@
 
   <xsl:template match="p">
     <xsl:param name="level" select="'1'"/>
-    <xsl:param name="width" select="$document-width"/>
+    <xsl:param name="width"
+            select="$document-width - ($level * $indent-per-level)"/>
 
     <xsl:call-template name="cr"/>
 
@@ -233,7 +234,8 @@
 
   <xsl:template match="p" mode="in-list">
     <xsl:param name="level" select="'1'"/>
-    <xsl:param name="width" select="$document-width"/>
+    <xsl:param name="width"
+            select="$document-width - ($level * $indent-per-level)"/>
 
     <xsl:variable name="para">
       <xsl:apply-templates mode="in-list">
@@ -256,7 +258,8 @@
 
   <xsl:template match="ol|ul">
     <xsl:param name="level" select="'1'"/>
-    <xsl:param name="width" select="$document-width"/>
+    <xsl:param name="width"
+            select="$document-width - ($level * $indent-per-level)"/>
     <xsl:call-template name="cr"/>
     <xsl:apply-templates select="li">
       <xsl:with-param name="level" select="$level"/>
@@ -266,7 +269,8 @@
 
   <xsl:template match="ol|ul" mode="in-list">
     <xsl:param name="level" select="'1'"/>
-    <xsl:param name="width" select="$document-width"/>
+    <xsl:param name="width"
+            select="$document-width - ($level * $indent-per-level)"/>
     <xsl:call-template name="cr"/>
     <xsl:apply-templates select="li" mode="in-list">
       <xsl:with-param name="level" select="$level"/>
@@ -276,23 +280,31 @@
 
   <xsl:template match="dl">
     <xsl:param name="level" select="'1'"/>
+    <xsl:param name="width"
+            select="$document-width - ($level * $indent-per-level)"/>
     <xsl:call-template name="cr"/>
     <xsl:apply-templates>
       <xsl:with-param name="level" select="$level"/>
+      <xsl:with-param name="width" select="$width"/>
     </xsl:apply-templates>
   </xsl:template>
 
   <xsl:template match="dl" mode="in-list">
     <xsl:param name="level" select="'1'"/>
+    <xsl:param name="width"
+            select="$document-width - ($level * $indent-per-level)"/>
     <xsl:apply-templates mode="in-list">
       <xsl:with-param name="level" select="$level"/>
+      <xsl:with-param name="width" select="$width"/>
     </xsl:apply-templates>
   </xsl:template>
 
   <xsl:template match="note | warning | fixme">
     <xsl:param name="level" select="'1'"/>
-    <xsl:call-template name="cr"/>
+    <xsl:param name="width"
+            select="$document-width - ($level * $indent-per-level)"/>
 
+    <xsl:call-template name="cr"/>
     <xsl:call-template name="lineOf">
       <xsl:with-param name="size" select="$level * $indent-per-level"/>
     </xsl:call-template>
@@ -312,21 +324,21 @@
 
     <xsl:call-template name="justify-text">
       <xsl:with-param name="text" select="$title-text"/>
-      <xsl:with-param name="width"
-            select="$document-width - ($level * $indent-per-level)"/>
+      <xsl:with-param name="width" select="$width"/>
     </xsl:call-template>
     <xsl:call-template name="cr"/>
 
     <xsl:variable name="para">
       <xsl:apply-templates>
         <xsl:with-param name="level" select="$level"/>
+        <xsl:with-param name="width" select="$width"/>
       </xsl:apply-templates>
     </xsl:variable>
 
     <xsl:call-template name="wrap-text">
       <xsl:with-param name="text" select="$para"/>
       <xsl:with-param name="indent" select="$level * $indent-per-level"/>
-      <xsl:with-param name="width" select="$document-width"/>
+      <xsl:with-param name="width" select="$width"/>
     </xsl:call-template>
 
     <xsl:call-template name="cr"/>
@@ -335,8 +347,7 @@
     </xsl:call-template>
 
     <xsl:call-template name="lineOf">
-      <xsl:with-param name="size"
-            select="$document-width - ($level * $indent-per-level)"/>
+      <xsl:with-param name="size" select="$width"/>
       <xsl:with-param name="chars" select="'-'"/>
     </xsl:call-template>
     <xsl:call-template name="cr"/>
@@ -345,6 +356,8 @@
 
   <xsl:template match="note | warning | fixme" mode="in-list">
     <xsl:param name="level" select="'1'"/>
+    <xsl:param name="width"
+            select="$document-width - ($level * $indent-per-level)"/>
 
     <xsl:variable name="title-text">
       <xsl:text>** </xsl:text>
@@ -361,28 +374,27 @@
 
     <xsl:call-template name="justify-text">
       <xsl:with-param name="text" select="$title-text"/>
-      <xsl:with-param name="width"
-            select="$document-width - ($level * $indent-per-level)"/>
+      <xsl:with-param name="width" select="$width"/>
     </xsl:call-template>
     <xsl:call-template name="cr"/>
 
     <xsl:variable name="para">
       <xsl:apply-templates mode="in-list">
         <xsl:with-param name="level" select="$level"/>
+        <xsl:with-param name="width" select="$width"/>
       </xsl:apply-templates>
     </xsl:variable>
 
     <xsl:call-template name="wrap-text">
       <xsl:with-param name="text" select="$para"/>
       <xsl:with-param name="indent" select="'0'"/>
-      <xsl:with-param name="width" select="$document-width - ($level * $indent-per-level)"/>
+      <xsl:with-param name="width" select="$width"/>
       <xsl:with-param name="fixed" select="true"/>
     </xsl:call-template>
 
     <xsl:call-template name="cr"/>
     <xsl:call-template name="lineOf">
-      <xsl:with-param name="size"
-            select="$document-width - ($level * $indent-per-level)"/>
+      <xsl:with-param name="size" select="$width"/>
       <xsl:with-param name="chars" select="'-'"/>
     </xsl:call-template>
     <xsl:call-template name="cr"/>
@@ -403,7 +415,8 @@
 
   <xsl:template match="ol/li">
     <xsl:param name="level" select="'1'"/>
-    <xsl:param name="width" select="$document-width"/>
+    <xsl:param name="width"
+            select="$document-width - ($level * $indent-per-level)"/>
 
     <xsl:variable name="marker">
       <xsl:value-of select="position()"/>
@@ -426,7 +439,8 @@
 
   <xsl:template match="ol/li" mode="in-list">
     <xsl:param name="level" select="'1'"/>
-    <xsl:param name="width" select="$document-width"/>
+    <xsl:param name="width"
+            select="$document-width - ($level * $indent-per-level)"/>
 
     <xsl:variable name="marker">
       <xsl:value-of select="position()"/>
@@ -449,7 +463,8 @@
 
   <xsl:template match="ul/li">
     <xsl:param name="level" select="'1'"/>
-    <xsl:param name="width" select="$document-width"/>
+    <xsl:param name="width"
+            select="$document-width - ($level * $indent-per-level)"/>
 
     <xsl:variable name="item">
       <xsl:apply-templates mode="in-list">
@@ -468,7 +483,8 @@
 
   <xsl:template match="ul/li" mode="in-list">
     <xsl:param name="level" select="'1'"/>
-    <xsl:param name="width" select="$document-width"/>
+    <xsl:param name="width"
+            select="$document-width - ($level * $indent-per-level)"/>
 
     <xsl:variable name="item">
       <xsl:apply-templates mode="in-list">
@@ -487,9 +503,13 @@
 
   <xsl:template match="dd">
     <xsl:param name="level" select="'1'"/>
+    <xsl:param name="width"
+            select="$document-width - ($level * $indent-per-level)"/>
+
     <xsl:variable name="item">
       <xsl:apply-templates mode="in-list">
         <xsl:with-param name="level" select="'0'"/>
+        <xsl:with-param name="width" select="$width"/>
       </xsl:apply-templates>
     </xsl:variable>
     <xsl:call-template name="emit-with-indent">
@@ -501,9 +521,13 @@
 
   <xsl:template match="dd" mode="in-list">
     <xsl:param name="level" select="'1'"/>
+    <xsl:param name="width"
+            select="$document-width - ($level * $indent-per-level)"/>
+
     <xsl:variable name="item">
       <xsl:apply-templates mode="in-list">
         <xsl:with-param name="level" select="'0'"/>
+        <xsl:with-param name="width" select="$width"/>
       </xsl:apply-templates>
     </xsl:variable>
     <xsl:call-template name="emit-with-indent">
@@ -516,10 +540,14 @@
   <!-- Simple items that can contain only in-line mark up -->
   <xsl:template match="dt">
     <xsl:param name="level" select="'1'"/>
+    <xsl:param name="width"
+            select="$document-width - ($level * $indent-per-level)"/>
+
     <xsl:call-template name="cr"/>
     <xsl:variable name="item">
       <xsl:apply-templates mode="in-list">
         <xsl:with-param name="level" select="'0'"/>
+        <xsl:with-param name="width" select="$width"/>
       </xsl:apply-templates>
     </xsl:variable>
     <xsl:call-template name="emit-with-indent">
@@ -531,10 +559,14 @@
 
   <xsl:template match="dt" mode="in-list">
     <xsl:param name="level" select="'1'"/>
+    <xsl:param name="width"
+            select="$document-width - ($level * $indent-per-level)"/>
+
     <xsl:call-template name="cr"/>
     <xsl:variable name="item">
       <xsl:apply-templates mode="in-list">
         <xsl:with-param name="level" select="'0'"/>
+        <xsl:with-param name="width" select="$width"/>
       </xsl:apply-templates>
     </xsl:variable>
     <xsl:call-template name="emit-with-indent">
@@ -675,18 +707,20 @@
 
   <xsl:template match="text()">
     <xsl:param name="level" select="'1'"/>
-    <xsl:param name="width" select="$document-width"/>
+    <xsl:param name="width"
+            select="$document-width - ($level * $indent-per-level)"/>
 
     <xsl:call-template name="wrap-text">
       <xsl:with-param name="text" select="."/>
       <xsl:with-param name="indent" select="'0'"/>
-      <xsl:with-param name="width" select="$document-width - ($level * $indent-per-level)"/>
+      <xsl:with-param name="width" select="$width"/>
     </xsl:call-template>
   </xsl:template>
 
   <xsl:template match="text()" mode="in-list">
     <xsl:param name="level" select="'1'"/>
-    <xsl:param name="width" select="$document-width"/>
+    <xsl:param name="width"
+            select="$document-width - ($level * $indent-per-level)"/>
 
     <xsl:call-template name="wrap-text">
       <xsl:with-param name="text" select="."/>

Mime
View raw message