Help with printing a fixed header and footer?

Discussion in 'XML' started by will, Aug 6, 2003.

  1. will

    will Guest

    Dear All, can anyone help here?

    I need to use XML/XSLT to print out some documents which must all have
    the same letterhead and footer section on all pages. The section in
    between is dynamic XML, and will be of variable length.

    Is it possible in XSLT to specify that this section must appear on
    every page in this position?

    And what is the best strategy for specifying that the variable XML
    data between the header and footer must automatically roll on to
    another sheet if necessary?

    If anyone could give me a rough idea of whether this is possible, or
    could point me in the direction of something on the web that deals
    with this challenge, I'd be grateful. I'm pretty new to this stuff.

    Thank you.

    Will
     
    will, Aug 6, 2003
    #1
    1. Advertising

  2. Hi,

    If you need to stick with XSLT, then you will have to transform your XML
    data into HTML pages, and use a CSS2 compliant to get them printed with the
    layout you want. The way to create headers and footers in HTML pages with
    CSS2 is explained in the CSS2 Specification (http://www.w3.org/TR/REC-CSS2),
    chapter 9.6.1.
    If you can use XSL (XSLT + XSL-FO) (http://www.w3.org/TR/xsl), you will
    have a much better control of the rendering and create headers and footers
    at your will (see chapter 6.4).

    Hope this helps.
    Mac

    "will" <> a écrit dans le message de news:
    ...
    > Dear All, can anyone help here?
    >
    > I need to use XML/XSLT to print out some documents which must all have
    > the same letterhead and footer section on all pages. The section in
    > between is dynamic XML, and will be of variable length.
    >
    > Is it possible in XSLT to specify that this section must appear on
    > every page in this position?
    >
    > And what is the best strategy for specifying that the variable XML
    > data between the header and footer must automatically roll on to
    > another sheet if necessary?
    >
    > If anyone could give me a rough idea of whether this is possible, or
    > could point me in the direction of something on the web that deals
    > with this challenge, I'd be grateful. I'm pretty new to this stuff.
    >
    > Thank you.
    >
    > Will
     
    Mathieu CARTOIXA, Aug 6, 2003
    #2
    1. Advertising

  3. will

    Andy Fish Guest

    XSLT is not a page layout language, it's purely an XML transformation
    language, so it depends what output format you are going to generate.

    If you're thinking of outputting HTML or plain text and working out where
    the end of a page would be, forget it, certainly with XSLT. If you're
    outputting plain text and can bank on the same number of lines each page,
    write a post-process (not XSL) which counts the lines and puts the footers
    on. For HTML you're screwed because it's the rendering engine that decides
    how big various fonts are and how much to put on a page.

    I would suggest you generate RTF or FO. These have the concept of footer so
    you can just specify the footer and leave the page formatting to the
    subsequent layout process. AFAIK HTML does not have the concept of a page
    header or footer.

    Andy

    "will" <> wrote in message
    news:...
    > Dear All, can anyone help here?
    >
    > I need to use XML/XSLT to print out some documents which must all have
    > the same letterhead and footer section on all pages. The section in
    > between is dynamic XML, and will be of variable length.
    >
    > Is it possible in XSLT to specify that this section must appear on
    > every page in this position?
    >
    > And what is the best strategy for specifying that the variable XML
    > data between the header and footer must automatically roll on to
    > another sheet if necessary?
    >
    > If anyone could give me a rough idea of whether this is possible, or
    > could point me in the direction of something on the web that deals
    > with this challenge, I'd be grateful. I'm pretty new to this stuff.
    >
    > Thank you.
    >
    > Will
     
    Andy Fish, Aug 6, 2003
    #3
  4. Hi,

    In this case, all you need is (in HTML, with a compatible browser) to
    define a THEAD and a TFOOTER section in your TABLE. If you will use plain
    XML, see CSS2 (http://www.w3.org/TR/REC-CSS2), chapter 17.2.
    Please note that your table must NOT have the "layout" property set to
    "fixed"...
    Mac

    "will" <> a écrit dans le message de news:
    ...
    > Just a little clarification. The XSLT creates HTML which is then
    > viewed in a browser and printed by the user. My XSLT currently outputs
    > tables of a set height to match the A4 page size. This works fine if
    > the XML data in the centre of the document is a small volume. But if
    > there is a lot of XML data, the current footer will get pushed down
    > the page onto the next printed sheet, so I need a way to fix the
    > footer to each page, and have the XML data text flowing round it (and
    > round the header on the next page).
    >
    > Thank you, Will
     
    Mathieu CARTOIXA, Aug 6, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    519
    Leif K-Brooks
    Oct 25, 2006
  2. Peter
    Replies:
    9
    Views:
    8,209
    Peter
    Jun 16, 2009
  3. Henrik
    Replies:
    1
    Views:
    463
    Ken Cox [Microsoft MVP]
    Jul 6, 2006
  4. fjanon
    Replies:
    5
    Views:
    388
  5. Andrew Poulos

    Control header/footer printing

    Andrew Poulos, Mar 6, 2008, in forum: Javascript
    Replies:
    4
    Views:
    295
    Jeff North
    Mar 9, 2008
Loading...

Share This Page