[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Passing parameters to xsl-stylesheet

Subject: RE: Passing parameters to xsl-stylesheet
From: ben <ben@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 31 Jan 2002 14:58:02 -0000
pass parameter to xsl vbscript
Hi Raguld,

Try something like this ...

ASP fragment;
   Dim oXSL,oXML,sXML,template,processor

   Set oXSL = Server.Createobject("MSXML2.FreeThreadedDOMDocument30")
   oXSL.async = False
   oXSL.validateOnParse = True
   oXSL.Load (pstrStyleXML)

   Set oXML = Server.Createobject("MSXML2.DOMDocument")
   oXML.async = False
   sXML = "<YOURXML><PERSON fname="John" lname="Smith"></PERSON><PERSON
fname="Bob" lname="Jones"></PERSON></YOURXML>"
   oXML.LoadXML sXML

   Dim template, processor
   Set template = Server.Createobject(MSXML2.XSLTemplate30)
   Set template.stylesheet = oXSL
   Set processor = template.createProcessor
   processor.input = oXML
   processor.addParameter "myparam", "fname"
   processor.Transform
                      
   Response.Write processor.output
   Response.End

End ASP fragment.

XSL Fragement;
   <xsl:stylesheet ....>		
	
	<xsl:param name="myparam"/>

	<xsl:template match="/">
		<xsl:apply-templates select="YOURXML">
	</xsl:template>

	<xsl:template match="YOURXML">
		<xsl:for-each select="PERSON">
			<xsl:sort select="@*[name() = $myparam]"/> 
			<td>
				<xsl:value-of
select="concat(@fname,',',@lname)</xsl:value-of>
			</td>			
		<xsl:for-each>		
	</xsl:template>
	...

	... 

   </xsl:stylesheet>

This is using server side VBScript in your ASP file.

Cheers,
Ben

-----Original Message-----
From: Ragulf Pickaxe [mailto:jawxml@xxxxxxxxxxx]
Sent: 31 January 2002 14:04
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  Passing parameters to xsl-stylesheet


Hello all,

What is the exact syntax of passing an argument (parameter) from an asp-page

to an xsl-stylesheet and what is the syntax for recieving the parameter in 
the stylesheet?

I have a stylesheet that sorts an xml-file by various methods and want the 
user to be able to choose which method to sort by.

Sorry, I know this is a real newbee question, and I have seen answers for it

before, but I can't find the answer in the archive and Michael Kay only 
describe the passing in general terms that I can find (p. 284 in second 
edition).

Sincerly
Raguld Pickaxe :)

_________________________________________________________________
Join the world's largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit http://www.messagelabs.com
________________________________________________________________________

===========================================================
Pulse Software Systems Limited.
Pulse House, 5 & 7 Gravel Hill, Leatherhead, Surrey. KT22 7HG
Tel: (01372) 220600 Fax: (01372) 362476
Web: http://www.pulsesoftware.co.uk

This e-mail (and any attachments) may contain confidential or privileged information. If you are not the intended recipient 
or you receive this message in error please notify us immediately and delete the e-mail. Should this be the case then you are notified that any dissemination, distribution, or copying of this communication and its attachments is strictly prohibited.

This message has been checked for all known viruses by the 
Message Labs Virus Scanning Service. For further information visit 
http://www.messagelabs.com/stats.asp

Neither Pulse Software Systems nor the sender accepts any liability or 
responsibility for viruses or for any damage you may sustain. You should perform your own virus checks before opening any attachments. 
===========================================================

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.