Booker B: Zeilenumbruch im XSL beibehalten

Beitrag lesen

jo das geht super musst halt nur content durch short_descr und die codirung gegen [] austauschen...nice:D

xsl:

so:D

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
 <xsl:template match="/">
  <html>
   <head>
    <title>test</title>
   </head>
   <body>
    <xsl:apply-templates />
   </body>
  </html>
 </xsl:template>

<xsl:template match="short_descr">
  <xsl:apply-templates />
</xsl:template>

<xsl:template match="short_descr/text()">
  <xsl:call-template name="cr2br">
   <xsl:with-param name="text" select="." />
  </xsl:call-template>
</xsl:template>

<xsl:template name="cr2br">
 <xsl:param name="text" />
 <xsl:variable name="textafterbreak" select="substring-after($text, '[]')" />
 xsl:choose
  <xsl:when test="contains($text, '[]')">
   <xsl:value-of select="substring-before($text, '[]')" />
   <br />
   <xsl:call-template name="cr2br">
   <xsl:with-param name="text" select="$textafterbreak" />
   </xsl:call-template>
  </xsl:when>
  xsl:otherwise
   <xsl:value-of select="$text" />
  </xsl:otherwise>
 </xsl:choose>
</xsl:template>

</xsl:stylesheet>

dein root element sieht aber glaube anders aus ansonsten müsste es passen:D