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

Re: String concatenation inside open tag

Subject: Re: String concatenation inside open tag
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Tue, 27 Feb 2007 15:24:53 +0100
Re:  String concatenation inside open tag
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:text>someFunc('</xsl:text>
     <xsl:value-of select="@column" />
     <xsl:text>');</xsl:text>
 </xsl:attribute>
</a>

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).

Cheers,
-- Abel Braaksma
  http://www.nuntia.nl

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.