Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xsl substring after few chars but not cut the word

Tags:

string

xslt

i want to call some substring text that i add in to virable

<xsl:variable name="substringbreakText">
          <xsl:call-template name="insertBreaks"> 
               <xsl:with-param name="subject" select="substring(PublicProfile/AboutMe,1,550)"/> 
              </xsl:call-template>
    </xsl:variable>

and like go backwords on this text until i get white space or break. so my point is to return string less then 550 chars but keep it look complate words

exmple: thats my 550 chars: "The image you see purports to depict Graham Bverly, Emeritus Professor of Academic Development in the Research Support Unit at Anglia ucla University, UK. He inquires into, and runs workshops on, writing for postgraduates and fellow academics.

But what messages does this portrait suggest to the reader? That Badley poses as an erudite thinker? That he seeks the light of truth? That he leans to the left? That he is, possibly, amused by such pretension? That he is sceptical? Perhaps. For ‘As a man is, so he sees’ (William Bleer).

Eme"

i want to cut the white space and "Eme" or cut the \r\n or
in this string.

like image 635
roy.d Avatar asked Apr 19 '12 08:04

roy.d


1 Answers

<xsl:value-of select="substring(@Description, 1, 500 + string-length(substring-before(substring(@Description, 501),' ')))" />

this could be changed to match a full stop or whatever to suit your needs :)

like image 129
Treemonkey Avatar answered Oct 16 '22 01:10

Treemonkey