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

Discussion in 'XML' started by Geathaa, Sep 12, 2003.

  1. Geathaa

    Geathaa Guest

    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:eek:utput 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.
     
    Geathaa, Sep 12, 2003
    #1
    1. Advertising

  2. 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:eek:utput 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/
     
    Martin Honnen, Sep 12, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dustin D.
    Replies:
    0
    Views:
    2,308
    Dustin D.
    Aug 27, 2003
  2. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,993
    Smokey Grindel
    Dec 2, 2006
  3. TJ
    Replies:
    5
    Views:
    578
  4. Replies:
    10
    Views:
    779
    John Machin
    May 17, 2009
  5. Ken Fine
    Replies:
    2
    Views:
    175
    Ken Fine
    Feb 24, 2004
Loading...

Share This Page