-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Dear HTML editors,
while writing my own DTD modules for XHTML Modularization / XHTML 1.1 adding
xi:include and xq:xquery elements for performing XML Inclusion and XML
Queries during XSLT processing while maintaining source document validation,
I noticed the following regarding the pre content model, which I find a bit
inconvenient.
I wanted my xi:include and xq:xquery elements to be allowed at nearly every
place in the document.
So according to the documentation, I included the elements in the Misc.extra
content model entity, changing line ~77 of xhtml11-model-1.mod from
<!ENTITY % Misc.extra "">
to my new line of xhtml11db-model-1.mod:
<!ENTITY % Misc.extra "| %xinclude.qname; | %xquery.qname;">
(The parameter entities xinclude.qname and xquery.qname are of course well
defined by including appropriate module files)
Using <xi:include/> and <xq:xquery/> works fine in <body/>, <div/>, <span/>
and many other elements. But when I used an <xi:include/> in a <pre/>
element, the XML Parser reported the document to be invalid, my
<xi:include/>-element violating <pre/>s content model.
The reason I believe is in xhtml-blkphas-1.mod., the definition of the pre
content model entity:
<!ENTITY % pre.content
"( #PCDATA
| %InlStruct.class;
%InlPhras.class;
| %tt.qname; | %i.qname; | %b.qname;
%I18n.class;
%Anchor.class;
| %script.qname; | %map.qname;
%Inline.extra; )*"
>
shouldn't this also include %Misc.extra; ? I strongly believe it is simply
missing but should be there.
So I suggest changing the content model of pre to:
<!ENTITY % pre.content
"( #PCDATA
| %InlStruct.class;
%InlPhras.class;
| %tt.qname; | %i.qname; | %b.qname;
%I18n.class;
%Anchor.class;
| %script.qname; | %map.qname;
%Inline.extra;
%Misc.extra; )*"
>
This would make my <pre><xi:include href="code/Hello.java"
parse="text" /></pre> finally possible.
Maybe it should even be %Misc.class; instead of %Misc.extra; to also allow
editing elements and which would require removal of the explicit
%script.qname;.
I also noticed that instead of using both, Inline.extra and Block.extra
instead of Misc.extra, does not work because some content models get both,
Block.extra and Misc.extra which would have the elements included twice in
the content model, which is invalid again. So that's not a valid workaround.
Are my assumptions about %Misc.extra; or %Misc.class; missing in %pre.content;
correct?
And while taking a closer look at %pre.content; I also notice that elements
like <sup/> or <sub/> are implicitely excluded from <pre/>'s content model by
not including %InlPres.class; but only its subset %tt.qname; | %i.qname; |
%b.qname;. I find this also inconvenient. Example:
<pre>public class Hello {
public static void main(final<sup><a href="#footnote1">1</a></sup>
String...<sup><a href="#footnote2">2</a></sup> args) {
for (String arg : args) {
System.out.print(args + " ");
}
System.out.println();
}
}</pre>
- From the document logic, I find the usage of <sup/> here valid. Of course, the
DTD model could be simply tricked by exchanging <sup/> and <a/> in the tree
or giving <a/> a stylesheet class formatting it as superscript, but that's
not the point.
The current assumption obviously is that pre cannot change the font size, it
should always behave like a terminal screen.
Another possible assumption could be that pre is for marking up things that
behave /mostly/ like a terminal screen, but since it's markup, additional
features should be available. And adding a footnote hyperreference anchor
with a superscript footnote number is imho not a violation of pre's
intention.
Another point of view why Misc.class in pre makes sense:
<p>Example of change in Java 5.0</p>
<pre>public class Hello {
public static void main(final String<del>[]</del><ins>...</ins> args) {
System.out.println("Hello, World");
}
}</pre>
Kind regards
- --
ITCQIS GmbH
Christian Wolfgang Hujer
E-Mail: Christian.Hujer@itcqis.com
WWW: http://www.itcqis.com/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)
iD8DBQFBB3vwMgwgpCF2K9sRAv8UAJwK9nQcOGPV1kG8lpfewZWtayeaJgCeLB6G
v9UDInlm+NtXRLg9FcfB/f4=
=9wys
-----END PGP SIGNATURE-----