<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="'        '" />
+ <xsl:with-param name="by" select="'	'" />
+ </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>
</li><li><a href="http://cweiske.de/?foo#bar">http://cweiske.de/?foo#bar</a><br />
</li><li><a href="file:///home/cweiske/fam.jpg">/home/cweiske/fam.jpg</a></li></ul>
<br />
+Tabs:<br />
+a<br />
+        b<br />
+                c<br />
+        d<br />
+e<br />
+<br />
+Tabs in text:<br />
+a b c<br />
+ab cd ef<br />
+<br />
Ende.<br />
</li><li><a href="http://cweiske.de/?foo#bar">http://cweiske.de/?foo#bar</a><br />
</li><li><a href="file:///home/cweiske/fam.jpg">/home/cweiske/fam.jpg</a></li></ul>
<br />
+Tabs:<br />
+a<br />
+        b<br />
+                c<br />
+        d<br />
+e<br />
+<br />
+Tabs in text:<br />
+a b c<br />
+ab cd ef<br />
+<br />
Ende.<br /></body>
</html>