View Single Post
  #1 (permalink)  
Old May 6th, 2008, 11:15 AM
iceandrews iceandrews is offline
Authorized User
Points: 340, Level: 6
Points: 340, Level: 6 Points: 340, Level: 6 Points: 340, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Apr 2008
Location: , OH, USA.
Posts: 70
Thanks: 17
Thanked 1 Time in 1 Post
Send a message via Yahoo to iceandrews
Default Param in template match=" "

I have a XSLT where I’m getting a variety of Parameters from a variety of sources. All of these Parameters are supplied as plain strings.

For example <xsl:param name="ElementName" select="/.." /> might be fed the plain value of 'Apple'.

Others look like <xsl:param name="Pathstring" select="/.." /> and contain '//Parent/Apple|//Parent/Oranges'.

In the case of the param $Pathstring, I make use of saxon:evaluate() to parse the string into a valid xpath expression. I understand this portion of it.

But I need to create a template match by using the string supplied in a param as PART of an expression. I'm having some troubles doing this.

I know this isn't correct, but it shows what I'm logically trying to do. I would like a template that matches like this.
<xsl:template match="Parent/$ElementName">
In other words I want the match="Parent/$ElementName" to evaluate as a valid xpath expression match="Parent/Apples" Taking the string from the parameter and using as part of xpath expression. I've tried making use of the saxon:evaluate and expression functions in combination to get it to match correctly. I'm still new to XSLT and staring at this any longer is just confusing me :)

Thanks, this community has been really helpful.

Reply With Quote