Xsl copy with substring

I have this function in xsl which I took from this post

replace "cr" with "line break"

this is what i call it:

<xsl:variable name="breakText">
     <xsl:call-template name="insertBreaks"> 
          <xsl:with-param name="subject" select="PublicProfile/AboutMe"/> 
         </xsl:call-template>
    </xsl:variable>

im, as a link to an article, to "read more" in a text click, the first div of the short start of the article (550 characters long article) display the text as if I did not use the "insertBreaks" function

<xsl:copy-of select="substring($breakText,0,550)"/>

but this long description line works fine:

<xsl:copy-of select="$breakText"/>

where was i wrong

+3
source share
2 answers

The solution used in the question is mine.

It replaces the newline character not with a line break, but with an element <br />. The element is node - not a string.

, $breakText, , ( XSLT 2.0) RTF ( ) XSLT 1.0 - .

, ( ):

substring($breakText,0,550)

- ( $breakText) <br/> node

. text- node.

:

<xsl:copy-of select="$breakText"/> 

( XSLT 2.0) RTF ( XSLT 1.0).

, xsl:copy-of , string() - ( ).

0

xsl:value-of not xsl:copy-of. xsl:copy-of . xsl:value-of , . , .

+2

All Articles