473,326 Members | 2,104 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

AVT / Curly braces : why don't they work for me ?

Hello everyone,

I'm using Xalan for some XSLT transformations. I could have sworn that
some template I wrote worked some time ago, but suddenly it doesnt
seem to work any more ...? Whatever the reason, I wrote the following
simple example to verify the strange behavior of my XSLT
Transformator:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

<xsl:output method="html"/>

<xsl:template match="/">
<xsl:call-template name="Header">
<xsl:with-param name="param1" select="'HelloWorld'"/>
</xsl:call-template>
</xsl:template>

<xsl:template name="Header">
<xsl:param name="param1" select="''"/>
<html><body>

<!-- This prints {$param1} - but why? -->
<h1>{$param1}</h1>
<!-- This prints Hello World - as expected -->
<h1><xsl:value-of select="$param1"/></h1>

</body></html>
</xsl:template>

</xsl:stylesheet>

For all I know, after the transformation both <h1> tags should contain
the String HelloWorld, shouldn't they ? Or am I making some horribly
simple error I'm just too blind to see ;o) ?

Thx for your help.
Jul 20 '05 #1
1 2086


Geathaa wrote:
Hello everyone,

I'm using Xalan for some XSLT transformations. I could have sworn that
some template I wrote worked some time ago, but suddenly it doesnt
seem to work any more ...? Whatever the reason, I wrote the following
simple example to verify the strange behavior of my XSLT
Transformator:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

<xsl:output method="html"/>

<xsl:template match="/">
<xsl:call-template name="Header">
<xsl:with-param name="param1" select="'HelloWorld'"/>
</xsl:call-template>
</xsl:template>

<xsl:template name="Header">
<xsl:param name="param1" select="''"/>
<html><body>

<!-- This prints {$param1} - but why? -->
<h1>{$param1}</h1>
<!-- This prints Hello World - as expected -->
<h1><xsl:value-of select="$param1"/></h1>

</body></html>
</xsl:template>

</xsl:stylesheet>

For all I know, after the transformation both <h1> tags should contain
the String HelloWorld, shouldn't they ? Or am I making some horribly
simple error I'm just too blind to see ;o) ?


AVT means attribute value template so your curly braces have no meaning
outside of an attribute value.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: deko | last post by:
Do I need to use curly brackets in PHP if .. else statements? other constructs? Does it matter? What are Best Practices? Why? thanks in advance... This seems to work WITHOUT curly brackets:...
8
by: Ken in Melbourne Australia | last post by:
If I use the curly bracket syntax (referred to as the complex syntax) within a string, how do I get to call a function within it? The php manual says that the first (or previous) character for...
0
by: Dustin D. | last post by:
Let's say I have a text file with the following: food { fruits { apples oranges pears } dairy { ice_cream {
6
by: STF | last post by:
While reading the C++ tutorial in this page: http://www.cplusplus.com/doc/tutorial/tut2-2.html I'm astonished to learn that we could omit curly brackets in function declaration for single...
5
by: krbyxtrm | last post by:
Hi is there a way to 'manage' function execution using macros? #define MY_CALL_MACRO(MacroName) { g_MacroStack.push_back(MacroName); <some code here...>} such that when i use the...
5
by: TJ | last post by:
I'd like to know how the preprocessor treats curly braces, as compared to how it treats parentheses. What happens if I pass this: { a_function( arg1, arg2, arg3 ) } as an argument to a...
3
by: Grande News | last post by:
Hi, I've got some PHP code that looks like this $cura= ord($data{$pnum*2}); $curb = ord($data{$pnum*2+1}); Notice the curly braces -- does using them make any difference, or will square...
2
by: mauricioarango | last post by:
Hi everybody, I'm a PHP beginner, so please forgive me for this question. I am working on code someone else wrote a long time ago. The code was written without curly braces in many places, which...
2
by: xskltn | last post by:
int main() { { const std::string name = "a string"; std::cout << name << std::endl; { const std::string name = "another string"; std::cout << name << std::endl;}} return 0; } My question is...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.