Solved

XSL Style Sheet Header/Footer Issues

Posted on 2006-11-01
8
702 Views
Last Modified: 2008-02-01
Hi,

I am currently using xsl stylesheets to display my xml results.

However I have an issue.

I would like to be able to have a header/footer at the top of each page.......my issue is obviously how do I tell when a page breaks onto the next....the information on the page is dynamic so I cannot plan for a page break.

Are there any work arounds for this or can someone suggest possible alternatives for displaying my documents?? Bearing in mind I need to print these docs.........if I have not made myself clear or you require more info to come up with a valid answer please ask away!!

Thanks in advance.
0
Comment
Question by:scm0sml
  • 4
  • 3
8 Comments
 
LVL 11

Expert Comment

by:Vivek Thangaswamy
ID: 17848539
Hi

We can get the XML documents initial nodes (Top order) and in the header we can place the content whatever we want.

Sample Code:

<xsl:if test="position() = '1'">
      <font face="Verdana" size="2" color="red">
                   <p><b>Buy one Ticket Get One Ticket FREE</b></p>
      <br/>
              </font>
</xsl:if>

For Last

 <xsl:if test="position() = last()">
      Last figure title in chapter: <xsl:value-of select="."/>
  </xsl:if>

And can you explain you situation in more detail please.

More Ref:
http://www.xml.com/pub/a/2002/08/07/ducharme.html
http://www.dpawson.co.uk/xsl/sect2/N6099.html
http://sources.redhat.com/ml/xsl-list/2000-06/msg01049.html
0
 

Author Comment

by:scm0sml
ID: 17848566
Yeah the first and last nodes are not really what I'm after.

I'll have a row......that will contain information on say passenegers, flights, accomodation etc....which can obviously be of different sizes.

When displaying this information it is possible it will spill over onto a second or third page etc.

I am looking for a way by where i can detect this as I'd like to be able to have a repeating header and fotter on each page......like in word etc!!

bit clearer?
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 17848632
Hi scm0sml,

How do you define a page?
Do you want the header and footer repeated when printing HTML pages?
Then I guess your best bet would be CSS

Are you setting up your print environment using XSL-FO?
There are some possibilities in XSL-FO that enable that

Can you tell us a bit more about your environment?

Cheers!
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

Author Comment

by:scm0sml
ID: 17848677
my pages are html and xsl? and yeah i would want theheader/footer printing when pritning the html pages out.

You'l have to excuse me...im just inheriting the docs from a colleague who has left.......some of the jargon u have used about the environment has got me.... :(
0
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 500 total points
ID: 17848809
scm0sml,

XSL-FO is XSL Formatting Objects, what you could use to produce print or PDF from XML
Usual steps use XSL to merge XML into an XSL-FO then use rendering software such as AntennaHouse or FOP to generate PDF from the XSL-FO files.
This is for when you want some more advanced page layout techniques
XSL-FO would help you with headers and footers but it requires a new technology introduced, so maybe not the best bet here

If you are OK with HTML pages printed there are some things you can do with CSS
CSS or Cascading StyleSheets is a language to express layout properties and attach them to HTML pages
It influences how the HTML looks on screen, but there are some facilities to influence how pages are printed differently from how they would look in a browser.

Here is a brief outline from a page
You don't display header and footer on the screen
but you display it on the print version (using the @media selectivity)
you then have to absolutely position the headers and the footers

This is a bit tricky, requires some experimenting and you are propably better of in the CSS TA, I am not that much of a CSS expert

<html>
<head>
<style>
    @media screen, print
    {
      .header {display: none;}
      .footer {display: none;}
    }
    @media print
    {
      .header {put some properties here}
      .footer {put some properties here}
    }
</style>
</head>
<body>

<div class="header">
...put header html here...
</div>
<div class="footer">
...put footer html here...
</div>

</body>
</html>
0
 

Author Comment

by:scm0sml
ID: 17848913
looks like there could be potential there!!

Do i get this transferred over to css or open a new thread?
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 17849056
maybe it is easier if you just create a 20 points, pointer question in the CSS TA
one you can delete after you awarded points here
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 17849063
sorry, just saw you already awarded, thanks
ignore my last comment
good luck @ CSS TA
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question