xsl-list
[Top] [All Lists]

RE: Insert Footer And not Header using XSL

2004-01-12 05:58:38
Hi,

yeah you were correct in saying that match should contained "body" rather than 
"html".

Basically I want to insert both header as well as footer through same XSL. 

Something like:

1.For Header-Block:
<xsl:template  match="body">
        Header_Text
        <a href="http://www.google.com";>
        <img src="D:\logo.gif"/></a>
        <xsl:apply-templates select="*|text()|@*" /> 
 </xsl:template>

2.For Footer-Block:
<xsl:template  match="body">
        <xsl:apply-templates select="*|text()|@*" /> 
        Footer_text
                <a href="http://www.google.com";>
        <img src="D:\logo.gif"/></a>
</xsl:template>

3.For Copy-Block:
<xsl:template match="*|text()|@*">
<xsl:copy>
<xsl:apply-templates select="*|text()|@*"/>
</xsl:copy>
</xsl:template>

I want independent Header/footer Block. Both Block should be such that if I 
insert both in the XSL, It should perform the desired operations. i.e. adding 
header and footer. I know that first and second blocks cann't be written 
simultaneously as both uses "body" in the match option. 
So, I think if somehow I can get the end of Body Element in Footer-Block 
(second block) above my work would be easier. Do let me know if someone can 
think of better way.

thanks and regards,
Animesh


-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com]On Behalf Of 
David
Carlisle
Sent: Monday, January 12, 2004 5:28 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Insert Footer And not Header using XSL



Hi,

Sorry I want to insert Footer instead of Header on the following line:

<xsl:template  match="html">
<xsl:copy>Header_text
<a href="http://www.google.com";>
<img src="/></a>
  <xsl:apply-templates select="*|text()|@*" /> 
 </xsl:copy>
 </xsl:template>

<xsl:template match="*|text()|@*">
<xsl:copy>
<xsl:apply-templates select="*|text()|@*"/>
</xsl:copy>
</xsl:template>

I don't want to change the second block of template. It will remain there. 
Want to modify the first template so that a footer can be inserted.


Isn't this clear??? your link and image only come at the top because you
have them before the  <xsl:apply-templates, if you put them after that,
they will come at the bottom.

Note that your current header, and your footer if you add it to that
template are completely invalid html. An (xhtml version of an) html
document should have the structure
<html>
<head>
 <title>..</title>
</head>
<body>
...
</body>
</html>

So you really want to add you head and foot sections to the body
element, not to the html one. So you probably want to change
match="html" to match="body"

David

-- 
http://www.dcarlisle.demon.co.uk/matthew

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>