Extended ODF schema
Michael Stahl
mst at libreoffice.org
Wed Feb 8 13:09:50 UTC 2023
On 07.02.23 23:39, Regina Henschel wrote:
> Hi Laurent,
>
> This is all without warranty, I am not an expert on rng.
>
> Laurent Balland schrieb am 07.02.2023 um 21:50:
>> Hello,
>>
>> I'm trying to modify
>> schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng to add a
>> new attribute to number:text
>>
>> I added:
>>
>> <rng:define name="number-text" combine="interleave">
>> <rng:ref name="number-text-attlist"/>
>> </rng:define>
>>
>> <rng:define name="number-text-attlist">
>> <rng:interleave>
>> <rng:optional>
>> <rng:attribute name="loext:blank-width-char">
>> <rng:ref name="string"/>
>> </rng:attribute>
>> </rng:optional>
>> </rng:interleave>
>> </rng:define>
>>
>> But I got the following error:
>> .../schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng[7078,43]: Fatal: <attribute> is grouped and that group is repeated
>>
>> The line number corresponds to nothing, and if I move the upper code
>> on a different place in the file, the error is always at this unknown
>> 7078th line. >
>> Any idea about what I could try?
>
> The line 7078 belongs to <rng:element name="number:date-style">
> That can have several <rng:ref name="number-text-with-fillchar"/>.
> Such is in line 7427. It can have several <rng:ref name="number-text"/>.
> Currently all together resolves to several <rng:element
> name="number:text"> and <rng:element name="number:fill-character">. So
> currently <number:date-style> element can have several child elements
> <number:text>. That is no problem, because several child elements with
> the same name are possible.
>
> Now you introduce an attribute into <rng:ref name="number-text"/>. That
> means, that when resolving it for <number:date-style> element this would
> get several attributes with the same name. And that is not possible.
>
> You need to look, to which element your new attribute belongs.
if it should go on the numer:text element, it needs to be a child of its
rng:element - currently it's not extensible (via "combine" feature):
<rng:define name="number-text">
<rng:element name="number:text">
<rng:text/>
</rng:element>
</rng:define>
so you have to override it - at the start of the libreoffice schema
there is an rng:include, paste the above into this include element and
adapt it - this will override what is in the included file.
More information about the LibreOffice
mailing list