Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • vaibhav 119 posts 139 karma points
    Mar 22, 2011 @ 09:52
    vaibhav
    0

    Link after string...

    Hello all,

    I want to create one xslt which will count the numbers of character in the string & if string is have more that 50 characters then it will cut string to 50 characters & it will give ">>" as a link to full article .....

    I am not sure wether i can do it using xslt or not ...but still i like to try ....

    Please help me ....

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 22, 2011 @ 10:53
    Jan Skovgaard
    0

    Hi Vaibhav

    This is possible to achieve by using the Truncate extension.

    There is a good example on the usage in the wiki here: http://our.umbraco.org/wiki/reference/umbracolibrary/truncatestring

    Hope this helps.

    /Jan

  • vaibhav 119 posts 139 karma points
    Mar 23, 2011 @ 07:30
    vaibhav
    0

    Hai thanx for help.

    But i have to take string from user ....user will write some thing in the textbox provided in document type & then i want to truncate that string ...also i have more than 1 box where i want to do this thing .also i want to give link to that page after say 50 characters insted of "..." which i m not able to do after using that example  ...how to do this ?

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 23, 2011 @ 08:06
    Jan Skovgaard
    0

    Hi Vaibhav

    What are the property names of these two boxes?

    What you need to do is use the property names in the truncate extension...like this.

     <xsl:value-of select="umbraco.library:TruncateString($currentPage/thenameofyourproperty1,50,'>>')"/>

     <xsl:value-of select="umbraco.library:TruncateString($currentPage/thenameofyourproperty2,50,'>>')"/>

    Does it make sense?

    /Jan

  • vaibhav 119 posts 139 karma points
    Mar 23, 2011 @ 08:11
    vaibhav
    0

    But that boxes are ar different places ......& i have only 1 xslt ....how can i do it ?

     

    Also i want to apply link on ">>" which also will be given by user  .....How can i do it ?

  • vaibhav 119 posts 139 karma points
    Mar 23, 2011 @ 08:37
    vaibhav
    0

    Also i have found 1 thing that when i m using this xslt with some propery which has Richtextbox editor then i shows text as

    <span class="xml-text">Rewarded with Editors ch>>

    but for textstring it works properly...

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 23, 2011 @ 08:47
    Jan Skovgaard
    0

    Hi Vaibhav

    Well maybe it's neccesary to have to different XSLT files for this then.

    But could you perhaps post some of the code you're working on now? And the textbox you're talking about...is that a multiple textbox or a rich text editor?

    /Jan

  • vaibhav 119 posts 139 karma points
    Mar 23, 2011 @ 08:52
    vaibhav
    0

    It is richtextbox editor i m using ....

    can u tell me how to apply link on ">>" thing in xslt (link will also come from user from textbox)

     

    I have created this xslt right now .....

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxml="urn:schemas-microsoft-com:xslt"
      xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:tagsLib="urn:tagsLib" xmlns:BlogLibrary="urn:BlogLibrary"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets tagsLib BlogLibrary ">


    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>

    <xsl:template match="/">

    <!-- start writing XSLT -->
    <xsl:value-of select="umbraco.library:TruncateString($currentPage/solutionBlock1_Header,10,'>>')"/>
      
    </xsl:template>

    </xsl:stylesheet>

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 23, 2011 @ 22:46
    Jan Skovgaard
    0

    Hi Vaibhav

    Ok, but do you have much content in that rich text editor, where the could be more than one link? Is what you need to "just" add >> after the link? I'm getting a bit confused so if I can understand your purpose on a deeper level I might be able to help you with the best solution.

    It does not sound like the ideal solution at the moment.

    /Jan

  • vaibhav 119 posts 139 karma points
    Mar 25, 2011 @ 08:44
    vaibhav
    0

    i want if the text (text is written by user) exceeds 60 charactes then ">>" should automatically appear & ">>" should have a link (link is given by user) to the main article .....

    i am using richtext box editor & i have much of text in it ....

    when i use richtext box editor with ur given code then it shows something  

    <span class="xml-text">Rewarded with Editors ch>> 

    but i want

    Rewarded with Editors ch>>    (here ">>" will have the link to main article)

    hope u will understand this.

Please Sign in or register to post replies

Write your reply to:

Draft