#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    16
    Rep Power
    0

    Error transforming xml to html assiging value-of to href attribute.


    I don't know why this does not work. I thought everything that was not an xsl element would be sent to the result but this is not the case here. I am trying to set the href to a value from the xml but get the error:
    Code:
    SXXP0003: Error reported by XML parser: The value of attribute "href" associated with an element type "a" must not contain the '<' character.
    This is my xsl segment:

    Code:
    <xsl:template name="setupChargesTabs">
     <ul id="ulCharges">
     <xsl:for-each select="ns3:Charge">
     <li><a href='#<xsl:value-of select="ns3:ConnecticutStatuteNumber"/>'><xsl:value-of select="ns3:ConnecticutStatuteNumber"/></a></li>
     </xsl:for-each>
    </ul> </xsl:template>
  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,056
    Rep Power
    9398
    You can't put XSLT in a string. Which is where it is. In a string.

    Use an xsl:attribute.
    Code:
    <a>
        <xsl:attribute name="href">
            #<xsl:value-of select="ns3:ConnecticutStatuteNumber" />
        </xsl:attribute>
        <xsl:value-of select="ns3:ConnecticutStatuteNumber" />
    </a>
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    16
    Rep Power
    0
    Originally Posted by requinix
    You can't put XSLT in a string. Which is where it is. In a string.

    Use an xsl:attribute.
    Code:
    <a>
        <xsl:attribute name="href">
            #<xsl:value-of select="ns3:ConnecticutStatuteNumber" />
        </xsl:attribute>
        <xsl:value-of select="ns3:ConnecticutStatuteNumber" />
    </a>
    Thanks requinix that works great.

IMN logo majestic logo threadwatch logo seochat tools logo