Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XSLT one tamplate opens tag second template closes - newbie

Reply
Thread Tools

XSLT one tamplate opens tag second template closes - newbie

 
 
R
Guest
Posts: n/a
 
      01-15-2005
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

 
Reply With Quote
 
 
 
 
Joris Gillis
Guest
Posts: n/a
 
      01-15-2005
Tempore 15:38:52, die Saturday 15 January 2005 AD, hinc in foro {comp.text.xml} scripsit R <(E-Mail Removed)>:

> 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-v...i?userid=38041)
Deserta faciunt et innovationem appelant
 
Reply With Quote
 
 
 
Reply

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 On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
start a new JFrame from an existing one, and when old JFrame closes new one does not jakester Java 3 04-02-2007 11:13 PM
tamplate class error: "undefined reference" s.z.s@web.de C++ 3 12-05-2006 06:07 PM
how do u invoke Tag b's Tag Handler from within Tag a's tag Handler? shruds Java 1 01-27-2006 03:00 AM
cdrom opens, and immediately closes abc123 A+ Certification 12 04-29-2005 04:12 AM
IE 6 closes as soon as it opens Miggsee Computer Support 7 12-17-2003 12:39 AM



Advertisments