Copied to clipboard

Flag this post as spam?

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


  • Asad Kizzie 28 posts 158 karma points
    Dec 18, 2023 @ 17:57
    Asad Kizzie
    0

    XSLT Format HTML Output to Regular Text

    I'm trying to display the text of a field but the code is displaying the full HTML output. How do I format it to display only the text?

    Here's the code:

    <xsl:value-of select="data [@alias = 'bodyText']"/>
    

    Example of what it returns on the page:

    <p><span>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. </span></p>
    

    What I would like it to return:

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
    

    Suggestions?

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Feb 26, 2024 @ 22:20
    Chriztian Steinmeier
    0

    Hi Asad,

    Is this still something you're looking for a solution to?

    Cheers,

    /Chriztian

  • Asad Kizzie 28 posts 158 karma points
    Feb 28, 2024 @ 17:00
    Asad Kizzie
    100

    Thanks for checking in! I did figure out a solution.

    <xsl:value-of select="string(./data [@alias = 'bodyText'])" disable-output-escaping="yes"/>
    
Please Sign in or register to post replies

Write your reply to:

Draft