Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<milestone>/@unit causes invalid FO #334

Closed
joeytakeda opened this issue Sep 9, 2018 · 6 comments
Closed

<milestone>/@unit causes invalid FO #334

joeytakeda opened this issue Sep 9, 2018 · 6 comments

Comments

@joeytakeda
Copy link
Contributor

milestone/@unit causes the output FO in the TEI to PDF transformation to be invalid. The @unit value just gets spit out as text.

This sample TEI:

 <div>
            <head>Some Div</head>
            <milestone unit="page"/>
            <ab>Some prose here.</ab>
            
            <milestone unit="nonstructural" type="mode" subtype="verse"/>
            <ab>Some verse here</ab>
         </div>

becomes this bit of FO after being transformed:

<flow flow-name="xsl-region-body" font-family="Times" font-size="10pt">
            <block keep-with-next.within-page="always" id="d27e19" text-align="left"
                font-family="Times" font-size="18pt" font-weight="bold" space-after="6pt"
                space-before.optimum="12pt" text-indent="0em">1. Some Div</block>page <inline
                font-style="normal" font-weight="normal"/><block>Some prose
            here.</block>nonstructural <inline font-style="normal" font-weight="normal"/><block>Some
                verse here</block></flow>

I've tested with the oXygen built in frameworks and the fo.xsl stylesheet (https://raw.githubusercontent.com/TEIC/Stylesheets/dev/fo/fo.xsl) and both have the same invalidity:


text not allowed here; expected the element end-tag or element            "block", "block-container", "change-bar-begin", "change-bar-end",            "float", "index-range-begin", "index-range-end", "list-block",            "multi-properties", "multi-switch", "ns:form", "page-sequence",            "retrieve-marker", "retrieve-table-marker", "table",            "table-and-caption" or "wrapper" (with            xmlns:ns="http://www.antennahouse.com/names/XSL/Extensions")

which causes this error in the transformation scenario in oXygen:


The process 'Apache FOP' ended with code: 1. The error was:  ERROR - net.sf.saxon.trans.XPathException: org.apache.fop.fo.ValidationException: "fo:inline" is not a valid child of "fo:flow"! (See position 2:268) ERROR - Exception org.apache.fop.apps.FOPException: org.apache.fop.fo.ValidationException: "fo:inline" is not a valid child of "fo:flow"! (See position 2:268) net.sf.saxon.trans.XPathException: org.apache.fop.fo.ValidationException: "fo:inline" is not a valid child of "fo:flow"! (See position 2:268) 	at org.apache.fop.cli.InputHandlerFOP.transformTo(Unknown Source) 	at org.apache.fop.cli.InputHandlerFOP.renderTo(Unknown Source) 	at org.apache.fop.cli.Main.startFOP(Main.java:186) 	at org.apache.fop.cli.Main.main(Main.java:217) Caused by: net.sf.saxon.trans.XPathException: org.apache.fop.fo.ValidationException: "fo:inline" is not a valid child of "fo:flow"! (See position 2:268) 	at net.sf.saxon.event.ContentHandlerProxy.handleSAXException(Unknown Source) 	at net.sf.saxon.event.ContentHandlerProxy.startContent(Unknown Source) 	at net.sf.saxon.event.NamespaceReducer.startContent(NamespaceReducer.java:213) 	at net.sf.saxon.event.ComplexContentOutputter.startContent(ComplexContentOutputter.java:721) 	at net.sf.saxon.event.ReceivingContentHandler.startElement(Unknown Source) 	at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) 	at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source) 	at org.apache.xerces.xinclude.XIncludeHandler.emptyElement(Unknown Source) 	at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) 	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) 	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) 	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) 	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) 	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) 	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) 	at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) 	at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:427) 	at net.sf.saxon.event.Sender.send(Sender.java:138) 	at net.sf.saxon.jaxp.IdentityTransformer.transform(IdentityTransformer.java:383) 	... 4 more Caused by: org.apache.fop.fo.ValidationException: "fo:inline" is not a valid child of "fo:flow"! (See position 2:268) 	at org.apache.fop.events.ValidationExceptionFactory.createException(ValidationExceptionFactory.java:38) 	at org.apache.fop.events.EventExceptionManager.throwException(EventExceptionManager.java:58) 	at org.apache.fop.events.DefaultEventBroadcaster$1.invoke(DefaultEventBroadcaster.java:173) 	at com.sun.proxy.$Proxy2.invalidChild(Unknown Source) 	at org.apache.fop.fo.FONode.invalidChildError(FONode.java:561) 	at org.apache.fop.fo.FONode.invalidChildError(FONode.java:537) 	at org.apache.fop.fo.pagination.Flow.validateChildNode(Flow.java:110) 	at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:276) 	at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:179) 	... 22 more  ---------  ; SystemID: file:/Users/joeytakeda/git/misc/milestone-bug.xml_xslt; Line#: 2; Column#: 268 net.sf.saxon.trans.XPathException: org.apache.fop.fo.ValidationException: "fo:inline" is not a valid child of "fo:flow"! (See position 2:268)
--

@martindholmes
Copy link
Contributor

martindholmes commented Nov 16, 2018

What do you think should happen with a milestone element in FO? The current transformation doesn't handle it at all; the question is whether anything should appear in the output for milestone, or it should just be ignored. Also, could you provide a full TEI file which demonstrates the problem? (As simple as possible.)

@joeytakeda
Copy link
Contributor Author

I think it should just be ignored. I don’t believe there is any generic way to display a milestone.

@emylonas
Copy link

emylonas commented Nov 16, 2018 via email

@sydb
Copy link
Member

sydb commented Nov 16, 2018

The usual would be to display the value of @unit, rather than the word “Page”, as there is no particular reason to think the <milestone> is used to mark a page beginning. (In fact, given that that is what <pb> does, it’s kinda unlikely.)

@joeytakeda
Copy link
Contributor Author

joeytakeda commented Nov 16, 2018

Hi Martin,

I didn't see the request for the sample file--apologies. Here is the sample TEI file (attached but also embedded here):

<TEI xmlns="http://www.tei-c.org/ns/1.0">
  <teiHeader>
      <fileDesc>
         <titleStmt>
            <title>Sample TEI File</title>
         </titleStmt>
         <publicationStmt>
            <p>Publication Information</p>
         </publicationStmt>
         <sourceDesc>
            <p>Information about the source</p>
         </sourceDesc>
      </fileDesc>
  </teiHeader>
  <text>
      <body>
         <div>
            <milestone unit="section"/>
            <p>Section begins.</p>
         </div>
         
      </body>
  </text>
</TEI>

milestone-bug.xml.zip

@martindholmes
Copy link
Contributor

Stylesheets group discussed this 2018-11-19. A bugfix will be added by @Syd, and when the fallout from that has been dealt with (if there is any), this ticket can be closed. If anyone thinks there should be processing for milestone, cb, and gb, please raise a ticket explaining exactly what the output should look like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants