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

RE: referencing a param inside a template

Subject: RE: referencing a param inside a template
From: sara.mitchell@xxxxxxxxx
Date: Mon, 20 May 2002 18:20:37 -0400
xslt get attribute values
Yes, you're missing something called an attribute value
template (admittedly, the name is not intuitive). 

First, I'm assuming that you have something like 
this: 

<xsl:param name="ID" /> 

at the top of your stylesheet and this is the param 
that you are passing in. If so, change your syntax
to: 

 <xsl:template match="program">
 		<input type='hidden' name='unique-id'
 value='{$ID}'></input>
 </xsl:template>

The braces {} tell the XSLT engine to evaluate the content
which in this case is the parameter named ID.

Sara

> -----Original Message-----
> From: Jeff Barrett [mailto:JBarrett@xxxxxxxxxxxxxxx]
> Sent: Monday, May 20, 2002 2:52 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  referencing a param inside a template
> 
> 
> I am trying to reference information passed into an XSL 
> stylesheet (via
> java's transformer.setParameter() method) in the output of a template,
> but I'm running into some trouble.  My output is html and the 
> parameter
> I'm passing in needs to be an attribute value in the html.  I've tried
> this two ways.  First I tried putting the parameter directly into the
> output HTML like so:
> 
> 
> <xsl:template match="program">
> 		<input type='hidden' name='unique-id'
> value='$ID'></input>
> </xsl:template>
> 
> This results in the $ID NOT being evaluated as a paramter or variable,
> but the plain string "$ID".
> 
> My next attempt was to use the xsl:value-of tag:
> 
> <xsl:template match="program">
> 		<input type='hidden' name='unique-id'
> value='<xsl:value-of select="$ID"'></input>
> </xsl:template>
> 
> But that won't work because according to the error I get: attribute
> values may not contain '<'.
> 
> Am I missing something?  Are params/variables only to be used in XPath
> expressions?
> 
> thanks,
> +jeff
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 

 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.