Replace function?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rjoseph
    New Member
    • Sep 2007
    • 36

    Replace function?

    Hi Guys

    I hope this is a simple one for you.

    I am basically displaying data onto my xml page using the following line of code:

    <xsl:value-of select="carmanu facturer" />

    An example of the resulting output would be, "Ford"

    However, the "carmanufacture r" field in my table sometimes contains 2 words, for example, "Land Rover". Thus, the resulting output is, "Land Rover".

    The output on my page is also hyperlinked and so the code is as follows:

    <a class="type1" href="http://www.mywebsite.c o.uk/{carmanufacture r}.asp"><xsl:va lue-of select="carmanu facturer" /></a>

    The problem I have is that for the hyperlink url I would like to replace the spaces between the 2 words with a "-". Thus my link would point to:

    http://www.mywebsite.c o.uk/Land-Rover.asp

    I have tried using something like this "<xsl:value-of select="replace (carmanufacture r, ' ', '-')" />" but I get the following error:

    -------------error----------------
    msxml3.dll error '80004005'

    'replace' is not a valid XSLT or XPath function. -->replace(carman ufacturer, ' ', '-')<--
    --------------error end------------

    Looking at various forums they say this error occurs because I have XSLT 1.0 and not XSLT 2.0 but I am unsure what version I've got. If the code I am using should work then I assume that I have version 1.0??? However, I do not know what code I need to use to make this work.

    Any ideas would be fully appreciated.

    Best regards

    Rod from the UK
  • jkmyoung
    Recognized Expert Top Contributor
    • Mar 2006
    • 2057

    #2
    In xpath, the function is translate

    Comment

    • rjoseph
      New Member
      • Sep 2007
      • 36

      #3
      Hi JKMYoung

      Thank you for your help.

      The translate functon worked perfectly!

      Best regards Rod

      Comment

      Working...