Loading ...
Sorry, an error occurred while loading the content.

Counting line items

Expand Messages
  • Jason
    I have an XSLT prescription generator that creates PDF file prescriptions for a hospital. A new anti-forgery requirement for this tool is to add a line on the
    Message 1 of 4 , May 7, 2004
    • 0 Attachment
      I have an XSLT prescription generator that creates PDF file
      prescriptions for a hospital. A new anti-forgery requirement for this
      tool is to add a line on the page saying "X prescriptions on this page".

      My problem is that I don't know how to tell the number of
      prescriptions on a given page.

      I know I made some poor decisions when I started this project. It was
      my first XSLT exposure, and I wrote it to iterate over an XML
      document, using a for-each, and essentially do real-time rendering, as
      it goes. So the prescriptions are put onto a page one at a time, so
      the pages just kind of break automatically when the current
      prescription is too long to fit into the remaining space. I have no
      idea how to tell how many items will be on a page.

      Is there a way to do this?

      Thanks.
    • J.Pietschmann
      ... The pagination is done after the transformation, in an independent step. Therefore there is no way to get hold of the number of prescriptions laid out on a
      Message 2 of 4 , May 7, 2004
      • 0 Attachment
        Jason wrote:
        > I have an XSLT prescription generator that creates PDF file
        > prescriptions for a hospital. A new anti-forgery requirement for this
        > tool is to add a line on the page saying "X prescriptions on this page".
        >
        > My problem is that I don't know how to tell the number of
        > prescriptions on a given page.

        The pagination is done after the transformation, in an independent
        step. Therefore there is no way to get hold of the number of
        prescriptions laid out on a certain page in the transformation.

        The layout process itself lacks higher level functionality like
        counting, so no easy solution here either.

        You can try a variety of tricks:
        - Make sure each prescription takes the same vertical space, for example
        by putting it into a fixed height box. You should know now how many
        prescription fit onto a page.
        - Somehow estimate how many lines a prescription takes, and basically
        do pagination during the transformation. Some functionality like
        explicit page breaks, keeps and setting box heigths to the generously
        rounded up cumulated line heigth are probably of utility for keeping
        your layout estimation in sync with the actual pagination.
        - Run a two stage process. Generate the result with a dummy value for
        the numbers per page, then extract the actual number of prescription
        for the pages, capture them in an XML file and then to the production
        run, using the real values. If your target format is PDF, you can
        mark the individual prescriptions with ids, add a table of contents
        with basic links referring to the ids (possibly appended as a dummy),
        then use a PDF library to extract the page number for each id from
        the internal PDF link directory. Getting the number of prescriptions
        per page from there is a simple grouping problem in XSLT.
        There are quite a few alternatives to get the number of prescriptions
        for the individual pages, be creative.

        J.Pietschmann
      • tokukobayashi2002
        Hi! Antenna House XSL Formatter V3.1 can export and import area tree. Area tree is a page-wise formatted result from XSL-FO and retains all information on
        Message 3 of 4 , May 7, 2004
        • 0 Attachment
          Hi!

          Antenna House XSL Formatter V3.1 can export and import area tree.
          Area tree is a page-wise formatted result from XSL-FO and
          retains all information on each page.

          You may export area tree and count the number of prescriptions
          and revise area tree, then import it and generate PDF.

          The minus point is the spac of area tree is not made public
          until yet, it is large and it may change in the future.

          If it is acceptable, please try it.

          Informations are:

          http://www.antennahouse.com/

          Best regards,

          Tokushige Kobayashi



          --- In XSL-FO@yahoogroups.com, "Jason" <jason@e...> wrote:
          > I have an XSLT prescription generator that creates PDF file
          > prescriptions for a hospital. A new anti-forgery requirement for
          this
          > tool is to add a line on the page saying "X prescriptions on this
          page".
          >
          > My problem is that I don't know how to tell the number of
          > prescriptions on a given page.
          >
          > I know I made some poor decisions when I started this project. It
          was
          > my first XSLT exposure, and I wrote it to iterate over an XML
          > document, using a for-each, and essentially do real-time rendering,
          as
          > it goes. So the prescriptions are put onto a page one at a time, so
          > the pages just kind of break automatically when the current
          > prescription is too long to fit into the remaining space. I have no
          > idea how to tell how many items will be on a page.
          >
          > Is there a way to do this?
          >
          > Thanks.
        • Victor Vishnyakov
          One more idea: Retrieve the first and the last number of the subscription on the page usimg markers. Thus in the header (footer) the range of subscriptions for
          Message 4 of 4 , May 10, 2004
          • 0 Attachment
            One more idea:
            Retrieve the first and the last number of the subscription on the page usimg
            markers. Thus in the header (footer) the range of subscriptions for every
            page can be shown.

            Regards,
            Victor Vishnyakov



            > -----Original Message-----
            > From: Jason [mailto:jason@...]
            > Sent: Friday, May 07, 2004 6:58 PM
            > To: XSL-FO@yahoogroups.com
            > Subject: [XSL-FO] Counting line items
            >
            >
            > I have an XSLT prescription generator that creates PDF file
            > prescriptions for a hospital. A new anti-forgery requirement
            > for this tool is to add a line on the page saying "X
            > prescriptions on this page".
            >
            > My problem is that I don't know how to tell the number of
            > prescriptions on a given page.
            >
            > I know I made some poor decisions when I started this
            > project. It was my first XSLT exposure, and I wrote it to
            > iterate over an XML document, using a for-each, and
            > essentially do real-time rendering, as it goes. So the
            > prescriptions are put onto a page one at a time, so the pages
            > just kind of break automatically when the current
            > prescription is too long to fit into the remaining space. I
            > have no idea how to tell how many items will be on a page.
            >
            > Is there a way to do this?
            >
            > Thanks.
            >
            >
            >
            > ------------------------ Yahoo! Groups Sponsor
            > ---------------------~--> Yahoo! Domains - Claim yours for
            > only $14.70 http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/9rHolB/TM
            > --------------------------------------------------------------
            > -------~->
            >
            >
            > Yahoo! Groups Links
            >
            >
            >
            >
            >
            >
          Your message has been successfully submitted and would be delivered to recipients shortly.