Link to maintainership/funding post
[grauphel.git] / templates / html2tomboy.xsl
index a35400092c37fb854bbebfb110d0b90a6381f21c..f3da05e5a2865cb34ee9ddd1e47bd412d72d561a 100644 (file)
   <xsl:for-each select="child::node()">
    <xsl:choose>
     <xsl:when test="local-name(.) = ''">
-     <xsl:value-of select="."/>
+     <xsl:call-template name="string-replace-all">
+      <xsl:with-param name="text" select="string(.)" />
+      <xsl:with-param name="replace" select="'&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;'" />
+      <xsl:with-param name="by" select="'&#09;'" />
+     </xsl:call-template>
     </xsl:when>
     <xsl:when test="local-name(.) = 'br'">
      <!-- do nothing -->
   </xsl:for-each>
  </xsl:template>
 
+ <!-- http://geekswithblogs.net/Erik/archive/2008/04/01/120915.aspx -->
+ <xsl:template name="string-replace-all">
+  <xsl:param name="text" />
+  <xsl:param name="replace" />
+  <xsl:param name="by" />
+  <xsl:choose>
+   <xsl:when test="contains($text, $replace)">
+    <xsl:value-of select="substring-before($text,$replace)" />
+    <xsl:value-of select="$by" />
+    <xsl:call-template name="string-replace-all">
+     <xsl:with-param name="text" select="substring-after($text,$replace)" />
+     <xsl:with-param name="replace" select="$replace" />
+     <xsl:with-param name="by" select="$by" />
+    </xsl:call-template>
+   </xsl:when>
+   <xsl:otherwise>
+    <xsl:value-of select="$text" />
+   </xsl:otherwise>
+  </xsl:choose>
+ </xsl:template>
 </xsl:stylesheet>