Is there a way to get xml to IGNORE < and >

Discussion in 'XML' started by Eric, Feb 12, 2007.

  1. Eric

    Eric Guest

    I'm trying to build a mailto url like so:

    <td class="{$sData}"><![CDATA[<a href="mailto:]]><xsl:value-of
    select="email"/><![CDATA[?subject=Support question">]]><xsl:value-of
    select="email"/><![CDATA[</a>]]></td>

    The html that's rendered looks like I would expect my html source to,
    however in the source there are &lt; and &gt; chraracters so my links
    don't work. Any way to get it to just spit out what I have onto the
    page?

    -Eric
     
    Eric, Feb 12, 2007
    #1
    1. Advertisements

  2. Eric

    p.lepin Guest

    There is a way, but I'm not going to tell you, since it's
    an obvious case of XY problem. Instead, here's the Right
    Way to solve your problem:

    <td class="{$sData}">
    <a>
    <xsl:attribute name="href">
    <xsl:text>mailto:</xsl:text>
    <xsl:value-of select="email"/>
    <xsl:text>?subject=Support question</xsl:text>
    </xsl:attribute>
    <xsl:value-of select="email"/>
    </a>
    </td>
     
    p.lepin, Feb 12, 2007
    #2
    1. Advertisements

  3. A ' ' is not allowed in URLs, so change ot to Support%20question
     
    Johannes Koch, Feb 12, 2007
    #3
  4. Eric

    p.lepin Guest

    Indeed. Although using an url-encode template would've been
    an even better solution.
     
    p.lepin, Feb 12, 2007
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.