Syd Baumann wrote:
> Basically xml:space= is a suggestion to a processor that doesn't
> really fit into the TEI world view (previously "descriptive markup",
> nowadays "indicative logical markup").
I would agree; but what that agreement entails for the inclusion or
otherwise of xml:space as a default P5 attribute is complicated by the
semantics of the value "default" on that attribute.
Some people who haven't read this part of the spec carefully (and many
others who haven't read it at all) assume that there is something somewhere
(maybe in yet another of the proliferating XML family specs) that is defined
as "the" default handling of whitespace for conformant applications, and
that setting xml:space to "default" instructs an application to proceed
according to this supposed default when it encounters white space.
But that is far from the case. At 2.10, the spec reads:
The value "default" signals that applications' default white-space
processing modes are acceptable for this element; the value "preserve"
indicates the intent that applications preserve all the white space.
I.e. only the value "preserve" has a determinate meaning (=please adopt the
XML-parser-specific behaviour that all whitespace in the document is
passed to an application). The meaning of "default" is not a specified
default or fallback defined elsewhere, but, on the contrary, it is whatever
the default whitespace handling of the application concerned happens to be.
By definition, this is unknowable at markup time, since we cannot predict
what specific applications will process our documents. Note the additional
complication implied in the placing of the apostrophe on the word
"applications" It is possible that our markup will be processed by multiple
applications, and each of these applications may well do something quite
different with whitespace as its "default". And all we can know for certain
is that we don't know what that will be.
In other words, by setting "preserve" we know we are requesting an
application to retain each and every whitespace character within that
setting's scope, which may well include inter-element whitespace inserted by
an application for pretty-printing purposes (something which may, inter al,
skew the enumeration of nodes) as well as spaces within mixed content which
actually represent lexical token boundaries and so are semantically
Conversely, by setting "default" we may well be inviting applications to
ignore not only pretty-printing inter-element spaces but some token-boundary
markers within mixed content, making nonsense of parts of our text; but
whether or not that is the case, we can have no means of knowing, unless,
per impossibile, we had a list of all the applications that will ever
process our markup, along with a description by their designers of how they
have chosen to handle whitespace.
In the the following encoding:
<s><w>This</w> <w>is</w> <w>a</w> <w>sentence</w>.</s>
the <s> element is not meant to contain the string "thisisasentence." but in
the absence of an xml:space="preserve" either on the <s> or at higher scope,
an application may well decide to strip the spaces between the <w> elements.
Most people encounter this behaviour in the context of XSLT processors,
where it can of course be countered in a variety of ways. However, there is
nothing to oblige other applications to be so accommodating: the best that
can be generally hoped for is that the application will honour an xsl:space
attribute setting of "preserve"; but that hope is vain if the DTD or scheme
doesn't allow that attribute in the first place.
It's easy enough to see how this somewhat unsatisfactory situation came
about, as an attempt to solve the conundrum of how XML should cope with what
in DTD-governed SGML could be reliably detected as "ignorable" white space.
The question is whether this indeterminacy, probably unavoidable in a spec
that allows for merely well-formed documents, should be imported into P5,
especially in view of the fact that all TEI-conformant documents must be
valid (even if they are not always validat*ed* all all stages in a workflow)
and hence it is always possible for a processor that has access to the
schema or DTD to determine which whitespaces would have been "ignorable" in
an SGML sense, so that the complex of issues that make XML whitespace
handling so troublesome should be avoidable.
But of course in the XML world to which P5 is committed, some applications
don't know how to access a DTD or schema, or they do but they aren't given
such access at all stages in our workflow. So requiring applications to
base their "default" processing of whitespace on a knowledge of content
models would not be feasible.
It looks to me as though there are three possibilities:
1) Leave the applications to do their own default (which is what the current
absence of xml:space from P5 does), but publish, for the benefit of
application designers, a list of P5 elements within which all white space
should be preserved.
2) Allow xml:space, but in addition specify precisely what an XML processor
is expected to do with elements within the scope of an xml:space value of
"default" within TEI documents, then advise encoders to set xml:space to
"default" at the corresponding places in their markup in the hope that
applications designed for TEI processing will know what to do and agree to
3) Allow xml:space, but recognise that the value "default" is of itself
meaningless and consequently advise encoders to set the "preserve" value on
all elements where the removal of inter-element space would damage the
semantics of the text, while stressing that this particular limited form of
non-binding request to a application is the best that can be achieved, so
that the outcome may not be as expected.
It seems to me that neither 1) or 2), whatever their intrinsic merits or
drawbacks, is practical. Apart from anything else, we want our markup to
work with applications that already exist, as well as with future
applications whose developers may be unwilling to honour distinctions
between the appropriate treatment of spaces in <tei:foo>s as distinct from
But 3) at least allows encoders to request that applications preserve spaces
in mixed content in the only way the XML spec allows, and hence the only way
applications can be reasonably expected (though not required) to support.
This is not all we need; but it's probably the best we can get (short of
encoding all token-delimiting spaces as <c> </c>, which is tedious in the
extreme). So I'd be in favour of making xml:space a global, but documenting
its semantics in a way that would avoid otherwise pretty inevitable
misunderstandings and false expectations on the part of encoders.