SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    midnight coder
    Join Date
    Dec 2000
    Location
    The flat edge of the world
    Posts
    838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    can't have vars in URL when using XSLT

    //edit: doh, should have separated the & a m p ; bit
    //I've separted the amp bit so it shows up in this post

    I'm making a XSL template, and one bit of the template is:

    Code:
    <a href="profile.php?compId=3&c=3&id=3">
    And XSL didn't like the & characters at the end of the URL, this works however:

    Code:
    <a href="profile.php?compId=3& a m p ;c=3& a m p ;id=3">
    But it's a hassle to change all the & to & a m p ;, and it would seem stupid to not have an alternative solution to this problem.

    Is there a way to solve this?
    Last edited by Robo; Jun 2, 2002 at 17:01.
    Work smarter, not harder. -Scrooge McDuck

  2. #2
    SitePoint Zealot JEmLAC's Avatar
    Join Date
    Apr 2002
    Location
    Kansas City
    Posts
    156
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What about using the hex value of the ampersand (%26)? Something like going from:
    [VBS]<a href="profile.php?compId=3&c=3&id=3">[/VBS]
    to
    [VBS]<a href="profile.php?compId=3%26c=3%26id=3">[/VBS]
    I don't know that this will work, but I've seen the browser tuck the hex character for space %20 in when the URL has a space in it.
    Morning person by habit, not by nature.

  3. #3
    SitePoint Zealot JEmLAC's Avatar
    Join Date
    Apr 2002
    Location
    Kansas City
    Posts
    156
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry, I was rereading the post. I don't suppose this is much better. XML is pretty picky about its entity references and properly formatted code. You may be stuck. (I'm no authority, though)
    Morning person by habit, not by nature.

  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)
    Yes, that should be fine. Either do that or encapsulate the URL in a CDATA block.

    From the MS XML 4 SDK:
    A CDATA section provides a way to include characters such as "<", ">", and "&" in an XML document that would normally interfere with processing. A CDATA section uses the following syntax:

    <![CDATA[text goes here]]>.

    M@rco


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
  •