#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Posts
    13
    Rep Power
    0

    Question complex URL's in xsl:attribute


    I try to create the following using XSL:

    Code:
    <table onclick"index.php?action=get_record&record=product&id=1">
    But I either get an error because of ampersands and equal signs or a lot of &lt; &amp;amp; when I try the following:

    Code:
    <xsl:element name="table">
      <xsl:attribute name="onclick">
        <xsl:value-of select="PHP_SELF" />?<![CDATA 
         [action=get_record&record=product&id=]]><xsl:value-of select="ID" /></xsl:attribute>
    Does anyone know a good solution?
  2. #2
  3. No Profile Picture
    El Guapo
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Location
    You have moved into a dark place. It is pitch black. You are likely to be eaten by a grue.
    Posts
    56
    Rep Power
    14
    First of all, your source:

    Code:
    <table onclick"index.php?action=get_record&record=product&id=1">
    Will generate errors in any decent XML parser - you can't have unadorned ampersands in your XML files - this line should read:

    Code:
    <table onclick"index.php?action=get_record&amp;amp;record=product&amp;amp;id=1">
    You'll also need to replace the &amp; with the entitity replacement value in your XSLT. Don't worry, the browser will be able to read it.

    Don't forget the closing tag to </xsl:element> too.

    -- Jough
    See my PHP in action:
    Poetry Archives

IMN logo majestic logo threadwatch logo seochat tools logo