[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
RE: Portable Constraints
- From: "Costello, Roger L." <costello@mitre.org>
- To: "xml-dev@lists.xml.org" <xml-dev@lists.xml.org>
- Date: Sat, 2 Apr 2011 10:36:41 -0400
Thanks Mukul and Stephen. Excellent comments.
You both make the strong point that when designing XML Schema 1.1 schemas it will be crucial to have great clarity regarding the impact on portability of the new <assert> element and the new inheritable attribute facility.
Mukul, I agree my example was poor and not compelling.
However, now I've got a good one. I found it in a book on HTML5 [1].
EXAMPLE: PORTABLE BLOG POST
First, let me alter the definition of portability a bit:
[Definition] Portable Data: the ability to take a chunk of markup out of one context and drop it into another context, unchanged.
Example: Suppose I have a blog post titled "Sudden Insights". Before HTML5, I would need to know the context of the blog post in order to decide which heading level to use for the title of the post. If the post is on the front page, then it appears after an h1 element containing the title of my blog:
---------------------------------------
<h1>Diverse Thoughts</h1>
<h2>Sudden Insights</h2>
<p>Got a new idea? Stop what you are doing and give attention to it immediately.</p>
---------------------------------------
But if I'm publishing the blog post on its own page, then I want the title of the blog post to be a level one heading:
---------------------------------------
<h1>Sudden Insights</h1>
<p>Got a new idea? Stop what you are doing and give attention to it immediately.</p>
---------------------------------------
**** The blog post is not portable data. ****
The blog post cannot be dropped into new contexts without modification.
However, in HTML5 I don't need to worry about which heading level to use. I just embed the blog post in the new article element:
---------------------------------------
<article>
<h1>Sudden Insights</h1>
<p>Got a new idea? Stop what you are doing and give
attention to it immediately.</p>
</article>
---------------------------------------
**** Now the blog post is portable. ****
It doesn't matter whether it's appearing on its own page or on the home page:
---------------------------------------
<h1>Diverse Thoughts</h1>
<article>
<h1>Sudden Insights</h1>
<p>Got a new idea? Stop what you are doing and give
attention to it immediately.</p>
</article>
---------------------------------------
HTML5's new outline algorithm produces the correct results:
- Diverse Thoughts
o Sudden Insights
This is one example of a portable chunk of markup. Prior to HTML5 a chunk of markup depended on its context. Now with the HTML5 article element a chunk of markup can be made portable.
Let's come up with other examples, outside the realm of HTML5. I believe that the above example is just one of a large set of portability examples. Let's put on our scientist hat and figure out what the recurring pattern is.
Would you provide an example of:
1. A chunk of markup that must be altered with each context it is embedded in.
2. Then, revise the chunk of markup such that it is independent of context.
/Roger
[1] The HTML5 example is largely from p.75-6 of "HTML5 for Web Designers" by Jeremy Keith.
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]