Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 14th, 2006, 01:12 AM
Authorized User
 
Join Date: Jun 2006
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default Pass XSL variable back to asp.net page

Hi guys,

I am using a XSL to display a XML data.
The output data is in a form of HTML table.The table is dynamically generated through XSL.The data in the table is displaying the store name.
What I want is when I click the store name the data of that particular store should be displayed on the same page.But the problem is I cant get the value of the row selected in the table.I mean I want to somehow pass the value of the XSL variable from the XSL page to the web page.
Can anybody help me on this
I did got a feedback from joe but it was not complete.

Thanks in advance


 
Old September 14th, 2006, 02:34 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

And the reason it wasn't complete was that you haven't defined your output HTML. If you don't know what your output looks like then it's an HTML problem to start with. You cannot get back to the XML after the transform has run, they are two separate processes. If you want to store data from the source XML in a cross-browser fashion take a look at this thread: http://p2p.wrox.com/topic.asp?TOPIC_ID=49401
That does the same as you want except the example has people instead of stores.

--

Joe (Microsoft MVP - XML)
 
Old September 14th, 2006, 02:34 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Your subject mentions asp.net so I assume you're running the transformation server-side, and that clicking on the store name should cause a request to be sent back to the server? In that case you need the identifier of the store (in some form) to be a parameter in the URL sent back to the server, which you can achieve by generating the HTML as, for example

<a href="http://www.com.com/app?store={$storeId}">Click here</a>

Sorry if I guessed the scenario wrongly.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old September 14th, 2006, 05:08 AM
Authorized User
 
Join Date: Jun 2006
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Michael & Joe,
Thanks for both of ur replies.
I am quite new to the world of XSL jst 1 month.
Michael as u said i can tk a href to the store.

<a href="http://www.com.com/app?store={$storeId}">Click here</a>

There are n number of stores.But is there a way by which I can pass the value of an XSL variable to a variable on a web page.


 
Old September 14th, 2006, 05:17 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

I'm not sure you've understood the processing model.

If you're driving things from an ASP page, then typically the ASP page invokes an XSLT transformation of an XML document to produce an HTML document. The HTML document is then sent to the browser. The user might click on a button. This typically causes an HTTP request to be sent to the server. This can't interact with the original ASP page, which has long since been deactivated. Instead, it must be processed from scratch. The way you control this is that when you generate the HTML page, you put enough information in the links so that when a URL is sent back to the server, the server has enough information to know what to do next.

I hope this makes things clearer.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old September 14th, 2006, 05:27 AM
Authorized User
 
Join Date: Jun 2006
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for ur reply.
But can I take the value from the URL link into a variable on the web page.I desperately need to do that.
Is there any other alternative or else I will have to use a datagrid.

 
Old September 14th, 2006, 05:48 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

I'm not an ASP expert, but I believe you can read the parameters in the requesting URL using syntax such as

Request.QueryString["keyword"]

P.S. It's difficult to learn new technologies when you are trying to meet deadlines. Try to organize yourself better! And don't expect anyone helping you on the net to feel under any pressure just because you are under time pressure - if anything people are less likely to help if they think that you aren't going to take the time to absorb the advice that's been given.



Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old September 14th, 2006, 06:01 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Did you look at the example I linked to?

--

Joe (Microsoft MVP - XML)
 
Old September 14th, 2006, 06:07 AM
Authorized User
 
Join Date: Jun 2006
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes Michael I understand.I was wrong.
I was trying to oversmart others in my company because most of them dont have enought knowledge on XSL.I just wanted to do things differently.
Ok I will end it here.
I greately appreciate all the help I received.







Similar Threads
Thread Thread Starter Forum Replies Last Post
how to pass javascript variable to xsl eruditionist XSLT 4 September 8th, 2008 08:37 AM
pass java variable to xsl variable kathy1016cats XSLT 1 June 14th, 2006 06:23 PM
how to assign fo:page-number to a xsl:variable or jyotsnag XSLT 0 March 14th, 2006 01:49 AM
Pass variable from ASP to MS Word 2000 colinsteadman Classic ASP Professional 2 January 19th, 2004 12:51 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.