Solved

Dynamic Link in XSLT?

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
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 the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

930 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

16 Experts available now in Live!

Get 1:1 Help Now