[xep-support] Re: line 1: Incorrect top element - should be 'root'

From: Kevin Brown <kevin_at_ADDRESS_REMOVED>
Date: Thu May 03 2018 - 10:11:07 PDT

Please read this excellent post on Stackoverflow.

https://stackoverflow.com/questions/1344158/xslt-with-xml-source-that-has-a-default-namespace-set-to-xmlns
X4U is not doing anything except processing the results of Saxon transform which is  nothing. The namespace is your XML does not match anything in the XSLT.
Kevin

Sent from my Verizon, Samsung Galaxy smartphone
-------- Original message --------From: Stephen Taylor <stephen@kx.com> Date: 5/3/18 1:08 AM (GMT-08:00) To: XEP Support <xep-support@renderx.com> Subject: [xep-support] Re: line 1: Incorrect top element - should be 'root'
That would be consistent with the following experiment. If I take the XML in its ‘working’ form and change the root element from article to book I get the same error message. 
However, using xsltproc for the initial XSLT from XML (xmlns attribute included) produces valid FO XML:
<?xml version="1.0"?><fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xlink="http://www.w3.org/1999/xlink"><fo:layout-master-set><fo:simple-page-master master-name="cover-page" page-width="210mm" …
which x4u renders happily to PDF.
That suggests the answer to my question Is there a better solution to this than removing the attribute?  might be: Yes, use xsltproc for the initial transform to FO. Hard to imagine RenderX being satisfied with this answer, though. 
Let me also draw your attention to the error report from x4u:
(document [system-id file:/Users/sjt/Projects/kx/tmp/aws/aws.xml]  (validate     [error] file:/Users/sjt/Projects/kx/tmp/aws/aws.xml: line 1: Incorrect top element - should be 'root'    [validation total: 1 error]    [error] com.renderx.xep.lib.FormatterException: Invalid XSL FO source 'file:/Users/sjt/Projects/kx/tmp/aws/aws.xml': 1 error found during validation    [error] javax.xml.transform.TransformerException: com.renderx.xep.lib.FormatterException: Invalid XSL FO source 'file:/Users/sjt/Projects/kx/tmp/aws/aws.xml': 1 error found during validation    [error] formatting failed    [error] javax.xml.transform.TransformerException: com.renderx.xep.lib.FormatterException: Invalid XSL FO source 'file:/Users/sjt/Projects/kx/tmp/aws/aws.xml': 1 error found during validation
Formatting failed
We suppose the error to be in the FO produced by the initial transform. Above it is reported helpfully as Invalid XSL FO source but misleadingly as a validation error in line 1 of the original XML source. 
That would of course be the place to point if no stylesheet were being applied. But x4u knows better.
What would I want x4u to do here? Write the intermediate FO to a temporary file and report the validation error in that. In this case the error seems to be in XEP’s XSLT processor, but if my XSL had produced invalid FO it would be helpful to see it. 
Which leaves questions:Why does x4u choke on the xmlns attribute?Is there a better solution than (a) removing the attribute or (b) avoiding the XEP XSLT processor for the transformation to FO?Stephen

Stephen Taylor | Librarian | Kx | +44 7713 400852 | stephen@kx.com

On 2 May 2018 at 20:00, <xep-support-request@renderx.com> wrote:
Send Xep-support mailing list submissions to

        xep-support@renderx.com

To subscribe or unsubscribe via the World Wide Web, visit

        http://lists.renderx.com/mailman/listinfo/xep-support

or, via email, send a message with subject or body 'help' to

        xep-support-request@renderx.com

You can reach the person managing the list at

        xep-support-owner@renderx.com

When replying, please edit your Subject line so it is more specific

than "Re: Contents of Xep-support digest..."

Today's Topics:

   1. Re: Xep-support Digest, Vol 86, Issue 1 (Kevin Brown)

----------------------------------------------------------------------

Message: 1

Date: Tue, 1 May 2018 14:44:21 -0700

From: "Kevin Brown" <kevin@renderx.com>

To: "'RenderX Community Support List'" <xep-support@renderx.com>

Subject: [xep-support] Re: Xep-support Digest, Vol 86, Issue 1

Message-ID: <001801d3e195$92c447b0$b84cd710$@renderx.com>

Content-Type: text/plain; charset="utf-8"

In other words:

<article xmlns=?http://docbook.org/ns/docbook?>

Does not match:

<article>

Kevin

From: Xep-support [mailto:xep-support-bounces@renderx.com] On Behalf Of Stephen Taylor

Sent: Tuesday, May 01, 2018 2:14 PM

To: XEP Support <xep-support@renderx.com>

Subject: [xep-support] Re: Xep-support Digest, Vol 86, Issue 1

Sorry I did not make myself more clear.

x4u renders my XML and XSL as a PDF ? 70 pages of beautiful typography ? provided I remove the xmlns attribute from the XML root element, which is, as you note, article.

The xmlns attribute was written by Pandoc <http://pandoc.org>  as DocBook 5 <http://docbook.org>  XML output. It looks correct to me. DocBook is an XML application that will be familiar to many XEP users. So I?m wondering why x4u would report the attribute as a validation error in the XML.

My question stands: is there a better solution to this than removing the attribute? 

_______________________________________________
(*) To unsubscribe, please visit http://lists.renderx.com/mailman/options/xep-support
(*) By using the Service, you expressly agree to these Terms of Service http://w
ww.renderx.com/terms-of-service.html
Received on Thu May 3 10:09:37 2018

This archive was generated by hypermail 2.1.8 : Thu May 03 2018 - 10:09:52 PDT