WritersUA: Day 3, Morning

March 19th, 2008 by Sarah O'Keefe

Dave Gash (hypertrain.com) leads off the festivities with a discussion of the UA Holy Grail. And no, it’s not DITA.

He is discussing True Separation of Content, Structure, Format, and Behavior.

Interesting, because we normally hear about separation of content and presentation — he’s making finer distinctions.

According to Dave, the current authoring method is to using WYSIWYG and code editors, often in combination. And as we work, we insert what’s needed wherever it’s needed. The result is that documents work — once — but are very difficult or impossible to update, maintain, and control.

Spaghetti-code documents make our own jobs harder.

The conventional wisdom is to separate content and formatting. Content is “stuff on the page”; therefore format must be “everything that is not content.”

Content could include HTML, CSS, and JavaScript. Separating out CSS still leaves “junk” in the content pages.

Dave proposes a more refined model: content, structure, formatting, and behavior.

* Content is XML
* Structure is XSLT
* Format is CSS
* Behavior is JavaScript (JS)

This will be more maintainable, which means:

* Ability to change any components without breaking the others
* Ability to reuse any component in other pages or projects
* Ability to control each component’s resource allocation (that is, who creates each piece?)

How to improve your pages:

1. Identify and externalize JS behavior.

* Find the embedded scripts (<script> tags) and remove them with a reference to an external foo.js file.

<script language=”javascript” src=”foo.js”></script>

2. Identify JS behavior that could be CSS and convert it to CSS rules.

“If you can encode with CSS and make it declarative instead of procedural, you’re way ahead of the game.”

* Catch “sneaky” JavaScript behavior, such as mouseover events, that could be CSS rather than JavaScript. Event handlers that call JavaScript almost always start with “on” — easy to identify and many can be replaced with CSS hover pseudoclasses.

.expterm:hover {font-style:italic; }
.expterm {text-decoration:none;}

Removing the code from the HTML greatly simplifies the page.

3. Identify and externalize CSS styles, recode any local formatting as classes.

Get rid of “deprecated tags and doo-doo like that.”

Get rid of style attributes, font tags, b tags (become span tags).

“It’s said that comments are for someone who comes behind you six months later and needs to update your code. This is not true. Comments are so that YOU can figure out six months later what you were doing in the code.”

So you should comment your code.

4. Semantically mark up content as XML.

Dave’s definition of semantic markup? “call things what they are.”

5. Identify desired HTML output structure, write XSL transforms to produce it.

So…what’s in it for me?

Discrete, maintainable, controllable components
* you can change one component without breaking others
* You can share components with other pages
* You can separate work load by skill sets
* Set it and forget it! (for everything except the content)

Code examples are available at Dave’s web site: www.hypertrain.com

Questions about tools. No, he won’t recommend tools. Question about schemas…Dave says the first thing that comes to mind is…DocBook???

Yikes. In an answer to a question about print and XSL-FO, somebody recommended asking….me! (I swear I didn’t pay her for that, and I don’t think she even knew I was in the room. Quite surreal.)

##

My only disagreement with this session is with the separation of XML as “content” and XSLT as “structure.” It’s my opinion that the XML includes the structure, and XSLT just gives me a way to express that structure into HTML or other formats.

I also question some of his tag names, such as <expander> for a term/definition group. The expander tag name is really a description of the desired behavior (expandable text) rather than the semantic function of the content (definition of a term). I would probably choose something like <glossaryitem> for the container, leaving opening the option of changing the behavior to something other than expansion in the future. Same quibble with <ddblock> (drop-down block).

I do like the use of the tag name for step results.

Great presentation from an energetic presenter whose motto is, “If I have to be awake, you do, too!”

Side note: I’m pretty sure that if you tied Dave’s hands behind his back, he would lose his ability to speak.


3 Responses to “WritersUA: Day 3, Morning”

  1. Bill Albing says:

    I’m enjoying reading your daily updates from WritersUA; while not attending this year, I can still enjoy the snippets.
    With regards to Dave’s presentation, I think there’s a lot more separation going on — content from all sorts of stuff — in the pub/sub realm where the subscriber can decide what parts of the content to view and in what format.
    Keep going!

  2. Bill Albing says:

    I’m enjoying reading your daily updates from WritersUA; while not attending this year, I can still enjoy the snippets.
    With regards to Dave’s presentation, I think there’s a lot more separation going on — content from all sorts of stuff — in the pub/sub realm where the subscriber can decide what parts of the content to view and in what format.
    Keep going!

  3. Bill Albing says:

    I’m enjoying reading your daily updates from WritersUA; while not attending this year, I can still enjoy the snippets.
    With regards to Dave’s presentation, I think there’s a lot more separation going on — content from all sorts of stuff — in the pub/sub realm where the subscriber can decide what parts of the content to view and in what format.
    Keep going!

Leave a Reply