errata-ai / vale

:pencil: A markup-aware linter for prose built with speed and extensibility in mind.
https://vale.sh
MIT License
4.44k stars 153 forks source link

XML: exit status 6 on files with custom entities #496

Closed dmpop closed 1 year ago

dmpop commented 1 year ago

Running Vale on XML files containing custom entities throws the exit status 6 error. Tested with our in-house XSL as well as /usr/share/xml/docbook/stylesheet/nwalsh/html/docbook.xsl. To reproduce the issue, you can try to run Vale on https://github.com/SUSE/doc-sle/blob/main/xml/64bit_issues.xml

Update: it looks like the error occurs only when running Vale from the command line. In VS Code and VS Codium, Vale seems to work just fine.

jdkato commented 1 year ago

This is an xsltproc error that means "error in one of the documents." I wasn't able to reproduce the issue, though.

Could you share your .vale.ini file?

dmpop commented 1 year ago

Hi Joseph,

Thank you very much for your response! Here's my .vale.ini:

StylesPath = styles
MinAlertLevel = suggestion
[asciidoctor]
experimental = YES
[*.xml]
Transform = /usr/share/xml/docbook/stylesheet/suse2022-ns/xhtml/docbook.xsl
BasedOnStyles = technically
[*.{md,txt,adoc}]
BasedOnStyles = technically

We're using this style guide: https://github.com/dmpop/technically

jdkato commented 1 year ago

This is the error I get with that config:

error : Unknown IO error
warning: failed to load external entity "http://docbook.sourceforge.net/release/xsl-ns/current/xhtml5/docbook.xsl"
compilation error: file suse2022-ns/xhtml/docbook.xsl line 35 element import
xsl:import : unable to load http://docbook.sourceforge.net/release/xsl-ns/current/xhtml5/docbook.xsl
tomschr commented 1 year ago

@jdkato I don't know which system you have, but this looks like as a XML catalog problem to me.

On openSUSE, if you let the DocBook XSLT identifier (http://docbook...) resolve through XML catalog resolution, we will get:

$ xmlcatalog /etc/xml/catalog http://docbook.sourceforge.net/release/xsl-ns/current/xhtml5/docbook.xsl
file:///usr/share/xml/docbook/stylesheet/nwalsh5/current/xhtml5/docbook.xsl

It seems, on your system this identifier is not known.

Our catalog look like this:

XML catalog snippet (click me) ```xml ```

You need to change the rewritePrefix attribute to point to your system installation of the DocBook stylesheets. If you add the <rewriteSystem/> line to /etc/xml/catalog it should work.

Could you look what's the results of the xmlcatalog command? Maybe add the line and try it again?

jdkato commented 1 year ago

I think we're in partial agreement here: this issue is about an error code being thrown by xsltproc, not Vale.

My suggestion would be to run the xsltproc command locally to get a better idea of your issue is.