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 March 22nd, 2005, 05:59 AM
Authorized User
 
Join Date: Mar 2005
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.


 
Old March 22nd, 2005, 08:48 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
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)
 
Old March 22nd, 2005, 08:52 AM
Authorized User
 
Join Date: Mar 2005
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

 
Old March 22nd, 2005, 08:55 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
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)
 
Old March 22nd, 2005, 09:06 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 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
 
Old March 22nd, 2005, 09:08 AM
Authorized User
 
Join Date: Mar 2005
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.

 
Old March 22nd, 2005, 09:13 AM
Authorized User
 
Join Date: Mar 2005
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.






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





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