XSLT one tamplate opens tag second template closes - newbie

Discussion in 'XML' started by R, Jan 15, 2005.

  1. R

    R Guest

    Hello everybody.

    I've got a problem with creating a universal stylesheet eg:

    <xsl:template match="/">
    <xsl:call-template name="header"/>
    <xsl:apply-templates select="/data/content"/>
    <xsl:call-template name="footer"/>
    </xsl:template>

    inside header tamplate I've got sth like this:

    <xsl:template name="header">
    <html>
    <head>
    <title>
    <xsl:value-of select="$Title"/>
    </title>
    </head>
    <body>
    </xsl:template>

    as You can see the html and body tags are open...

    and the footer template would print some additional info and would
    close:
    </body> and </html>

    it is of course not well-formed document and won't compile

    but for sure it can be omitted somehow, many of You probably use
    similar constructions

    thanks in advance for Your help
    best regards R
    R, Jan 15, 2005
    #1
    1. Advertising

  2. R

    Joris Gillis Guest

    Tempore 15:38:52, die Saturday 15 January 2005 AD, hinc in foro {comp.text.xml} scripsit R <>:

    > I've got a problem with creating a universal stylesheet eg:
    >
    > <xsl:template match="/">
    > <xsl:call-template name="header"/>
    > <xsl:apply-templates select="/data/content"/>
    > <xsl:call-template name="footer"/>
    > </xsl:template>
    >
    > inside header tamplate I've got sth like this:
    >
    > <xsl:template name="header">
    > <html>
    > <head>
    > <title>
    > <xsl:value-of select="$Title"/>
    > </title>
    > </head>
    > <body>
    > </xsl:template>
    >
    > as You can see the html and body tags are open...
    >
    > and the footer template would print some additional info and would
    > close:
    > </body> and </html>

    Hi,

    Try to think in terms of tree output instead of sequential output when you're making XSL.
    Just restructure it so that it is well-formed and makes more sence. e.g. :

    <xsl:template match="/">
    <html>
    <head>
    <xsl:call-template name="header"/>
    </head>
    <body>
    <xsl:apply-templates select="/data/content"/>
    <xsl:call-template name="footer"/>
    </body>
    </html>
    </xsl:template>

    <xsl:template name="header">
    <title>
    <xsl:value-of select="$Title"/>
    </title>
    </xsl:template>


    regards,
    --
    Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041)
    Deserta faciunt et innovationem appelant
    Joris Gillis, Jan 15, 2005
    #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. shruds
    Replies:
    1
    Views:
    783
    John C. Bollinger
    Jan 27, 2006
  2. loveNUNO
    Replies:
    2
    Views:
    908
    loveNUNO
    Nov 20, 2003
  3. Bernd Fuhrmann
    Replies:
    0
    Views:
    438
    Bernd Fuhrmann
    Feb 12, 2004
  4. Replies:
    3
    Views:
    392
  5. jakester
    Replies:
    3
    Views:
    1,821
    jakester
    Apr 3, 2007
Loading...

Share This Page