Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 22nd, 2005, 05:59 AM
Authorized User
 
Join Date: Mar 2005
Location: , , .
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to get request parameters on client-side

I have a small webspace where I store a xsl-file and a xml-file:

http://members.chello.se/spelbetyg/blog.xml

which is transformed by

http://members.chello.se/spelbetyg/blog.xsl

What I would like to do is to add a function to change the sort order of the blog posts.

Is there any way I can pass parameters with the request so that I can change the <xsl:sort> to sort by ascending or descending depending on the request parameter.

Since my server does not allow server scripting I have to solve this problem on the client-side.

I know this can be done by using javascript, but I would like to see a XSLT solution.

Please help.


Reply With Quote
  #2 (permalink)  
Old March 22nd, 2005, 08:48 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

As far as I know this can't be done. XSLT has no standard provision for external input from a querystring. What browsers are you targetting?

--

Joe (Microsoft MVP - XML)
Reply With Quote
  #3 (permalink)  
Old March 22nd, 2005, 08:52 AM
Authorized User
 
Join Date: Mar 2005
Location: , , .
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I would like it to work with Internet Explorer and Firefox.

Reply With Quote
  #4 (permalink)  
Old March 22nd, 2005, 08:55 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Well I'm no expert with Firefox but you cannot do it directly with IE. You would need a html page that scripted the transformation on the client after reading the querystring.

--

Joe (Microsoft MVP - XML)
Reply With Quote
  #5 (permalink)  
Old March 22nd, 2005, 09:06 AM
mhkay's Avatar
Wrox Author
Points: 18,438, Level: 59
Points: 18,438, Level: 59 Points: 18,438, Level: 59 Points: 18,438, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,954
Thanks: 0
Thanked 290 Times in 285 Posts
Default

You need to write an HTML page containing JavaScript to invoke the transformation. Sarissa provides a transformation API that works with both IE and Firefox.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote
  #6 (permalink)  
Old March 22nd, 2005, 09:08 AM
Authorized User
 
Join Date: Mar 2005
Location: , , .
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I see that it's out of range for a stylesheet to import request parameters, but wouldn't it be nice to have

<xsl:stylesheet ...
<xsl:param name="arg1"/>
...

and that $arg1 contains the value of blaha.xml?arg1= in the request row?

I think XSLT has potential on the client-side. Passing params from request-row would increase the use of client-side XSLT a lot.

Reply With Quote
  #7 (permalink)  
Old March 22nd, 2005, 09:13 AM
Authorized User
 
Join Date: Mar 2005
Location: , , .
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default

mhkay: "an HTML page containing JavaScript to invoke the transformation"

And that is exactly what I would not like to do. Client-side Javascript produces a security warning from the browsers telling you that the code could be harmful. Otherwise, I would have used Javascript's capabilities and document.write(); instead of XSLT.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get client side encoded request in web serv Jitendrab C# 2005 1 October 29th, 2008 04:44 PM
Problem Converting Client-side to Server-side Code kwilliams ASP.NET 2.0 Professional 1 November 21st, 2007 05:25 PM
Firing server side events at client side codes mehdi62b ASP.NET 1.0 and 1.1 Basics 6 May 18th, 2005 09:11 AM
sharing a server-side variable with client-side pigtail Javascript How-To 6 November 4th, 2004 02:01 AM
Accessing Server Side Data on Client Side steve456 Classic ASP Professional 3 October 15th, 2003 02:33 PM



All times are GMT -4. The time now is 05:50 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.