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

Re: passing parameters to xsl stylesheets

Subject: Re: passing parameters to xsl stylesheets
From: mozer <xmlizer@xxxxxxxxx>
Date: Sun, 20 May 2007 17:06:01 +0200
Re:  passing parameters to xsl stylesheets
You are passing parameter !
you said to xsltproc that $toto is equal to 'from'
And it did what you wanted

In fact, it seems you want more
you want to tell to xproc to "use the value 'from' as the name of the
element where to get value"

you need to change your xslt for that


<?xml version="1.0" encoding="ISO-8859-1" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:param name="toto" /> <xsl:template match="/note"> <html> <body> <xsl:value-of select="*[local-name()=$toto]" /> </body> </html> </xsl:template> </xsl:stylesheet>

Regards,

Xmlizer

On 5/20/07, Youness HAFFANE <youness254@xxxxxxxxx> wrote:

Hi all Will you help me please? I'm trying to pass a parameter to the following xsl stylesheet:


<?xml version="1.0" encoding="ISO-8859-1" ?> - <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:param name="toto" /> - <xsl:template match="/note"> - <html> - <body> <xsl:value-of select="$toto" /> </body> </html> </xsl:template> </xsl:stylesheet>

The xml file which uses the xsl file is simply:

<?xml version="1.0" ?>
- <note>
   <to>Tove</to>
   <from>Jani</from>
</note>

To pass the parameter I use this command:
$ xsltproc --stringparam toto 'from' myxslfile.xsl myxmlfile.xml

The result is:
<html><body>from</body></html>
While I was expecting <html><body>Jani</body></html>

Thank you in advance!!
Youness (france)

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.