reschke / xml2rfc

A formatter for the "xml2rfc" vocabulary, implemented in XSLT.
12 stars 5 forks source link

A sample asciiRFC generated document for you #16

Closed opoudjis closed 4 years ago

opoudjis commented 6 years ago

I've generated the following document, round-tripping draft-iab-rfc-framework-06. The document has xi:include for references where externally available, as the RFC XML v3 spec requires.

Both entities and XML includes have defeated by limited command of Saxon, so I can't get RFC2629.xslt to work on this; the external references are not being rendered in the XSLT output.

Could I (a) ask you to run this through RFC2629.xslt, and (b) if you can get the includes working, let me know how you're running it?

I'm running it with the Xerces XML Commons Resolver, as

java -cp /usr/local/Cellar/saxon/9.8.0.4/libexec/saxon9he.jar:/usr/local/lib/jars/resolver.jar net.sf.saxon.Transform -x:org.apache.xml.resolver.tools.ResolvingXMLReader  -y:org.apache.xml.resolver.tools.ResolvingXMLReader -r:org.apache.xml.resolver.tools.CatalogResolver -s:a.xml -xsl:rfc2629.xslt -o:a.html

I really, really don't want to have to craft a catalog.xml for each file to be put through the XSLT; that defeats the purpose. a.xml.zip

reschke commented 6 years ago

On 2017-11-29 11:49, Nick Nicholas wrote:

I've generated the following document, round-tripping draft-iab-rfc-framework-06. The document has xi:include for references where externally available, as the RFC XML v3 spec requires.

Both entities and XML includes have defeated by limited command of Saxon, so I can't get RFC2629.xslt to work on this; the external references are not being rendered in the XSLT output.

Could I (a) ask you to run this through RFC2629.xslt, and (b) if you can get the includes working, let me know how you're running it?

I'm running it with the Xerces XML Commons Resolver, as

|java -cp /usr/local/Cellar/saxon/9.8.0.4/libexec/saxon9he.jar:/usr/local/lib/jars/resolver.jar net.sf.saxon.Transform -x:org.apache.xml.resolver.tools.ResolvingXMLReader -y:org.apache.xml.resolver.tools.ResolvingXMLReader -r:org.apache.xml.resolver.tools.CatalogResolver -s:a.xml -xsl:rfc2629.xslt -o:a.html |

I really, really don't want to have to craft a catalog.xml for each file to be put through the XSLT; that defeats the purpose. a.xml.zip https://github.com/reschke/xml2rfc/files/1513495/a.xml.zip

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/reschke/xml2rfc/issues/16, or mute the thread https://github.com/notifications/unsubscribe-auth/AAUUwqnphKotbjRxCDagHuDBufZajRJeks5s7TadgaJpZM4Quwwm.

Hi, the problem is:

parse="text"

Remove that, and things will work. I'll look into improving the diagnostics...

reschke commented 6 years ago

Actually it already reports:

ERROR: Unsupported attributes on x:include element (at line 192) ERROR: Unsupported attributes on x:include element (at line 193) ERROR: Unsupported attributes on x:include element (at line 194) ERROR: Unsupported attributes on x:include element (at line 195) ERROR: Unsupported attributes on x:include element (at line 196) ERROR: Unsupported attributes on x:include element (at line 197) ERROR: Unsupported attributes on x:include element (at line 198) ERROR: Unsupported attributes on x:include element (at line 199) ERROR: Unsupported attributes on x:include element (at line 200) ERROR: Unsupported attributes on x:include element (at line 204) ERROR: Unsupported attributes on x:include element (at line 205) ERROR: Unsupported attributes on x:include element (at line 206) ERROR: Unsupported attributes on x:include element (at line 207)

opoudjis commented 6 years ago

It did not work at all on my saxon when I removed the parse="text" element:

Error on line 1 column 50 of reference.RFC.2119.xml:
  SXXP0003: Error reported by XML parser: White spaces are required between publicId and systemId.
org.xml.sax.SAXParseException; systemId: http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml; lineNumber: 1; columnNumber: 50; White spaces are required between publicId and systemId.

xsltproc does not work either, for that matter: the includes redirect to an https server, and xsltproc apparently can't deal with https includes.

How are you running the stylesheet?

reschke commented 6 years ago

I'm running Saxon, but I have indeed a custom entity resolver installed, and that one handles the redirect (it's currently unreleased, but let me know if you want to try it).

When I replace the "http" with "https" in the URIs, Saxon appears to be happy, so it likely has to do with the redirect.

opoudjis commented 6 years ago

Welp, I'd like to help you with the stylesheet, and we're committing to includes in our output, so I think I'll take up the offer of the custom resolver.

(Saxon. Ugh.)

reschke commented 6 years ago

I was going to say, use "-xi:on" with Saxon, but that shows the same issue with redirects.

My custom resolver currently only seems to work with Saxon 6, need to investigate.

I think your best choice for now is to avoid URIs that redirect, or to inline the \ element.

(will investigate further)

ronaldtse commented 6 years ago

@reschke since it's been a while, is there a way now to run the stylesheet from non-custom parsers? Thanks!

reschke commented 6 years ago

I can't fix the parsers. I can try to fix my custom resolver and release it.

ronaldtse commented 6 years ago

Right, once this issue is fixed, we can integrate our test suite with the stylesheet.

re: https://github.com/riboseinc/asciidoctor-rfc/issues/81

reschke commented 4 years ago

@ronaldtse - in the meantime I was able to fix my custom resolver to work with all Saxon versions; is this still relevant for you?

ronaldtse commented 4 years ago

@reschke maybe! Ping @opoudjis ...

opoudjis commented 4 years ago

We are completely overhauling the gem to bring it in line with the other standards we process. Presumably it will still be relevant, but it's been two years, and I'm going to need a refresher on what fits in with what...

reschke commented 4 years ago

Concretely what?

The issue discussed here was that Saxon by default doesn't follow redirects when resolving anything external; and my custom resolver (unreleased) fixes that.

opoudjis commented 4 years ago

I have just tried to run this, and I'm getting:

java -cp /usr/local/Cellar/saxon/9.9.1.6/libexec/saxon9he.jar:/usr/local/lib/jars/resolver.jar net.sf.saxon.Transform -x:org.apache.xml.resolver.tools.ResolvingXMLReader  -y:org.apache.xml.resolver.tools.ResolvingXMLReader -r:org.apache.xml.resolver.tools.CatalogResolver -s:example-v3.rfc.xml -xsl:rfc2629.xslt -o:a.html
Cannot find CatalogManager.properties
WARNING: In metadata obsoletes/updates, RFC number of draft name is expected - found: RFC 1000
WARNING: In metadata obsoletes/updates, RFC number of draft name is expected - found: RFC1000
WARNING: In metadata obsoletes/updates, RFC number of draft name is expected - found: 10.17487/RFC1000
WARNING: In metadata obsoletes/updates, RFC number of draft name is expected - found: RFC 1200
WARNING: In metadata obsoletes/updates, RFC number of draft name is expected - found: RFC1200
WARNING: In metadata obsoletes/updates, RFC number of draft name is expected - found: 10.17487/RFC1200
WARNING: In metadata obsoletes/updates, RFC number of draft name is expected - found: RFC 2010
WARNING: In metadata obsoletes/updates, RFC number of draft name is expected - found: RFC2010
WARNING: In metadata obsoletes/updates, RFC number of draft name is expected - found: 10.17487/RFC2010
WARNING: In metadata obsoletes/updates, RFC number of draft name is expected - found: RFC 2120
WARNING: In metadata obsoletes/updates, RFC number of draft name is expected - found: RFC2120
WARNING: In metadata obsoletes/updates, RFC number of draft name is expected - found: 10.17487/RFC2120
WARNING: @initials 'D': did you mean 'D.'?
WARNING: @initials 'N': did you mean 'N.'?
ERROR: relref/@target must be a reference
ERROR: relref/@target must be a reference
WARNING: Can't generate section link for to ISO.IEC.10118-3; no @relative specified
WARNING: Can't generate section link for to ISO.IEC.10118-3; no @relative specified
WARNING: Can't generate section link for to ISO.IEC.10118-3; no @relative specified
WARNING: unused (included) reference 'RFC7253'

on the attached; which confirms that we still can't resolve RFC XML references because of the HTTPS issue.

example-v3.rfc.xml.zip

I don't know whether we're still interested in doing XML RFC v2/v3 equivalence testing, as @ronaldtse had in mind two years ago; so I'd have to defer to him as to whether we would use the xml2rfc XSLT, and how.

reschke commented 4 years ago

The errors/warnings are unrelated to the resolution issue, as far as I can tell - they indicate problems with your XML document.

In particular:

opoudjis commented 4 years ago

Filling the section numbers still results in ERROR: relref/@target must be a reference, which is consistent with it not fetching the reference: <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7253.xml"></xi:include>.

Note also that xml2rfc is currently inserting DOI references to updated and obsoleted documents: 10.17487/RFC2010 was not in the source asciidoc.

reschke commented 4 years ago

a) What version of rfc2629.xslt are you using?

b) if xml2rfc inserts these references, you should report that as a bug

opoudjis commented 4 years ago

Your latest from last week, with Saxon 9.9.1.6.

java -cp /usr/local/Cellar/saxon/9.9.1.6/libexec/saxon9he.jar:/usr/local/lib/jars/resolver.jar net.sf.saxon.Transform -x:org.apache.xml.resolver.tools.ResolvingXMLReader  -y:org.apache.xml.resolver.tools.ResolvingXMLReader -r:org.apache.xml.resolver.tools.CatalogResolver -s:example-v3.rfc.xml -xsl:rfc2629.xslt -o:a.html
reschke commented 4 years ago

Works over here. Maybe a problem with the resolver you are using?

reschke commented 4 years ago

FWIW, my resolver (finally) is over here: https://github.com/reschke/rfcxmlresolver

ronaldtse commented 4 years ago

Thank you @reschke !