XSLT manipulating 'action' variable by inserting a '/' (forward slash) only when appending to onclick attribute hor an anchor tag

Posted on 2007-08-08
Last Modified: 2013-11-18
Hi there,

I am having a peculiar problem using XSLT in .NET v1.

Here is a snippet of the relevant XSLT:
<xsl:attribute name="href"><xsl:value-of select="./@url"/></xsl:attribute>
<xsl:attribute name="onclick">tvpop('<xsl:value-of select="./@url"/>');return false;</xsl:attribute>
<xsl:attribute name="target">new</xsl:attribute>
<xsl:variable name="sttitle" select="."/>
<xsl:value-of select="ms:rtnTitle(string($stdte),string($sttitle))" disable-output-escaping="yes"/>

And here is the relevant XML node that the above is transforming:
<title st="10/08/2007 1:20:00 AM" du="30" url="/guide/index.cfm?action=session_info&amp;event_id=18465952">Shopping for Love</title>

Putting these together gives the following HTML:
<a href=";event_id=18465952" onclick="tvpop(';event_id=18465952');return false;" target="new">Shopping for Love</a>

If you look closely, the first time that the @url attribute is selected, the QS parameter outputs correctly: "action=session_info".  However, in the second select of the @url attribute(where it is used in the onclick event) this same value gets manipulated to 'action=/session_info'.

Why is it doing this?  I have tried output escaping, hard coding the 'action=session_info' part of the url but when the transformation is done, it always puts a '/' before session_info.

Can anybody help?  Is this a bug? Is 'action' some sort of key word?
Question by:domaa
    LVL 9

    Accepted Solution

    Could you publish your XML file for more Information.


    Chirag Patel

    Author Comment

    Hi Chirag,

    I've worked out that the problem is not in fact in the XSLT or XML but the parent control that that is instantiating the transformation.

    Corry to bother.

    Author Comment

    Solution not needed

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Shoutout to Emily Plummer ( for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
    HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now