Solved

XSL Style Sheet Header/Footer Issues

Posted on 2006-11-01
8
714 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Is Your DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

 

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

Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

Question has a verified solution.

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

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…

707 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