Hi Stefan,
I have several different answers / responses to your question, so hopefully this all makes sense.
As you noted - technically, processors will work with this. The attribute is there, and if it's defined in your grammar, it will be valid in the document + in your processing pipeline. It's certainly valid XML.
Is it valid DITA (or more specifically, DITA 1.3)? Not really, but it could be made valid:
- Specialization is the mechanism to add attributes that are not part of the core, and remain valid DITA.
- This fits with the definition of @base as a specialization ancestor; the base attribute is meant for generic metadata. The list of values you've defined would all be valid, and in an extreme event, it would even allow you to generalize back to generic
DITA while retaining that metadata in the base attribute. For example, base="type(Bq) sign(+)" would generalize your type and sign attributes.
- Per the rules of DITA 1.3, to make this into a valid attribute specialization, you'd need to define a token for the domains attribute,
and you'd need to add it globally.
That last bit is clearly a sticking point. The mandate to do this globally will go away in DITA 2.0; Kris plans to send some more detail on that in response to your email -- it's one of the last DITA 2.0 proposals still getting finalized.
You could in theory define each new attribute globally, and then constrain them away from every element except the one you want. The result is exactly what you have now -- attributes added to the one element, but in a way that is fully compatible with DITA
1.3. This is obviously not practical, but the fact that you could do this is helping to drive that DITA 2.0 simplification.
So technically - what you're doing now will work, even if it's not technically legal; in DITA 2.0 it would be fully legal with the simple declaration of tokens saying "these are my new attributes".
The other comment I have is a more general one, a caution to be wary of declaring your attribute name "type". That attribute has a bunch of different meaning in DITA, but one of them is in the list of linking attributes that can be inherited. Depending on where
your element is used, a value like type="Bq" could cause some processors to pass that attribute down to child elements. That would be either confusing, or potentially breaking if it ended up cascading to something like <note type="Bq">.
Hope that helps -
Robert
From: Stefan Eike <Stefan.Eike@dometic.com>
Sent: Monday, June 14, 2021 6:49 AM
To: dita-comment@lists.oasis-open.org <dita-comment@lists.oasis-open.org>
Subject: [External] : [dita-comment] Limitations for attribute specialization
Dear honourable DITA committee,
Iâve added a new attribute (type) to a specialized element. This attribute is not specialized, itâs just added as shown below. My question now is: âIs this allowed?â I mean, technically this is no problem and this can
be processed with the DITA-OT and the PDF2 plugin (and others). Iâve read these sections:
Overview of specialization,
Specialization rules for attributes,
RELAX NG: Coding requirements for attribute domain modules
I could not find a statement saying something like âIf you add an attribute, it must be added as a âspecializedâ attributeâ. Do I violate the specification and should I feel bad?
<define
name="tv.attributes">
<ref name="univ-atts-translate-no"/>
<optional>
<attribute name="name"
a:defaultValue="tv"/>
</optional>
<optional>
<attribute name="datatype"/>
</optional>
<optional>
<attribute name="value"/>
</optional>
<optional>
<attribute name="href"/>
</optional>
<optional>
<attribute name="keyref"/>
</optional>
<optional>
<attribute name="format"/>
</optional>
<attribute name="type">
<choice>
<value>A</value><a:documentation>Ampere</a:documentation>
<value>Ah</value><a:documentation>Ampere
hour</a:documentation>
<value>Bq</value><a:documentation>Becquerel</a:documentation>
<value>F</value><a:documentation>Farad</a:documentation>
<value>Gy</value><a:documentation>Gray</a:documentation>
<value>H</value><a:documentation>Henry</a:documentation>
<value>Hz</value><a:documentation>Hertz</a:documentation>
<value>J</value><a:documentation>Joule</a:documentation>
<value>K</value><a:documentation>Kelvin</a:documentation>
<value>L</value><a:documentation>Liter</a:documentation>
<value>N</value><a:documentation>Newton</a:documentation>
<value>Pa</value><a:documentation>Pascal</a:documentation>
<value>S</value><a:documentation>Siemens</a:documentation>
<value>Sv</value><a:documentation>Sievert</a:documentation>
<value>T</value><a:documentation>Tesla</a:documentation>
<value>V</value><a:documentation>Volt</a:documentation>
<value>W</value><a:documentation>Watt</a:documentation>
<value>Wb</value><a:documentation>Weber</a:documentation>
<value>bar</value><a:documentation>Bar</a:documentation>
<value>cd</value><a:documentation>Candela</a:documentation>
<value>cm</value><a:documentation>Centimeter</a:documentation>
<value>cmÂ</value><a:documentation>Square
Centimeter</a:documentation>
<value>dB(A)</value><a:documentation>A-weighted
decibels</a:documentation>
<value>g</value><a:documentation>Gram</a:documentation>
<value>g/h</value><a:documentation>Gram
per hour</a:documentation>
<value>h</value><a:documentation>Hour</a:documentation>
<value>kWh</value><a:documentation>Kilowatt-hour</a:documentation>
<value>kat</value><a:documentation>Katal</a:documentation>
<value>kg</value><a:documentation>Kilogram</a:documentation>
<value>km</value><a:documentation>Kilometer</a:documentation>
<value>km/h</value><a:documentation>Kilometer
per hour</a:documentation>
<value>lm</value><a:documentation>Lumen</a:documentation>
<value>lx</value><a:documentation>Lux</a:documentation>
<value>m</value><a:documentation>Meter</a:documentation>
<value>mm</value><a:documentation>Millimeter</a:documentation>
<value>mmÂ</value><a:documentation>Square
Millimeter</a:documentation>
<value>mol</value><a:documentation>Mole</a:documentation>
<value>rad</value><a:documentation>Radian</a:documentation>
<value>s</value><a:documentation>Second</a:documentation>
<value>sr</value><a:documentation>Steradian</a:documentation>
<value>t</value><a:documentation>Ton</a:documentation>
<value>Â</value><a:documentation>Degree</a:documentation>
<value>ÂC</value><a:documentation>Degree
Celsius</a:documentation>
<value>Î</value><a:documentation>Ohm</a:documentation>
</choice>
</attribute>
<attribute name="sign"
a:defaultValue="+">
<choice>
<value>+</value><a:documentation>Plus
(positive number)</a:documentation>
<value>â</value><a:documentation>Minus
(negative number)</a:documentation>
<value>Â</value><a:documentation>Plus-Minus</a:documentation>
<value><</value><a:documentation>Lower-than</a:documentation>
<value>></value><a:documentation>Greater-than</a:documentation>
</choice>
</attribute>
<optional>
<attribute name="show-unit"
a:defaultValue="yes">
<choice>
<value>yes</value>
<value>no</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="system"
a:defaultValue="si">
<choice>
<value>si</value><a:documentation>International
System of Units</a:documentation>
<value>imperial</value><a:documentation>Imperial
System</a:documentation>
<value>si+imperial</value><a:documentation>SI
+ Imperial</a:documentation>
</choice>
</attribute>
</optional>
<optional>
<attribute name="scope">
<choice>
<value>external</value>
<value>local</value>
<value>peer</value>
<value>-dita-use-conref-target</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="outputclass"/>
</optional>
</define>
Thanks a lot in advance
Stefan
Stefan Eike
Head of Technical Documentation
Phone +49 (0)2572 879 279 Cell +49 (0) 172 8843770
Stefan.Eike@dometic.com
Dometic Germany Holding GmbH â BetriebsstÃtte Emsdetten, Hollefeldstr. 63, 48282 Emsdetten Germany
dometic.com
NOTICE: This email and any attachments are for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure
or distribution is prohibited. If you are not the intended recipient, please notify the sender by reply email and destroy the original message.
|