Problem with spectitle attribute

Post here questions and problems related to editing and publishing DITA content.
anttirauramo
Posts: 8
Joined: Tue Sep 06, 2016 4:33 pm

Problem with spectitle attribute

Post by anttirauramo »

Hi! Please advice, I'm hopefully missing something very simple here... I'm using oXygen XML Editor 17.1 with DITA OT 1.8.5 to create a DITA 1.2 specialization of section. The specialization is a plugin in DITA OT and defines a document type shell in one file and extensions in another.

I have a class that references attributeGroup section.attributes:

Code: Select all

     <xs:complexType name="RYL-kappale.class" mixed="false">
<xs:sequence maxOccurs="unbounded">
<xs:choice>
<xs:group ref="basic.block"/>
<xs:element ref="alakappale"/>
</xs:choice>
</xs:sequence>
<xs:attributeGroup ref="section.attributes"/>
</xs:complexType>
...and elements that extend that class:

Code: Select all

     <xs:element name="vaatimus">
<xs:annotation>
<xs:documentation>Vaatimusteksti</xs:documentation>
</xs:annotation>
<xs:complexType mixed="false">
<xs:complexContent>
<xs:extension base="RYL-kappale.class">
<xs:attribute ref="class" default="+ topic/section ryl-d/vaatimus " />
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
All's fine, until I try to set a default value to the spectitle attribute in vaatimus-element's extension of RYL-kappale.class:

Code: Select all

<xs:attribute ref="spectitle" default="Vaatimus" />
The attribute is available in author when editing the test document and visible in the schema design view, but when I now try to validate my test document, xerces says:

Code: Select all

src-resolve: Cannot resolve the name 'spectitle' to a(n) 'attribute declaration' component.
...and saxon says:

Code: Select all

The attribute {spectitle} is referenced, but has not been declared
...and libxml says:

Code: Select all

element attribute: Schemas parser error : attribute use (unknown), attribute 'ref': The QName value 'spectitle' does not resolve to a(n) attribute declaration.
This happens even if I replace the reference to the attribute group with the contents of the group, thus defining spectitle locally in RYL-kappale. Without spectitle default value in the schema, the test document validates.

Why?

Please let me know if I should provide more information on my specialization to help solve this issue.
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Problem with spectitle attribute

Post by Radu »

Hi,

This question is not quite related to Oxygen as a product but we could try to find some time to look into this. If possible please send the entire specialization plugin to our email address (support@oxygenxml.com), it's hard to understand the problem by looking at just a few XML Schema snippets.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
anttirauramo
Posts: 8
Joined: Tue Sep 06, 2016 4:33 pm

Re: Problem with spectitle attribute

Post by anttirauramo »

Hi, yeah, I know... I was also hoping to catch some attention from other users who might have also experienced this. On the other hand, the specialization does work in oxygen but apparently doesn't work anywhere else, so perhaps there is some deeper understanding there that'd help solve the problem... Anyways, the help is much appreciated!
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Problem with spectitle attribute

Post by Radu »

Hi,

No problem, usually most users registered on the forum receive notifications only on the threads they started.
So if you want to ask the DITA community I would suggest the DITA Users List http://dita.xml.org/dita-users.
If you want to ask the opinion of Oxygen users you can write on the Oxygen Users List https://www.oxygenxml.com/mailman/listinfo/oxygen-user

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
anttirauramo
Posts: 8
Joined: Tue Sep 06, 2016 4:33 pm

Re: Problem with spectitle attribute

Post by anttirauramo »

Okay, Radu most kindly pointed out, that..:
When using XSD extensions you can only add new attributes, you cannot modify features for old attributes. The @class attribute is not defined in the base complex type hierarchy to you are simply adding it and it works.
But the "spectitle" is already defined in the "section.attributes"
attribute group and xsd:extensions do not allow modifying characteristics of existing attributes.
So, instead of referencing the attributeGroup section.attributes I copied it's contents to RYL-kappale.class, omitting spectitle, and then declared spectitle locally in elements extending RYL-kappale.class:

Code: Select all

     <xs:element name="vaatimus">
<xs:annotation>
<xs:documentation>Vaatimusteksti</xs:documentation>
</xs:annotation>
<xs:complexType mixed="false">
<xs:complexContent>
<xs:extension base="RYL-kappale.class">
<xs:attribute ref="class" default="+ topic/section ryl-d/vaatimus " />
<xs:attribute name="spectitle" default="Vaatimus" />
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
This perhaps kind of compromises extending DITA as now there is no connection, other than name and namespace, between my spectitle and the DITA spectitle, but that doesn't really have any effect on anything except the structure of the schema. Now my documents have the default spectitle and they validate, all's well!
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Problem with spectitle attribute

Post by Radu »

Hi Antti,

Thanks for updating the post.
I think what you did is the cleanest approach.
I did not suggest this workaround because the RYL-kappale.class is referenced as a base type in multiple places and in all those places the attribute reference to the base spectitle will be lost.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply