Re: [AD] Questions about allegro.dtd

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Wed, 23 Apr 2003, Grzegorz Adam Hankiewicz wrote:

> Questions about allegro.dtd:
>
> What is the language specification attribute common to all
> elements? How is it used?

That attribute has a DocBook origin. See DB:TDG[1]:

"Lang should be a language code drawn from ISO 639 (perhaps extended with
a country code drawn from ISO 3166, as en_US). Use it when you need to
signal your application to change hyphenation and other display
characteristics."

However as it may seem that it has the same meaning as lang attribute in
HTML and xml:lang attribute in XML, it is not true, because by using
special DocBook stylesheets you can select elements by their language. So
it serves two purposes: determines content's language and selects content
(which is optional). However current Allegro's DTD lacks ability to
create, for example, two title elements for two different languages -
DocBook has special element phrase which servers no other purpose than
text grouping and can be used for that. But, personally, I think that
second (selector) use-case causes problems, so Allegro should stick to
first use-case.

The attribute applies to its own element and all nested elements. It
should be set on top-level element (like document) and propagated by
transformer to destination formats (like HTML) where it can be of some
use.

> When no id attribute is specified, I guess the parser is free to
> assign whatever value you want to the node.

Yes, but it must be unique.

> Are they unique for all the document?

Yes, that is imposed by XML spec, because it has ID type.

> In the case of a function without id, the parser could find the name
> node, transform it to a valid id, but this could clash against other
> nodes I guess.
>
> I would like two different link tags to differentiate local from
> external files. The idea is that while you could have allegro.xml,
> faq.xml and so on, maybe the allegro.xml could turn into a
> allegro-manual.info, and faq.xml into allegro-faq.info. Since this
> mangles names, one type of link should refer to "symbolic" names
> which can be transformed in the final output, and the current link
> can exist to point URLs or other references. Proposed example:
>
>   Note that this is answered in <local-link
>   ref="faq_document">Allegro's faq</a>, which you can also find
>   online at <link ref="http://blahblah"; />.
>
> ...and faq.xml would contain '<document id="faq_document">'. This
> also means we need an <include-document> tag or similar. What if
> the included document uses already used ids?

Document inclusion should be done with external entities - example:

<!ENTITY % faqDoc SYSTEM "faq.xml" >

<!-- this includes faq.xml -->
%faqDoc;

The IDs must be unique in both original and included document.

As to local links, what about following DTD addition:

<!ELEMENT document-ref EMPTY>
<!ATTLIST document-ref
          %common.attrib;
          source CDATA #REQUIRED
>

Example:

<document-ref id="faq_doc" source="faq.xml"/>
...
See <link ref="faq_doc">FAQ</link>.

Transformer will detect that faq_doc is id of element document-ref so it
should not output <a href="#faq_doc"> as it would normally, but <a
href="faq_location">.

[1] DocBook: The Definitive Guide (http://docbook.org/tdg/)

Have a nice day.

Stepan Roh





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/