forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thors...@apache.org
Subject svn commit: r358150 - in /forrest/trunk/main/webapp: locationmap-transforms.xml resources/stylesheets/generateId.xsl resources/stylesheets/replaceCharsInString.xsl
Date Tue, 20 Dec 2005 23:47:47 GMT
Author: thorsten
Date: Tue Dec 20 15:47:39 2005
New Revision: 358150

URL: http://svn.apache.org/viewcvs?rev=358150&view=rev
Log:
Added some helper stylesheets to locationmap and core stylesheets. both stylesheets are self
explaining

Added:
    forrest/trunk/main/webapp/resources/stylesheets/generateId.xsl
      - copied, changed from r357269, forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/resources/stylesheets/helper/generateId.xsl
    forrest/trunk/main/webapp/resources/stylesheets/replaceCharsInString.xsl   (with props)
Modified:
    forrest/trunk/main/webapp/locationmap-transforms.xml

Modified: forrest/trunk/main/webapp/locationmap-transforms.xml
URL: http://svn.apache.org/viewcvs/forrest/trunk/main/webapp/locationmap-transforms.xml?rev=358150&r1=358149&r2=358150&view=diff
==============================================================================
--- forrest/trunk/main/webapp/locationmap-transforms.xml (original)
+++ forrest/trunk/main/webapp/locationmap-transforms.xml Tue Dec 20 15:47:39 2005
@@ -81,6 +81,14 @@
       <location src="{forrest:stylesheets}/variable.helper.xsl" />
     </match>
     
+    <match pattern="transform.xml.generateId">
+      <location src="{forrest:stylesheets}/generateId.xsl" />
+    </match>
+    
+    <match pattern="transform.xml.replaceCharsInString">
+      <location src="{forrest:stylesheets}/replaceCharsInString.xsl" />
+    </match>
+    
     <match pattern="transform.xml.extracted-svg">
       <location src="{forrest:stylesheets}/extract-svg.xsl" />
     </match>

Copied: forrest/trunk/main/webapp/resources/stylesheets/generateId.xsl (from r357269, forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/resources/stylesheets/helper/generateId.xsl)
URL: http://svn.apache.org/viewcvs/forrest/trunk/main/webapp/resources/stylesheets/generateId.xsl?p2=forrest/trunk/main/webapp/resources/stylesheets/generateId.xsl&p1=forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/resources/stylesheets/helper/generateId.xsl&r1=357269&r2=358150&rev=358150&view=diff
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/resources/stylesheets/helper/generateId.xsl
(original)
+++ forrest/trunk/main/webapp/resources/stylesheets/generateId.xsl Tue Dec 20 15:47:39 2005
@@ -19,23 +19,28 @@
 This stylesheet contains templates for converting documentv11 to HTML.  See the
 imported document2html.xsl for details.
 -->
-
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-  <!--  Templates for "toc" mode.  This will generate a complete
-        Table of Contents for the document.  This will then be used
-        by the site2xhtml to generate a Menu ToC and a Page ToC -->
-  
+  <!-- Template that generates an id -->
+  <xsl:include href="lm://transform.xml.replaceCharsInString"/>
   <xsl:template name="generate-id">
     <xsl:choose>
       <xsl:when test="@id">
-        <xsl:value-of select="@id"/>
+        <xsl:call-template name="replaceCharsInString">
+          <xsl:with-param name="stringIn" select="@id"/>
+          <xsl:with-param name="charsIn" select="' '"/>
+          <xsl:with-param name="charsOut" select="'-'"/>
+        </xsl:call-template>
       </xsl:when>
-      <xsl:when test="title">
-        <xsl:value-of select="title"/>
+      <xsl:when test="@title">
+        <xsl:call-template name="replaceCharsInString">
+          <xsl:with-param name="stringIn" select="@title"/>
+          <xsl:with-param name="charsIn" select="' '"/>
+          <xsl:with-param name="charsOut" select="'-'"/>
+        </xsl:call-template>
       </xsl:when>
       <xsl:otherwise>
         <xsl:value-of select="generate-id(.)"/>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:template>
-</xsl:stylesheet>
+</xsl:stylesheet>
\ No newline at end of file

Added: forrest/trunk/main/webapp/resources/stylesheets/replaceCharsInString.xsl
URL: http://svn.apache.org/viewcvs/forrest/trunk/main/webapp/resources/stylesheets/replaceCharsInString.xsl?rev=358150&view=auto
==============================================================================
--- forrest/trunk/main/webapp/resources/stylesheets/replaceCharsInString.xsl (added)
+++ forrest/trunk/main/webapp/resources/stylesheets/replaceCharsInString.xsl Tue Dec 20 15:47:39
2005
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 2002-2005 The Apache Software Foundation or its licensors,
+  as applicable.
+
+  Licensed 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.
+-->
+<!--
+This stylesheet contains templates for converting documentv11 to HTML.  See the
+imported document2html.xsl for details.
+-->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+  <!-- Template that does the replacement of characters in a string -->
+	<xsl:template name="replaceCharsInString">
+	  <xsl:param name="stringIn"/>
+	  <xsl:param name="charsIn"/>
+	  <xsl:param name="charsOut"/>
+	  <xsl:choose>
+	    <xsl:when test="contains($stringIn,$charsIn)">
+	      <xsl:value-of select="concat(substring-before($stringIn,$charsIn),$charsOut)"/>
+	      <xsl:call-template name="replaceCharsInString">
+	        <xsl:with-param name="stringIn" select="substring-after($stringIn,$charsIn)"/>
+	        <xsl:with-param name="charsIn" select="$charsIn"/>
+	        <xsl:with-param name="charsOut" select="$charsOut"/>
+	      </xsl:call-template>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <xsl:value-of select="$stringIn"/>
+	    </xsl:otherwise>
+	  </xsl:choose>
+	</xsl:template>
+</xsl:stylesheet>

Propchange: forrest/trunk/main/webapp/resources/stylesheets/replaceCharsInString.xsl
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message