Content model for SVG <title> (was: Re: Input on the agenda)

Hi Jonas.

(The following discusses both parsing of <title> in text/html and
desired markup in SVG/XML.)

Jonas Sicking:
> In HTML mode, there are a set of elements that change the tokenizers
> 'content model flag':
> The following elements switch the tokenizer to CDATA state: noscript,
> noframes, style, xmp, iframe, script
> The following elements switch the tokenizer to RCDATA state: title, textarea
> The following elements switch the tokenizer to PLAINTEXT state: plaintext
> 
> It would be great if we could allow the same set of tags to affect the
> parser the same way in both HTML mode and in foreign content mode.
> If we made these changes I think there would be some optimizations
…
> that we could do on the implementation side. However more importantly,
> I think the consistency would be much appreciated by authors.

We discussed SVG <title> in text/html being parsed as RCDATA in our
telcon today and we came to the conclusion that we in fact would like to
have markup in there, primarily for interationalisation reasons.
Without using the deprecated Unicode language tag characters, it would
be impossible to mark up substrings of the text content as being in a
different language.

Exactly what elements we would want to allow as children of SVG <title>
in text/html is an open question, I think.  It doesn’t make sense to
have

  <title><p>something</p></title>

be conforming.  However, allowing something like

  <title xml:lang='en'>An analysis of the classic novel
    <span lang='zh'>紅樓夢</span> by
    <span lang='zh'>曹雪芹</span></title>

seems desirable.  It’s definitely not nice to have to use lang="" on the
HTML <span> elements there but xml:lang="" on the SVG <title> element.
Would an SVG element in there be preferable?

  <title xml:lang='en'>An analysis of the classic novel
    <tspan xml:lang='zh'>紅樓夢</tspan> by
    <tspan xml:lang='zh'>曹雪芹</tspan></title>

<tspan> is normally only intended for rendered blocks of text within an
SVG <text>, though.

Furthermore, is it actually desirable to be able to use other HTML
phrasing elements in SVG <title>?

  <title xml:lang='en'>An analysis of the classic novel
    <cite lang='zh'>紅樓夢</cite> by
    <del>an unknown author</del>
    <span lang='zh'>曹雪芹</span></title>

These things definitely should be fine in <desc>, but I (speaking for
myself) am unsure for <title>.


A similar argument can be made for bidi ordering markup.  While the
Unicode bidi control characters are not deprecated, they are discouraged
http://www.w3.org/TR/unicode-xml/#Bidi.


It was also brought up in http://www.w3.org/mid/49C7E5A1.1090103@w3.org
that it would be nice to be able to use a <switch> as a child of
<title>, to select title text based on the user’s language.  Now, I’ve
just noticed that in SVG Tiny 1.2 the conditional processing attributes
(such as systemLanguage="") are allowed on descriptive elements (of
which one is <title>), however the processing for descriptive elements
with conditional processing attributes hasn’t been defined.  Section
5.5.2 does seem to recommend the use of <title> elements *within* a
<switch> for this purpose:

  Authors may wish to deliberately provide multiple descriptive
  elements, such as to provide alternate content for different
  languages. In this case, the author should use conditional processing
  attributes to allow the user agent to select the best choice
  according to the user’s preferences. For example, the
  ‘systemLanguage’ attribute, with or without the ‘switch’ element,
  will determine the applicable descriptive elements. 
   — http://www.w3.org/TR/SVGTiny12/struct.html#multipleTitleDesc

As Doug points out in the above-referenced mail, having the <title>s as
children of the <switch> doesn’t seem quite right, as they would instead
be giving the title of the <switch> element itself.  In SVG 1.1 and
1.2T, <title> cannot have element children, but that would be something
we’d want to relax in the future, for these i18n reasons.

As it stands, in 1.2T, you can write this:

  <svg>
    <title xml:lang="zh-Hans" systemLanguage="zh">苹果</title>
    <title xml:lang="de" systemLanguage="de">Farbe</title>
    <title xml:lang="en">Apple</title>
    …
  </svg>

and because the spec says:

  If an SVG user agent needs to choose among multiple ‘title’ or ‘desc’
  elements for processing (e.g., to decide which string to use for a
  tooltip), and if any available conditional processing attributes are
  insufficient to resolve the best option, the user agent must choose
  the first of each of the available descriptive elements as the
  applicable ‘title’ and ‘desc’.

only one of the <title> elements will apply, so perhaps we don’t need to
worry about <switch> as a child of <title> (or <title> as a child of
<switch>)?

Thanks,

Cameron

-- 
Cameron McCormack ≝ http://mcc.id.au/

Received on Tuesday, 24 March 2009 00:50:04 UTC