Subject: Pass XSL variable back to asp.net page
Posted By: ayamas Post Date: 9/14/2006 1:12:25 AM
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


Reply By: joefawcett Reply Date: 9/14/2006 2:34:29 AM
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)
Reply By: mhkay Reply Date: 9/14/2006 2:34:31 AM
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
Reply By: ayamas Reply Date: 9/14/2006 5:08:07 AM
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.


Reply By: mhkay Reply Date: 9/14/2006 5:17:44 AM
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
Reply By: ayamas Reply Date: 9/14/2006 5:27:48 AM
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.

Reply By: mhkay Reply Date: 9/14/2006 5:48:24 AM
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
Reply By: joefawcett Reply Date: 9/14/2006 6:01:38 AM
Did you look at the example I linked to?

--

Joe (Microsoft MVP - XML)
Reply By: ayamas Reply Date: 9/14/2006 6:07:09 AM
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.



Go to topic 49680

Return to index page 175
Return to index page 174
Return to index page 173
Return to index page 172
Return to index page 171
Return to index page 170
Return to index page 169
Return to index page 168
Return to index page 167
Return to index page 166