Solved

Dynamic Link in XSLT?

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Create associate webpages / websites 3 78
How to obtain string using substring and indexOf function 11 59
c# code 19 71
Help with Syntax 9 37
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
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).

773 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