Re: [xsl] String concatenation inside open tag

Subject: Re: [xsl] String concatenation inside open tag
From: Abel Braaksma <>
Date: Tue, 27 Feb 2007 15:24:53 +0100
Jason Solan wrote:
I'm new to XSL.

The problem comes in because I don't know how to parse the parameters. I'm in an open "<a" tag so I can't do (unless I'm mistaken) an

I'm sorry if this type of question has been answered before, I tried searching, but didn't know what to search for to get a hit.

No problem, we all started at the basics. Your best bet is some tutorial that guides you through the processing model of XSLT, and explains you what nodes are, what attribute nodes are and how XSLT creates them. You don't need to do something inside "an open tag", because tags do not exist as far as XSLT is concerned.

A solution:

<a href="something" onclick="someFunc('{@column}');" />

where @column refers to the attribute with the name 'column' in the current processing context.

Another solution:

<a href="something">
  <xsl:attribute name="onclick">
     <xsl:value-of select="@column" />

In the place of "xsl:value-of" you can also do an apply-templates, if you need to parse all kinds of "column" nodes or attributes that need to be placed as parts of your function's parameters.

There are many more ways to do this. The first approach above is, however, by far the simplest and between the {} brackets you can reference any element or attribute using any valid XPath. The {} part is called an "attribute value template" (google for some more pointers on it).

-- Abel Braaksma

Current Thread