Solved

Dynamic Link in XSLT?

Posted on 2003-11-25
5
800 Views
Last Modified: 2013-11-18
Hi All.

In my xslt, I need to have a hyperlink that links to
a)a new window (300w * 500h)
b)sends a querystring to that window based on a node value in the xml.

Usually, when doing straight ASP, I'd use Javascript and put the variable in the querystring.

I tried this, to no avail:

<a href="javascript:new_window('display_invoice.asp?Document="<xsl:value-of select="document"/>"')">
                    <xsl:value-of select="document"/>
</a>

Any ideas??

Thanks!
0
Comment
Question by:ClassyLinks
  • 2
  • 2
5 Comments
 
LVL 26

Expert Comment

by:rdcpro
ID: 9818236
I assume you have a function like:

function new_window(sUrl)
{
var oNewWindow = window.open(sUrl, "ClassyWindow", "heght=500, width=300")
}

This might be in your XSLT, or it mignt be in a Javascript file loaded from a <link> tag.

Regards,
Mike Sharp
0
 
LVL 7

Author Comment

by:ClassyLinks
ID: 9818291
Yes, I have that.

How can I code the variable for the document number into the link?
0
 
LVL 26

Expert Comment

by:rdcpro
ID: 9818422
I don't know what you mean by document number.  There is a node in the XML like <document> that you're using for this?  Or is "document" a variable name?  You're not talking about the XPath document() function, right?

Regards,
Mike Sharp
0
 
LVL 3

Accepted Solution

by:
savalou earned 125 total points
ID: 9818468
Try putting just the element in curly braces:
<a href="javascript:new_window('display_invoice.asp?Document={document}/>')"/>
                   <xsl:value-of select="document"/>

Or else you should use an xsl:attribute tag to create the href attribute.
<a>
<xsl:attribute name="href">javascript:new_window('display_invoice.asp?Document="<xsl:value-of select="document"/>"')
</xsl:attribute>
</a>
I'm not sure about whether all the quotes and tags come out right, perhaps you can try it out.
0
 
LVL 7

Author Comment

by:ClassyLinks
ID: 9818645
Thanks to you both!

The xsl:attribute did the trick.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
The viewer will learn how to dynamically set the form action using jQuery.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

821 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