OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

opendocument-users message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [opendocument-users] table:table required elements


Hello Jean,

I have been over the weekend at the FOSDEM so I am just now stumbled over the emails.

1) First of all, you might use XSLT directly on the zipped XML by using the ODF XSLT Runner:
https://tdf.github.io/odftoolkit/docs/xsltrunner/ODFXSLTRunner.htmlÂÂ
You will then use relative references to the styles.xml and meta.xml file.

2) I am afraid you are right, the narrative description of the elements in the ODF specificationÂ
http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#element-table_tableÂ
do not cover the semantics of the XML grammar: http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-schema.rng
(You might want to browse the folder to see all documentation:Âhttp://docs.oasis-open.org/office/v1.2/os/)
You will find no "optional", "choice" nor "sequence" covered by it.Â

But when looking on the XML grammar file providing this information, you will find out it is relatively hard to read.Â
You need to searchÂfor "define name="table-table" to see the definition of <table:table>
and look at "table-columns-and-groups", take a look at "table-columns-no-group", "table-columns"...

ÂÂÂÂ<defineÂname="table-columns-and-groups">
ÂÂÂÂÂÂÂÂ<oneOrMore>
ÂÂÂÂÂÂÂÂÂÂÂÂ<choice>
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ<refÂname="table-table-column-group"/>
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ<refÂname="table-columns-no-group"/>
ÂÂÂÂÂÂÂÂÂÂÂÂ</choice>
ÂÂÂÂÂÂÂÂ</oneOrMore>
ÂÂÂÂ</define>
ÂÂÂÂ<defineÂname="table-columns-no-group">
ÂÂÂÂÂÂÂÂ<choice>
ÂÂÂÂÂÂÂÂÂÂÂÂ<group>
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ<refÂname="table-columns"/>

The text file has over 18.000 lines, therefore questions such as: "Do a valid ODF document exist, where an <text:p> element can be nested within another <text:p> element?" are quite hard to answer. Therefore I have loaded the XML grammar into a Graph to answer such questions and create better documentation and source code.
Unfortunately, the work is not finished, but opensource as part of the ODF Toolkit.Â
The graph is so big with about 600 elements and 1600 attributes.
2020-02-03_1057.png
Therefore I split it into a graph for each XML element just big enough to see the child elements:
2020-02-03_1059.png
You may find the GraphML snippets as part of the ODF Toolkit 1.0.0 branch.
I visualized the GraphML using Gephi.

See more details on the slides of my last LibreOffice conference talk.
Or in general at the slides ofÂhttps://github.com/tdf/odftoolkit/blob/master/docs/docs/presentations/Â

I might have met a graph company from London willing to assist me with this task.
I am doing an ODF Toolkit release likely this month, but have to write further documentation before the release.
The current development site (esp. the "fake" release, with no release) was just for reviewing purpose.
Best work on the 1.0.0_SNAPSHOT branch, only there the graph functionality had been added:
https://github.com/tdf/odftoolkit/tree/1.0.0_SNAPSHOTÂ

Hope you are at the start of a great week!
SvanteÂ

PS: We had once somewhere an ODF grammar file, where the user was reading not an ODF RelaxNG text file, but HTML file, which was providing links & references.
By this, you could at least jump quickly around through the grammar. We should indeed provide this at least. :-)


Am So., 2. Feb. 2020 um 02:36ÂUhr schrieb Jean-Christophe Helary <jean.christophe.helary@traduction-libre.org>:
Regina,

Also, the reference has:

file:///Users/suzume/Downloads/OpenDocument-v1.2-os/OpenDocument-v1.2-os-part1.html#element-table_table-column

The <table:table-column> element is *usable* within the following elements: <table:table> 9.1.2, <table:table-column-group>9.1.10, <table:table-columns> 9.1.12 and <table:table-header-columns> 9.1.11.

(emphasis mine)

and to me *useable* is not synonymous with "required" or a similar term that would indicate a required element.

That's also where I found the information lacking in the reference.

Jean-Christophe

> On Feb 2, 2020, at 10:13, Jean-Christophe Helary <jean.christophe.helary@traduction-libre.org> wrote:
>
> Regina,
>
> Thank you so much for your detailed explanations. That is exactly what I was looking for. I'm more used to the DTD syntax so I was not sure what to make of that rnc file.
>
> I think though that the spec reference hosted at Oasis should contain such information by using standard markers (?/+/etc.) that would be very helpful.
>
> Regarding the file included in emacs I found that:
>
> table-table =
>Â element table:table {
>Â Â table-table-attlist,
>Â Â table-title?,
>Â Â table-desc?,
>Â Â table-table-source?,
>Â Â office-dde-source?,
>Â Â table-scenario?,
>Â Â office-forms?,
>Â Â table-shapes?,
>Â Â table-columns-and-groups,
>Â Â table-rows-and-groups,
>Â Â table-named-expressions?
>Â }
>
> I guess there is the way the namespaces are written that also confused me but I could not find relevant information related to table:table-column (or table-table-column ?)
>
> Anyway, I found the compact relax ng syntax tutorial so I'll check it too so that this kind of thing does not happen again.
>
> Now that I know what's wrong with my file, I can proceed with the xslt :) I'll probably have a few questions then, especially regarding relevant tag attributes!
>
> Jean-Christophe
>
>> On Feb 2, 2020, at 4:17, Regina Henschel <rb.henschel@t-online.de> wrote:
>>
>> Hi Jean-Christophe,
>>
>> Jean-Christophe Helary schrieb am 01-Feb-20 um 17:32:
>>> Regina,
>>> Thank you very much for your reply.
>>>> It seems to me, that a "table:table-column" element is missing in your file. It is allowed, that it is empty; but it is not optional.
>>> I am not so skilled as to be able to parse the relax schema and the OpenDocument-v1.2-os-part1.html document does not seem to give that information.
>>> Would you be able to tell my what I am missing in the references in my possession that is actually telling me that table:table-column is a requirement?
>>
>> Using the schema manually you get:
>> "table:table" refers "table-columns-and-groups"
>> Unfortunately a ref has not indication, whether it is optional or not. So you need to follow it.
>> "table-columns-and-groups" has _<oneOrMore>_ of either "table-table-column-group" or "table-columns-no-group".
>>
>> "table-table-column-group" is element "table:table-column-group". Because emacs misses contents, we can ignore the attlist and need only follow the ref "table-columns-and-groups". That is recursive, see above.
>>
>> "table-columns-no-group" has some <optional> parts, which we can ignore here. But we need to follow the ref. That is either "table-columns" or "table-table-header-columns".
>>
>> "table-table-header-columns" is element "table:table-header-columns", which has _<oneOrMore>_ of ref "table-table-column".
>>
>> "table-columns" has either a ref to "table-table-columns" or _<oneOrMore>_ "table-table-column"
>>
>> "table-table-columns" is element "table:table-Columns", which has _<oneOrMore>_ ref "table-table-column".
>>
>> So on each way we get that <oneOrMore> of "table-table-column" is needed.
>>
>>
>> And finally
>>Â Â Â <define name="table-table-column">
>>Â Â Â Â Â Â Â <element name="table:table-column">
>>Â Â Â Â Â Â Â Â Â Â Â <ref name="table-table-column-attlist"/>
>>Â Â Â Â Â Â Â Â Â Â Â <empty/>
>>Â Â Â Â Â Â Â </element>
>>Â Â Â </define>
>>
>> That is an empty element, which has some Attributes.
>>
>>
>> If you use the file Emacs.app/Contents/Resources/etc/schema/od-schema-v1.2-os.rnc, you will find, that it has a different syntax, but the same information.
>> In that notation <optional> has the syntax "?" and <oneOrMore> has the syntax "+".
>>
>>
>> There exists some tools to validate a file against a schema. A search should give you some, which are available for your operating system. Perhaps one of them is more verbose than emacs and tells you, which element is actually missing.
>>
>>
>> A very different way might be to use ODFDOM of the odftoolkit https://odftoolkit.org/. It moved recently from 'Apache' to 'The Document Foundation'. The project has a mailing list, where you can ask, whether it is suitable for your purpose.
>>
>> Kind regards
>> Regina
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: opendocument-users-unsubscribe@lists.oasis-open.org
> For additional commands, e-mail: opendocument-users-help@lists.oasis-open.org
>

Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com @brandelune



---------------------------------------------------------------------
To unsubscribe, e-mail: opendocument-users-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: opendocument-users-help@lists.oasis-open.org



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]