Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 20th, 2005, 07:10 AM
Geathaa
Guest
 
Posts: n/a
Default 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.
  #2  
Old July 20th, 2005, 07:10 AM
Martin Honnen
Guest
 
Posts: n/a
Default Re: AVT / Curly braces : why don't they work for me ?



Geathaa wrote:
[color=blue]
> 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) ?
>[/color]

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

--

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

 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles