473,657 Members | 2,921 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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:styleshe et 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="'HelloW orld'"/>
</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:valu e-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 2099


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:styleshe et 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="'HelloW orld'"/>
</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:valu e-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
12945
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: if(ereg("Win", getenv("HTTP_USER_AGENT"))) $visos = "Windows"; elseif((ereg("Mac", getenv("HTTP_USER_AGENT"))) || (ereg("PPC",
8
6834
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 the curly bracket has to be a dollar sign '$'. This is fine for variables, arrays and some objects but doesn't allow me to call a function such as addslashes() or trim() before I return the string in the variable.
0
2971
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
6644
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 instruction as is written in the paragraph: "statement is the function's body. It can be a single instruction or a block of instructions. In the latter case it must be delimited by curly brackets {}." But I'm not sure if this is true. At least with...
5
3563
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 macro like this: MY_CALL_MACRO("MyMacroName")
5
8948
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 function macro? Does it get passed in whole, or split into smaller parts like so:
3
5360
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 brackets do the same thing? Thanks B
2
1589
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 for the most has been ok. However I am getting an error message that -for the code snippet I posted below- would read like this: Notice: Undefined variable: f in ... on line 3. Precisely a section that has a couple of loops and conditionals...
2
1963
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 why do the curly braces inside the method not throw any
0
8385
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8303
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8821
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8502
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8602
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7316
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1601
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.