Copied to clipboard

Flag this post as spam?

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


  • bayshield 50 posts 65 karma points
    Jan 15, 2010 @ 15:10
    bayshield
    0

    XSLT String manipulation

    Hi,

    http://www.bayshield.com/blog/tag/umbraco

    Hi I am trying to create an XSLT macro to change my blog page title based on the selected tag.  What is the simplest way of grabbing the final value off the end of the url in XSLT? 

    Thanks

    Aaron

     

  • Sebastiaan Janssen 4899 posts 14655 karma points MVP admin hq
    Jan 15, 2010 @ 15:16
    Sebastiaan Janssen
    0

    You could do something like LastIndexOf and then use the XSLT substring method to read the rest of the string.

  • Harald Ulriksen 207 posts 248 karma points
    Jan 15, 2010 @ 15:17
    Harald Ulriksen
    0

    What about substring-after function.



    <xsl:value-of select="substring-after($url,'/tag/')" />



    Remember to handle query string if any.

  • Sebastiaan Janssen 4899 posts 14655 karma points MVP admin hq
    Jan 15, 2010 @ 15:17
    Sebastiaan Janssen
    1

    Ah, hit the Submit too soon. I was going to add: Personally, I would just write an XSLT extension for this though, more performant and easier to debug. :-)

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Jan 15, 2010 @ 15:18
  • 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