Solved

XSL Style Sheet Header/Footer Issues

Posted on 2006-11-01
8
712 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PowerShell script to remove string in xml file 3 49
How to implement an additional command 16 54
PHP delete contents of file- before writing to it 6 68
xml files 7 62
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 …
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

736 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