Subject: Re: [xsl] xsl:param syntax please From: "Java XML" <jaxlive@xxxxxxxxxxx> Date: Wed, 18 Apr 2001 15:01:03 -0400 |
a.xml ----- <details> <name>jax</name> </details>
Thanx JAX
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx> Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx To: "Java XML" <jaxlive@xxxxxxxxxxx> CC: XSL-List@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] xsl:param syntax please Date: Wed, 18 Apr 2001 18:51:00 +0100
> <xsl:for-each select="parameter"> > <xsl:param name="'concat('preParameterValue',position())" select="'abcdef'"/>> > <name><xsl:value-of select="name"/></name> > <value><xsl:value-of > select="$concat('preParameterValue',position())"/></value> > </xsl:for-each> > > i want to create a parameter in the above way i am able to creat it > but i dontknow how to get the value of that parameter is there any > other way to do that
I think that you're hoping that the above would name parameters dynamically - $preParameterValue1, $preParameterValue2 and so on. I'm afraid that you can't do that in XSLT.
I'm a bit confused, though, by the way that you're using xsl:param - xsl:param should only be used as the first child of xsl:template (for passing parameters into a template) or of xsl:stylesheet (for passing parameters into a stylesheet). I think that in the above you're trying to use xsl:param as a synonym for xsl:variable, so you're trying to store the string 'abcdef' as a variable, and then retrieving it.
<!-- iterate over the parameter elements --> <xsl:for-each select="parameter"> <!-- create a name element, with a value equal to the value of the name subelement of the parameter element --> <name><xsl:value-of select="name" /></name> <!-- create a value element, with a value equal to the string 'abcdef' --> <value>abcdef</value> </xsl:for-each>
<!-- iterate over the parameter elements --> <xsl:for-each select="parameter"> <!-- set the $preParameterValue variable to the string 'abcdef' --> <xsl:variable name="preParameterValue" select="'abcdef'" /> <!-- create a name element, with a value equal to the value of the name subelement of the parameter element --> <name><xsl:value-of select="name" /></name> <!-- create a value element, with a value equal to the value of the $preParameterValue variable --> <value><xsl:value-of select="$preParameterValue" /></value> </xsl:for-each>
If you need to have a set of variables holding a number of values, but don't know how many variables you're going to need, then you should use the equivalent of an array in XSLT - you should create a result tree fragment, which you can then turn into a node set in order to get its content.
However, it's really not clear what you're trying to achieve with the above code snippet; it's likely that there's another way of doing whatever you're trying to do, and if you give us more information then we'll be glad to help you with it.
--- Jeni Tennison http://www.jenitennison.com/
_________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] xsl:param syntax please, Michael Kay | Thread | Re: [xsl] xsl:param syntax please, Jeni Tennison |
Re: [xsl] xsl:param syntax please, Jeni Tennison | Date | Re: [xsl] xml too big, Kurt Cagle |
Month |