Thomas J.S.: Zeilenumbruch in XML -> XSL -> HTML

Beitrag lesen

Hallo,

<td class="commdesc"><xsl:apply-templates select="Description"/></td>

-------------
 <xsl:template match="Description">
      <xsl:call-template name="umbruch" />
</xsl:template>

<xsl:template name="umbruch">
 <xsl:param name="text" select="." />
 <xsl:variable name="normalisiertertext" select="concat(normalize-space($text), ' ')" />
 <xsl:variable name="ersteswort" select="substring-before($normalisiertertext, ' ')" />
 <xsl:variable name="restlichertext" select="substring-after($normalisiertertext, ' ')" />
 <xsl:value-of select="$ersteswort" />
 <xsl:if test="$restlichertext">
  <br />
  <xsl:call-template name="umbruch">
   <xsl:with-param name="text" select="$restlichertext" />
  </xsl:call-template>
 </xsl:if>
</xsl:template>
--------------

Grüße
Thomas