wordinator icon indicating copy to clipboard operation
wordinator copied to clipboard

Is the documentation for page number formatting correct?

Open gkholman opened this issue 2 years ago • 4 comments

In the schema I read:

        <attribute name="xslt-format">
          <a:documentation>
            <p>Number format as for the XSLT format attribute on the xsl:number instruction.
            This attribute must be specified if @format has the value "custom". If this attribute is
            specified and no value for @format is specified, @format is set to "custom".</p>
          </a:documentation>
        </attribute>

In the test: page-number-format-20230226.zip I have:

<?xml version="1.0" encoding="UTF-8"?>
<wp:document xmlns:wp="urn:ns:wordinator:simplewpml">
  <wp:body>
    <wp:section type="nextPage">
      <wp:page-sequence-properties>
        <wp:page-number-properties start="1" format="custom" xslt-format="i"/>
        <wp:headers-and-footers>
          <wp:header>
            <wp:p style="Normal">
              <wp:page-number-ref/>
            </wp:p>
          </wp:header>
        </wp:headers-and-footers>
        <wp:page-size orient="portrait" width="210mm" height="297mm"/>
      </wp:page-sequence-properties>
      <wp:body>
        <wp:p><wp:run>This is the first page numbered in Roman lower-case</wp:run></wp:p>
      </wp:body>
    </wp:section>
    <wp:section type="nextPage">
      <wp:page-sequence-properties>
        <wp:page-number-properties start="1" format="custom" xslt-format="1"/>
        <wp:headers-and-footers>
          <wp:header>
            <wp:p style="Normal">
              <wp:page-number-ref/>
            </wp:p>
          </wp:header>
        </wp:headers-and-footers>
        <wp:page-size orient="portrait" width="210mm" height="297mm"/>
      </wp:page-sequence-properties>
      <wp:body>
        <wp:p><wp:run>This is the first page numbered in decimal</wp:run></wp:p>
      </wp:body>
    </wp:section>
  </wp:body>
</wp:document>

and yet I'm getting in the console report:

~/t/page-number-format-20230226 $ wordinator.sh . simple.dotx 
+ 2023-02-26 11:58:59,329 [INFO ] Input document or directory='.'
+ 2023-02-26 11:58:59,331 [INFO ] Output directory           ='.'
+ 2023-02-26 11:58:59,331 [INFO ] DOTX template              ='simple.dotx'
+ 2023-02-26 11:58:59,331 [INFO ] XSLT template              =Not specified
+ 2023-02-26 11:58:59,331 [INFO ] Catalog                    =Not specified
+ 2023-02-26 11:58:59,331 [INFO ] Chunk level                ='root'
+ 2023-02-26 11:58:59,732 [INFO ] Generating DOCX file "/Users/admin/t/page-number-format-20230226/./page-number-format-20230226.docx"
+ 2023-02-26 11:58:59,793 [WARN ] Page number format "custom" not supported. Use Word-specific values. Using "decimal"
+ 2023-02-26 11:58:59,827 [WARN ] Page number format "custom" not supported. Use Word-specific values. Using "decimal"
+ 2023-02-26 11:58:59,972 [INFO ] DOCX file generated.

gkholman avatar Feb 26 '23 17:02 gkholman

The source code says:

            // FIXME: Implement translation from XSLT number format values to the equivalent Word
            // number formatting values.

so apparently the documentation is correct, but the code hasn't been written.

larsga avatar Mar 01 '23 14:03 larsga

I suspect the schema may be promising more than it can deliver here, because I'm not sure how to implement this in Word. The problem is that we're not running code inside Word, but simply generating OOXML, so supporting something that's not supported in OOXML seems difficult. But maybe I'm overlooking something.

larsga avatar Mar 01 '23 15:03 larsga

I didn't mention in the ticket that I have worked around this already. Sorry.

I left the ticket as an observation.

-- (Sent from my phone; please excuse any auto-corrupt issues) Contact info, blog, articles, etc. http://www.CraneSoftwrights.com/g/ | Check our site for free XML, XSLT, XSL-FO and UBL developer resources | Streaming hands-on XSLT/XPath 2 training class @ US$125(5 hours free) | Essays (UBL, XML, etc.) http://www.linkedin.com/today/author/gkholman |

On Wed, Mar 1, 2023, 10:19 Lars Marius Garshol, @.***> wrote:

I suspect the schema may be promising more than it can deliver here, because I'm not sure how to implement this in Word. The problem is that we're not running code inside Word, but simply generating OOXML, so supporting something that's not supported in OOXML seems difficult. But maybe I'm overlooking something.

— Reply to this email directly, view it on GitHub https://github.com/drmacro/wordinator/issues/116#issuecomment-1450326252, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKCGXO2FYEBEGD4YZLLNNDWZ5SIRANCNFSM6AAAAAAVISD3L4 . You are receiving this because you authored the thread.Message ID: @.***>

gkholman avatar Mar 01 '23 15:03 gkholman

No problem! I think this one is for Eliot to decide what he wants to do with. At least now I understand the issue.

larsga avatar Mar 01 '23 15:03 larsga