Copied to clipboard

Flag this post as spam?

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


  • Palle Hansen 143 posts 396 karma points
    Jun 30, 2010 @ 20:27
    Palle Hansen
    0

    Replace

    Hi all,
    I'm trying to replace some text but can't get it right.
    I have a filed with a price and the output is DKK 1.000 when I use this code:
    <xsl:value-of select="$p1/product/priceinfo/exvat/price"/>

    Now I want to replace DKK with ex. vat

    My code is: <xsl:value-of select="umbraco.library:Replace('$p1/product/priceinfo/exvat/price','DKK', 'ex. vat')"/>
    But my output is: $p1/product/priceinfo/exvat/price

    Can anyone help?

    Palle

  • Kim Andersen 1447 posts 2196 karma points MVP
    Jun 30, 2010 @ 20:35
    Kim Andersen
    1

    Hi Palle

    Culd you try without the ' ' in the first parameter like this:

    <xsl:value-of select="umbraco.library:Replace($p1/product/priceinfo/exvat/price,'DKK', 'ex. vat')"/>

    /Kim A

  • Palle Hansen 143 posts 396 karma points
    Jun 30, 2010 @ 20:42
    Palle Hansen
    0

    Hi Kim,
    Thanks, that did the trick.

    Palle

  • Kim Andersen 1447 posts 2196 karma points MVP
    Jun 30, 2010 @ 20:54
    Kim Andersen
    0

    Good to hear Palle. When using the ' ', the Replace-function sees the input as a string and will not find the content from your xPath-expression. So when using xPath in the function, just remember to remove the ' '.

    If you had a string tha should be replaced you would use it like this:

    <xsl:value-of select="umbraco.library:Replace('This is my string','This is','Look at')" />

    The above snippet would output: Look at my string

    Have a nice evening :)

    /Kim A

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies