Solved

Dynamic Link in XSLT?

Posted on 2003-11-25
5
770 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

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

22 Experts available now in Live!

Get 1:1 Help Now