Update of /var/cvs/applications/richtext/config/xslt
In directory james.mmbase.org:/tmp/cvs-serv13332

Modified Files:
        2rich.xslt mmxf2rich.xslt 
Log Message:
started makeing some test-cases for the xslts as well, simply with a 
Makefile/xsltproc for now. 


See also: http://cvs.mmbase.org/viewcvs/applications/richtext/config/xslt


Index: 2rich.xslt
===================================================================
RCS file: /var/cvs/applications/richtext/config/xslt/2rich.xslt,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- 2rich.xslt  4 Jun 2008 12:18:21 -0000       1.9
+++ 2rich.xslt  10 Jun 2008 14:08:30 -0000      1.10
@@ -6,7 +6,7 @@
 
 
   @author:  Michiel Meeuwissen
-  @version: $Id: 2rich.xslt,v 1.9 2008/06/04 12:18:21 michiel Exp $
+  @version: $Id: 2rich.xslt,v 1.10 2008/06/10 14:08:30 michiel Exp $
   @since:   MMBase-1.6
 -->
 <xsl:stylesheet
@@ -43,7 +43,6 @@
   </xsl:template>
 
 
-
   <!-- template to override mmxf tags with an 'id', we support links to it 
here -->
   <xsl:template match="mmxf:*" mode="rels">
     <!-- store the 'relation' nodes for convenience in $rels:-->
@@ -116,9 +115,9 @@
     <xsl:variable name="id" ><xsl:value-of 
select="substring-after(substring-after(@id, '_'), '_')" /></xsl:variable>
     <xsl:choose>
       <xsl:when test="$org.mmbase.richtext.wiki.undecorateids = 'true'
-                      and string-length($id) gt 0" >
+                      and string-length($id) &gt; 0" >
         <xsl:choose>
-          <xsl:when test="string-length(substring-after($id, '-')) gt 0">
+          <xsl:when test="string-length(substring-after($id, '-')) &gt; 0">
             <xsl:value-of select="substring-before($id, '-')" />
           </xsl:when>
           <xsl:otherwise>


Index: mmxf2rich.xslt
===================================================================
RCS file: /var/cvs/applications/richtext/config/xslt/mmxf2rich.xslt,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- mmxf2rich.xslt      10 Jun 2008 12:41:08 -0000      1.10
+++ mmxf2rich.xslt      10 Jun 2008 14:08:30 -0000      1.11
@@ -2,7 +2,7 @@
   This translates a mmbase XML field to enriched ASCII
 
   @author: Michiel Meeuwissen
-  @version: $Id: mmxf2rich.xslt,v 1.10 2008/06/10 12:41:08 michiel Exp $
+  @version: $Id: mmxf2rich.xslt,v 1.11 2008/06/10 14:08:30 michiel Exp $
   @since:  MMBase-1.6
 -->
 <xsl:stylesheet
@@ -18,19 +18,23 @@
     </xsl:apply-templates>
   </xsl:template>
 
-  <xsl:template match = "mmxf:p" >
+  <xsl:template match="mmxf:p" >
+    <xsl:if test="position() != 1">
+      <xsl:text>&#xA;</xsl:text>
+    </xsl:if>
     <xsl:apply-templates select="." mode="rels" />
     <xsl:apply-templates 
select="mmxf:a|mmxf:em|mmxf:strong|text()|mmxf:ul|mmxf:ol|mmxf:br" />
-    <xsl:text>&#xA;&#xA;</xsl:text>
+    <xsl:text>&#xA;</xsl:text>
   </xsl:template>
 
-  <xsl:template match = "mmxf:section" >
+  <xsl:template match="mmxf:section" >
     <xsl:param name="depth" />
     <xsl:value-of select="$depth" />
     <xsl:text> </xsl:text>
     <xsl:apply-templates select="." mode="rels" />
     <xsl:value-of select="mmxf:h" />
     <xsl:text>&#xA;</xsl:text>
+    <xsl:text>&#xA;</xsl:text>
     <xsl:apply-templates select="mmxf:p|mmxf:ul|mmxf:ol|mmxf:table" />
     <xsl:apply-templates select="mmxf:section">
       <xsl:with-param name="depth">$<xsl:value-of select="$depth" 
/></xsl:with-param>
@@ -51,21 +55,38 @@
   </xsl:template>
 
   <xsl:template match="mmxf:ul" >
+    <xsl:if test="position() != 1">
     <xsl:text>&#xA;</xsl:text>
+    </xsl:if>
     <xsl:apply-templates select="mmxf:li" mode="ul" />
+    <xsl:if test="position() != last()">
+      <xsl:text>&#xA;</xsl:text>
+    </xsl:if>
   </xsl:template>
+
   <xsl:template match="mmxf:ol" >
+    <xsl:if test="position() != 1">
     <xsl:text>&#xA;</xsl:text>
+    </xsl:if>
     <xsl:apply-templates select="mmxf:li" mode="ol" />
+    <xsl:if test="position() != last()">
+      <xsl:text>&#xA;</xsl:text>
+    </xsl:if>
   </xsl:template>
 
   <xsl:template match="mmxf:li" mode="ul" >
-    <xsl:text>- </xsl:text><xsl:apply-templates />
+    <xsl:if test="position() != 1">
     <xsl:text>&#xA;</xsl:text>
+    </xsl:if>
+    <xsl:text>- </xsl:text>
+    <xsl:apply-templates />
   </xsl:template>
   <xsl:template match="mmxf:li" mode="ol" >
-    <xsl:text>* </xsl:text><xsl:apply-templates />
+    <xsl:if test="position() != 1">
     <xsl:text>&#xA;</xsl:text>
+    </xsl:if>
+    <xsl:text>* </xsl:text>
+    <xsl:apply-templates />
   </xsl:template>
 
 
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to