antennahouse / focheck Goto Github PK
View Code? Open in Web Editor NEWXSL-FO validation using RELAX NG and Schematron.
License: Apache License 2.0
XSL-FO validation using RELAX NG and Schematron.
License: Apache License 2.0
There are four properties axf:background-content-width, axf:background-content-height, axf:background-content-type, axf:background-scaling given on
http://www.antennahouse.com/product/ahf60/docs/ahf-ext.html#IDAOGBV
which are not explicitly assigned to elements. They seem to apply at all elements where background-image is allowed.
If a language is specified as 2-letter language code the text from the spec is issued as a warning. I thin this is just a editorial notice and should not be a warning, i.e. using a 2-letter language code should not pollute the validation results.
I propose that 2-letter language codes and all other strings ('none', 'mul', 'und') which are handled correctly in any way, should not raise a warning.
5.4.6 Language Property
A value being a 2-letter code in conformance with [ISO639] is converted to the corresponding 3-letter [ISO639-2] terminology code, a 3-letter code in conformance with [ISO639-2] bibliographic code is converted to the corresponding 3-letter terminology code, a value of 'none' or 'mul' is converted to 'und'.
Usage
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" hyphenation-character="-">
It looks like the Schematron parser doesn't analyze "Literal" correctly, but I have to dive into that magic at another time…
AH Formatter (as with probably all formatters) accepts, e.g., fo:external-graphic/@src
values without the url(...)
that makes it a <uri-specification>.
The current Schematron error message is:
background-image="cloud.png" enumeration token is 'cloud.png'. Token should be 'none' or 'inherit'.
focheck should accept, but maybe warn about, the 'bare' URIs that every formatter accepts.
For each duplicate attribute id an error »ID "some" has already been defined« is reported. I think this is sufficient, maybe the text could be a little bit similar to what AHF itself reports for duplicate IDs.
The additional error »first occurrence of ID "some"« is misleading as it is raised for all but the first occurrence of the duplicate attribute and therefore just fills the error view.
My suggestion:
Thanks!
Our legal was looking in the framework and they had some feedback about the fact that the framework incorporates other resources which are licensed in some other way (example: the HTML MathML entity set), I quote:
The owner of the project could implement an addition to the Apache 2.0 license and list there the licenses for the other components which appear in the framework.
I'm attaching the suggested changes:
licenseAddition.txt
If I understand the spec, it should be legal to have only a single fo:wrapper inside fo:flow. But the schema complains…
Testing the focheck Schematron using 'stf' requires a fix for Calabash issue ndw/xmlcalabash1#177 since the Schematron make a relative URI reference to the expression parser XSLT file.
For example, the width value "50% + 8em" from:
<fo:block-container width="50%+8em">
is reported as an error.
This expression works fine with both Antenna House formatter and the FOP.
E.g., for fo:retrieve-marker
, checking that there could be a matching fo:marker
within current or previous fo:page-sequence
.
I receive the following Schematron error for the fo:root
attributes xml:lang="en"
or language="en"
, but the description does not tell the attribute.
Description: Enumeration token is: 'en'. Token should be 'none' or 'inherit'.
It seems a list of allowed language codes or at least a formal regular expression should be present.
"A value being a 2-letter code in conformance with [ISO639] is converted to the corresponding 3-letter [ISO639-2] terminology code, a 3-letter code in conformance with [ISO639-2] bibliographic code is converted to the corresponding 3-letter terminology code, a value of 'none' or 'mul' is converted to 'und'."
From Antenna House USA support issue:
fo-check for oXygen is giving me some errors with the following situations:
...
3) <fo:block-container column-gap="9.75mm"
axf:line-number-width="4.75mm" axf:line-number-font-family="Arial"
axf:line-number-font-weight="normal" axf:line-number-reset="force" >
Current error is:
internal-destination="d13e15" token should be 'empty' or 'string'. Enumeration token is 'd13e15'.
It is not "empty or string" but "empty string or idref"
Can we check if referenced id is specified somewhere in the current document?
Spec says:
7.23.8 "internal-destination"
XSL Definition:
Value: empty string |
Initial: empty string
Inherited: no
Percentages: N/A
Media: interactive
Specifies the destination flow object within the formatting object tree. This property allows the destination flow object node to be explicitly specified.
In http://www.w3.org/TR/REC-CSS2/syndata.html#value-def-length I find:
After the '0' length, the unit identifier is optional.
I see Errors like this: 'top' should be Length, Percent, or EnumerationToken. '0' is a Number.
Please add '0' to the allowed values whenever is required. At least for those properties which are inherited from CSS, as the FO spec unfortunately says:
A signed length value where a 'length' is a real number plus a unit qualification.
If AHF treats all lengths like CSS specifies it, we can make our lives easier.
The problem was reported here:
https://www.oxygenxml.com/forum/viewtopic.php?p=57350#p57350
I'm attaching a sample XSL-FO file, validating it yelds:
An empty sequence is not allowed as the first argument of ahf:parser-runner()
…which are currently missing. I did not have to use them after some experimentation, but there are
axf:float
axf:float-reference
axf:float-x
axf:float-y
From Antenna House USA support issue:
fo-check for oXygen is giving me some errors with the following situations:
<fo:block axf:baseline-grid="none">
<fo:table width="100%" axf:baseline-grid="none">
Use the RELAX NG to ensure IDness.
Having the Saxon transformer instance that does the Schematron checking cache IDs just makes the cache bigger.
From what I read from the documents, it applies to "multi-column elements", which I assume are those that allow column-count="n", which in turn are fo:region-body, fo:block-container.
In the documentation it is said:
axf:hyphenation-zone may have values "none | "
and
It is invalid when 0 or less value is specified.
None of this is currently checked.
The description in the documentation could also be made a little bit clearer. Suggestion:
»The given value defines a distance from the end of the current block. If a word starts within that region, it will not be hyphenated.«
From my POV this seems to be a way of specifying the minimal text length instead of character count before a hyphenation may happen. Do you agree?
One of our clients reported that having a background image with a value like this:
background-image="../xml_tools/common/line_arrowR.tif"
reports a "Syntax error" in one of the Schematron schemas.
But using an 'src' attribute with a similar value on a fo:external-graphic does not although the XSL-FO specs says that both attributes are uri-reference types.
Also the error is not very clear, as an end user just by looking at the error message I do not know what to do to fix it.
Validating it in Oxygen I get about 4 validation errors reported related to ID type attributes like:
an "element" pattern containing an "attribute" pattern with a non-null ID-type must have a name class that contains only "choice" and "name" elements
conflicting ID-types for attribute "id" from namespace "http://www.w3.org/XML/1998/namespace" of element "flow" from namespace "http://www.w3.org/1999/XSL/Format"
As a suggested fix in fo.rng when "anything" is defined, we can exclude elements in the FO namespace:
<define name="anything">
<zeroOrMore>
<choice>
<element>
<anyName>
<except>
<nsName ns="http://www.w3.org/1999/XSL/Format"/>
</except>
</anyName>
and in axf.rng in the "define name="non-xsl"" maybe remove those optional attributes:
<optional>
<attribute name="id">
<data type="ID"/>
</attribute>
</optional>
<optional>
<attribute name="ref-id">
<data type="IDREF"/>
</attribute>
</optional>
<optional>
<attribute name="internal-destination">
<data type="IDREF"/>
</attribute>
</optional>
Currently will complain unless value is empty
or string
, which is so wrong in so many ways.
It seems the four properties max-height, max-width, min-height, min-width are not listed in the spec as being valid for fo:external-graphic.
In the spec in the section about fo:external-graphic, "max-height" is mentioned in a note, but not listed under the properties applicable.
Maybe one need a better grip at understanding the spec?
We are also using those properties with fo:block, but I am not sure whether this should be working.
Should use regex for these instead of just checking they are not empty.
Current setting reports:
Syntax error: external-destination="http://53.74.227.101:8080/path/some.do?io=0077&version=1"
But for me this is a perfectly valid URL…
value of attribute "axf:float" is invalid; must be equal to "after", "auto", "auto-move", "auto-next", "before", "bottom", "center", "column", "end", "inside", "keep", "keep-float", "left", "multicol", "next", "none", "normal", "outside", "page", "right", "skip", "start", "top" or "wrap"
It seems to me the RNG does not take into account that you can have many of these tokens in axf:float
.
In may testcase the attribute reads: axf:float="top right page"
As I learned via AH support:
span="all" behavior in static area's is a known limitation. The
xsl-fo standard restricts the use of this property to elements that are
descendants of fo:flow.
So, I assume a warning could be added via Schematron rule.
Current XML catalog focheck/schema/catalog.xml
redirects all URI starting with http://www.w3.org/2003/entities/2007/
. However not all entity files living at that location are provided as a part of focheck. This can lead to errors when other resource is referenced, e.g. http://www.w3.org/2003/entities/2007/w3centities-f.ent
but local copy of file is not present.
Solution is either to copy all .ent files into focheck or explicitly list only entity files that are part of focheck in catalog.xml
.
AH extends the values of @font-stretch to allow <percentage> and <number>. The Schematron rules only support <percentage>, simple numbers are not accepted.
The properties
absolute-position,
top,
left,
right,
bottom
are not allowed but should be.
We received this feedback:
https://www.oxygenxml.com/forum/viewtopic.php?f=7&t=24267
about an XSL-FO file like this being considered invalid as it uses the "field-readonly" attribute in an axf:form-field :
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:axf="http://www.antennahouse.com/names/XSL/Extensions"
xml:lang="en">
<fo:layout-master-set>
<fo:simple-page-master master-name="spm">
<fo:region-body/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="spm">
<fo:flow flow-name="xsl-region-body">
<fo:block>Hello, wo<axf:form-field
field-type="text"
field-name="dontwritehere"
field-readonly="true"
field-flags="Hidden"
field-default-text="You can't write here!"/>rld.</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
I am unsure, and cannot find anything in the spec that explains how empty attributes should be dealt with (like initial-page-number=""
), but AHF must have a way how it deals with them. Are they ignored, or are they treated as if the default value would be present?
The Schematron check should give a useful message:
'initial-page-number' should be auto | auto-odd | auto-even | <number> | inherit. '' is an empty String.
REx can also generate a parser as a Saxon extension function.
It should be possible, and it should be faster, to use the expression parser as a Saxon extension function and fallback to the XSLT expression parser when the Saxon extension function is not available.
The URL for the update is:
<xt:location href="https://github.com/AntennaHouse/focheck/releases/download/v0.5.3/focheck-framework-0.5.3.zip"/>
It should be:
<xt:location href="https://github.com/AntennaHouse/focheck/releases/download/0.5.3/focheck-framework-0.5.3.zip"/>
The focheck comes with a mapping like:
<systemSuffix systemIdSuffix="htmlmathml-f.ent" uri="htmlmathml-f.ent"/>
Is there a purpose for the mapping? Could it possibly be re-written to be more specific?
One of our clients used in his DTD something like:
<!ENTITY % bla-f
PUBLIC "-//BLA//ENTITIES HTML MathML Set//EN//XML"
"bla_htmlmathml-f.ent"
>
and they expected the "bla_htmlmathml-f.ent" to be resolved to their local DTD but because Oxygen also loads the focheck catalog, the entity was mapped to the "htmlmathml-f.ent" located in the focheck framework.
In a Relax NG schema you can add documentation for each element and attribute, for example:
OXYGEN_INSTALL_DIR\samples\relaxng\personal.rng
Oxygen picks up the documentation and shows it in the content completion window when editing the XSL-FO file.
The documentation in section "Bookmark and Link in PDF Output" states this as an example for a PDF bookmark:
<fo:block axf:outline-level="1"
axf:outline-expand="false"
axf:outline-title="Table of Contents">
Attribute | Value |
---|---|
axf:outline-expand | true |
axf:outline-group | |
axf:outline-level | |
axf:outline-title | |
axf:outline-color | |
axf:outline-font-style | normal |
axf:outline-font-weight | normal |
It seems to me, that on
http://www.antennahouse.com/product/ahf60/docs/ahf-ext.html#IDAAOLV
the specification might be unclear. Are those properties to be used with or without "axf:" prefix? We seem to be using them with axf: prefix, but not currently.
In any case I find those properties missing for fo:simple-page-master. The quoted page says:
Applies to: fo:simple-page-master, fo:page-sequence, all formatting objects
What does "all formatting objects" mean here?
The comment at the start of the file should be similar to the one in "axf-inherited.rng"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.