Solved

XSL Style Sheet Header/Footer Issues

Posted on 2006-11-01
8
689 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 

Author Comment

by:scm0sml
Comment Utility
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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 60

Accepted Solution

by:
Geert Bormans earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
sorry, just saw you already awarded, thanks
ignore my last comment
good luck @ CSS TA
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
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 video discusses moving either the default database or any database to a new volume.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now