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

Re: [XSL-FO] Automation about line number

Expand Messages
  • G. Ken Holman
    ... XSL-FO 1.0 does not include this feature, and I did not see it in the proposed 1.1. When I want to number lines of program listings, I use a recursive XSLT
    Message 1 of 6 , Jun 11, 2004
      At 2004-06-10 17:54 +0000, Baiyun Gao wrote:
      >I had a document to create, which need to generate line number for
      >each line, every page will start over from 1. Can somebody give me
      >advise?

      XSL-FO 1.0 does not include this feature, and I did not see it in the
      proposed 1.1.

      When I want to number lines of program listings, I use a recursive XSLT
      call splitting the code into individual line elements at the linefeed
      characters, and then use <xsl:number/> to number these in my XSL-FO.

      Unless a vendor gives you a vendor extension to do line numbering of
      formatted lines, I think you are out of luck.

      .................... Ken


      --
      Public training 3 days XSLT & 2 days XSL-FO: Phoenix,AZ 2004-08-23
      World-wide on-site corporate, govt. & user group XML/XSL training.
      G. Ken Holman mailto:gkholman@...
      Crane Softwrights Ltd. http://www.CraneSoftwrights.com/f/
      Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
      Male Breast Cancer Awareness http://www.CraneSoftwrights.com/f/bc
      Legal business disclaimers: http://www.CraneSoftwrights.com/legal
    • J.Pietschmann
      ... The DocBook XSLT style sheets provide such an extension for Saxon and Xalan, I think. J.Pietschmann
      Message 2 of 6 , Jun 11, 2004
        G. Ken Holman wrote:
        > Unless a vendor gives you a vendor extension to do line numbering of
        > formatted lines, I think you are out of luck.

        The DocBook XSLT style sheets provide such an extension
        for Saxon and Xalan, I think.

        J.Pietschmann
      • J.Pietschmann
        ... argument. Really? 7.15.9 text-align Value: start | center | end | justify | inside | outside | left | right ... The in the angle brackets is
        Message 3 of 6 , Jun 11, 2004
          G. Ken Holman wrote:

          > I looked where you cited and I see no examples of the use of a string
          argument.


          Really?
          7.15.9 "text-align"
          Value: start | center | end | justify | inside | outside | left | right
          | <string> | inherit
          The <string> in the angle brackets is really meant to be an XSLFO
          property expression string, I think, while all the other values are
          enumeration tokens.
          Well, they *could* have been a bit more clear.

          > I checked the CSS citation and saw in the syntax of the CSS
          stylesheet the use of quotes, but I thought that was an artifact of the
          CSS stylesheet syntax.
          >
          > Looking at XSL-FO section 5.11 I note the description of <string> to be:
          >
          > "A sequence of characters"
          >
          > ... which does not imply the need for quotes ... though I will admit
          that if the alignment string were the word "left" you would need to say
          "'left'" in order to distinguish from "left".


          Section 5.9.8 Strings (lexical structure of property expressions):
          "Strings are represented either as literals or as an enumeration token."
          The string literal is cross referenced to the production:
          [20] Literal ::= '"' [^"]* '"' | "'" [^']* "'"
          (see slice5.html#NT-Literal). These quotes are supposed to be inside
          the XML attribute, like for XSLT strings.
          But then, there is the following in 5.9.8:
          "All properties contexts allow conversion from enumeration tokens to
          strings"
          which means the XML attribute
          foo="bar"
          would represent a valid FO property expression, yielding the
          enumeration token bar which may be implicitly converted to the string
          "bar".
          OTOH, an enumeration token is supposed to be a NCName, and a single
          dot is not a NCName (but a single underline character is). Hence
          the need for the quotes. Or so I believe.

          I remember the discussion regarding page number formats:
          <fo:page-sequence format="01" ...
          The expression will be parsed as number, but because the format is
          expected to be a string and in contrast to XPath XSLFO numbers
          can't be implicitely converted into a string, the property is in
          error (and even if implicit conversion was allowed, it would drop
          the leading zero). The errata allow the FO processor specifically
          for this use case to fall back to use the original string value
          of the XML atribute, after trimming leading and trailing whitespace,
          otherwise everybody would be forced to write
          <fo:page-sequence format="'01'" ...
          Duh!

          And I really like the specification of the hyphenation character:
          7.9.5 "hyphenation-character"
          Value: <character> | inherit
          Yeah, chapter 5 doesn't include a specification for a lexical character,
          nor do the errata. This begs the question whether
          <fo:block hyphenation-character="-">
          is really meant to be written this way, because the only plausible
          interpretation of <character> would be "a string consisting of
          a single character". And what about
          <fo:block hyphenation-character="....">
          Yes, four ASCII dots. Why shouldn't this be allowed?

          I'm reminded of the most renowned example of "specification by
          implementation", the C preprocessor - simple, intuitive syntax,
          straightforward implementation, but leading to an utterly convoluted
          formal description for the sake of getting rid of the "dark corners"
          (which makes the quite innocently looking expression 0xE-0xA an invalid
          PP token).

          Specs with holes suck. But then, I've dealt with texts which were much,
          much worse.
          I hope they fix the property expression grammar and the individual
          property specs in XSLFO 2.0

          Regards
          J.Pietschmann
        • Glen Mazza
          Yes, for Docbook: http://www.sagehill.net/docbookxsl/AnnotateListing.html#LineNumbering ... http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/9rHolB/TM
          Message 4 of 6 , Jun 11, 2004
            Yes, for Docbook:

            http://www.sagehill.net/docbookxsl/AnnotateListing.html#LineNumbering


            --- "J.Pietschmann" <j3322ptm@...> wrote:
            > G. Ken Holman wrote:
            > > Unless a vendor gives you a vendor extension to do
            > line numbering of
            > > formatted lines, I think you are out of luck.
            >
            > The DocBook XSLT style sheets provide such an
            > extension
            > for Saxon and Xalan, I think.
            >
            > J.Pietschmann
            >
            >
            > ------------------------ Yahoo! Groups Sponsor
            > --------------------~-->
            > Yahoo! Domains - Claim yours for only $14.70
            >
            http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/9rHolB/TM
            >
            --------------------------------------------------------------------~->
            >
            >
            >
            > Yahoo! Groups Links
            >
            >
            > XSL-FO-unsubscribe@yahoogroups.com
            >
            >
            >
            >
          • Bob Stayton
            Clarification: The DocBook line numbering applies only to programlisting and literallayout elements, not to general text. There is no facility in DocBook
            Message 5 of 6 , Jun 11, 2004
              Clarification: The DocBook line numbering applies only to programlisting and
              literallayout elements, not to general text. There is no facility in
              DocBook stylesheets to number all lines of a document, which is what the
              original question was after.

              Bob Stayton
              Sagehill Enterprises
              DocBook Consulting
              bobs@...


              ----- Original Message -----
              From: "Glen Mazza" <grm7793@...>
              To: <XSL-FO@yahoogroups.com>
              Sent: Friday, June 11, 2004 11:30 AM
              Subject: Re: [XSL-FO] Automation about line number


              > Yes, for Docbook:
              >
              > http://www.sagehill.net/docbookxsl/AnnotateListing.html#LineNumbering
              >
              >
              > --- "J.Pietschmann" <j3322ptm@...> wrote:
              > > G. Ken Holman wrote:
              > > > Unless a vendor gives you a vendor extension to do
              > > line numbering of
              > > > formatted lines, I think you are out of luck.
              > >
              > > The DocBook XSLT style sheets provide such an
              > > extension
              > > for Saxon and Xalan, I think.
              > >
              > > J.Pietschmann
              >
            Your message has been successfully submitted and would be delivered to recipients shortly.