[sword-devel] OSIS markup

DM Smith dmsmith555 at yahoo.com
Mon Apr 30 14:36:40 MST 2007

Chris Little wrote:
> DM Smith wrote:
>>>> 4) Use milestoned version of the <q> element and close the element by
>>>> changing the publisher's material, adding an ellipsis.
>>>> 	Lit <hi type="italic">saying, <q marker="“" level="1" sID="xxx"/
>>>>> The ...<q marker="" level="1" eID="xxx"/></hi>
>>> The added ellipsis would be bad, but if marker="" is not equivalent to
>>> no marker attribute, then that would be a good solution. I'm just not
>>> sure about how XML defines empty attribute values.
>> I agree that this is bad.
>> In XML any attribute can have an empty value (btw, there is a unicode  
>> close quote above) and Sword/JSword handle it properly.
> (Hmm... I can't see the close quote.)
> I know XML allows for empty attribute values, but I'm not sure whether 
> they are formally equivalent to no attribute at all.
> For example <p></p> is formally equivalent to <p/> and vice versa. If an 
> empty attribute is formally equivalent to no attribute at all, then the 
> correct behavior for a stylesheet would most likely be to generate a 
> close quotation mark in the event of finding marker="".

I think there's a simple enough test:
Create a DTD with an attribute being required on an element and create a 
document having that attribute, but the content is empty.
Then pass it to a validating parser.

Anyway, even without the test, I am pretty positive that an attribute 
with an empty string is not formally equivalent to not having the 
attribute. The crimson and the xerces parsers (which JSword uses, 
depending on which version of Java) return the attribute as an empty 
string. If I create one on a DOM document and then ask for it later, it 
is still there as empty.

Also, there is no indication in the spec 
(http://www.w3.org/TR/REC-xml/#attdecls) that a CDATA attribute 
(required or implied) requires non-zero length data.

More information about the sword-devel mailing list