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

Combining call-template with attribute value templates

Subject: Combining call-template with attribute value templates
From: Frans Englich <frans.englich@xxxxxxxxx>
Date: Wed, 9 Feb 2005 19:10:47 +0000
call templates
I find the following code XSLT code clumsy:

           <xsl:variable name="resultPath">
                <xsl:call-template name="fullName" />

            <a href="{str:encode-uri(concat( 'http://example.com/',
                $resultPath, r:testee/r:name ))}" >
                <xsl:value-of select="r:testee/r:name"/>

In other words, I dynamically create the href attribute with an attribute 
value template, which among other things contains the return value of the 
fullName template. 

What I found clumsy, is that the only reason I use the xsl:variable is that I 
can't squeeze in the template call into the attr val template. Or how is this 

Another way could be to use an xsl:attribute construct:

	<xsl:attribute name="href">
		<xsl:call-template name="fullName" />
		<xsl:value-of select="r:testee/r:name" />

I find it a /bit/ cleaner, but it has one big problem: the content isn't run 
through str:encode-uri().

Any ideas? How would you write my initial code snippet in the cleanest, most 
beautiful way while staying functionally equivalent?



Current Thread


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.
First Name
Last Name
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.