Copied to clipboard

Flag this post as spam?

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


  • Tizer 170 posts 201 karma points
    Feb 22, 2011 @ 09:04
    Tizer
    0

    Empty href (no link text) links cause problems

    Hi - in some of the latest work I have been doing in umbraco I have had href links with no text - this has caused no end of problems with my xslt files.

    They have been used in jquery thing and so on.

    <a href="#" class="toogle"></a>

    It renders like this:

    <a href="#" class="toogle" />

    And totally blows out my code :(

    Is there a way to put content in these using xslt which stops these problems?

    Or is this just me who gets this?

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 22, 2011 @ 09:14
    Jan Skovgaard
    2

    Hi Tizer

    It's probably because you have the output mode set to XML in your XSLT file. (It's set to render XML by default). You could change this to HTML instead and then your layout should be fine.

    However, this could give some other problems so to be 100% sure nothing breaks you can insert an empty XSLT comment in between the opening a tag and the closing a tag, like this: <a href="#" class="toggle"><xsl:comment /></a>

    Does this help you?

    /Jan

  • Tizer 170 posts 201 karma points
    Feb 22, 2011 @ 12:51
    Tizer
    0

    Thanks Jan... the comment didn't work

    I'll test the output mode of the xslt file - this probably sounds like the culprit, not sure if I can change it on that particular xslt though :(

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Feb 22, 2011 @ 12:55
    Lee Kelleher
    1

    Hi Tizer,

    As Jan says adding an empty XSLT tag should work... try this one instead:

    <a href="#" class="toogle"><xsl:text><![CDATA[]]></xsl:text></a>

    Cheers, Lee.

  • Rob Watkins 369 posts 701 karma points
    Feb 22, 2011 @ 15:13
    Rob Watkins
    2

    If you can get absolutely nothing else to work, you can hack it:

    <xsl:text disable-output-escaping="yes"><![CDATA[<a href="#" class="toogle"></a>]]></xsl:text>

    You can split it if you need to add attributes, I guess for client side use, an id is most likely:

    <xsl:text disable-output-escaping="yes"><![CDATA[<a href="#" id="]]></xsl:text>
    <xsl:value-of select="$myTagID"/>
    <xsl:text disable-output-escaping="yes"><![CDATA["></a>]]></xsl:text>

    This is highly unreadable, generally awful, and should only be used when you have exhausted all other avenues though :o)

  • Tizer 170 posts 201 karma points
    Feb 23, 2011 @ 03:02
    Tizer
    0

    Thanks - that fixed it Lee :)

    Robs works aswell :)

Please Sign in or register to post replies

Write your reply to:

Draft