SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Wizard wdmny's Avatar
    Join Date
    Jul 2000
    Location
    Here
    Posts
    1,010
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    HTML Anchors and XML/XSL

    I am using XML/XSL to handle the formatting of my dynamic data but have ran into a simple problem. Since HTML anchor tags are <a name="NAME"></a>, when processed, it turns the 'empty' tags into the single tag.

    Code:
    <a name="15" />
    This would be fine, but the browser handles it as a URL without a href value, and turns the text near it to a link. If I put a non breaking space (&#160 in between the tags, it makes the link where the space is.

    What can I put in between the start and closing of the tags to not show up as a link and still be a start and ending tag?

  2. #2
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm, i'm having a similar problem, it strips the content

    http://www.angelfire.com/extreme3/an...elop/index.xml

    i tried avoiding it by using

    <xsl:value-of disable-output-escaping="yes" select="."/>

    but that didn't seem to work
    Last edited by Andrew-J2000; May 27, 2002 at 17:03.

  3. #3
    SitePoint Wizard wdmny's Avatar
    Join Date
    Jul 2000
    Location
    Here
    Posts
    1,010
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Surely one of our XML gods has a good answer to our simple problem .

    Thanks

  4. #4
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Et voila!

    NOTE: remove the underscores in the code - they are there so that the code isn't rendered by your browser (vB doesn't process the code properly)

    Here's a workaround I just came up with (can't track down anything relevant elsewhere on the web):
    Code:
    <a name="testanchor">&_#09;</a>
    "&_#09;" is the HTML decimal code for the tab character, which is not rendered by modern graphical browsers (unless in a <PRE> block), so it doesn't show up, and the problem is solved! Note that the "&" character itself will need to be suitably encoded in the XML document with the effect that the line will look like this:
    Code:
    <a name="testanchor">&_amp;#09;</a>
    BTW Wes - I don't think names can be prefixed with a number (or simply be a number) like in the example you gave. Although that's not the cause of this particular problem, it's something to avoid (although I suspect that it was just the first thing that came into your head when you bashed out that anchor as an example).


    M@rco
    Last edited by M@rco; May 29, 2002 at 09:59.

  5. #5
    SitePoint Wizard wdmny's Avatar
    Join Date
    Jul 2000
    Location
    Here
    Posts
    1,010
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks M@rco, that did the trick. Also, I did just throw in that anchor name. Now that you mention it, I think I ran into that problem before and ended up placing a letter in front of the number.

    Thanks


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •