• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 615
  • Last Modified:

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

Hi there,

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

Here is a snippet of the relevant XSLT:
<a>
<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"/>
</a>

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="http://www.yourtv.com.au/guide/index.cfm?action=session_info&event_id=18465952" onclick="tvpop('http://www.yourtv.com.au/guide/index.cfm?action=/session_info&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?
0
domaa
Asked:
domaa
  • 2
1 Solution
 
Chirag1211Commented:
Could you publish your XML file for more Information.

Regards,

Chirag Patel
0
 
domaaAuthor Commented:
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.
0
 
domaaAuthor Commented:
Solution not needed
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now