Copied to clipboard

Flag this post as spam?

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


  • Jan Molbech 31 posts 76 karma points
    Apr 04, 2012 @ 14:27
    Jan Molbech
    0

    syntax help inserting value-of select into href

    i am trying the following

    <class="mail">Mail: 
            <href="mailto:<xsl:value-of select="'current()/email'"/>"/></p>

    but it gives me this error

    System.Xml.XmlException: '<', hexadecimal value 0x3C, is an invalid attribute character. Line 42, position 25. 

    what syntax do i use to insert a value-of into the href?

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Apr 04, 2012 @ 14:56
    Lee Kelleher
    0

    Hi Jan,

    The shortcut syntax for using a value inside another XML/HTML tag is like this...

    <a href="mailto:{email}">

    Cheers, Lee.

  • Jan Molbech 31 posts 76 karma points
    Apr 04, 2012 @ 17:37
    Jan Molbech
    0

    So i have to save the value in a variable first? 

    Because just adding curly brackets around the value-of statement doesn't work

    <href="mailto:{<xsl:value-of select="current()/email"/>}"/></p>

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Apr 04, 2012 @ 18:13
    Lee Kelleher
    0

    Hi Jan,

    You could try...

    <a href="mailto:{current()/email}">

    ... but without seeing the context of the rest of your XSLT, it's pure guesswork for me. :-)

    Cheers, Lee.

  • Jan Molbech 31 posts 76 karma points
    Apr 04, 2012 @ 18:26
    Jan Molbech
    0

    Thanx for your replies.

    This worked for me.

    <class="mail">Mail: 
            <a>
             <xsl:attribute name="href">
               <xsl:text>mailto:</xsl:text>
               <xsl:value-of select="current()/email"/>
              </xsl:attribute>
              <xsl:value-of select="current()/email"/>
            </a>
              </p>

Please Sign in or register to post replies

Write your reply to:

Draft