RE: [xsl] [OT] Can XML elements contain text as well as other elements?

Subject: RE: [xsl] [OT] Can XML elements contain text as well as other elements?
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 21 May 2003 11:21:17 -0400
At 10:47 AM 5/21/2003, Mike wrote:
> This is a bit OT, but I am thinking of ways to reduce the
> depth of an XML doc, to reduce the amount of templates in my xsl doc.

Unless you have layers of elements that are completely redundant, this
could be counter-productive. Certainly, mixed content (elements and text
as siblings) can be quite hard to process if you want to do anything
non-trivial with it.

I agree with Mike that the general aim may be misconceived -- I too have seen mixed content used by neophyte designers in places where it causes trouble, but confers no benefit (as have all long-time readers of this list).

The best (only?) use case for mixed content is in truly documentary applications -- inline tagging to represent inline phenomena (like HTML <code>, <i>, what have you). It isn't generally a technique for reducing tagging overhead. On the contrary, when the data elements aren't actually "mixed" (that is, when they are intended to be pulled apart and used separately, not always together), they always benefit from proper labeling and wrapping.

This isn't to discourage, it's just to alert that it's a deeper question than it may at first appear to be.

Reducing the number of templates in a stylesheet isn't an optimization I've ever seen pay off -- the cost elsewhere in the system (complexity of processing required; trouble to other users) can be more than it's worth. (And many of the nicest stylesheets have lots of itty-bitty, simple templates.)

As Mike says, of course, "completely redundant" tagging is a different question.

To declare mixed content in W3C schema, just say "mixed='yes'" on the element declaration....


    "Thus I make my own use of the telegraph, without consulting
     the directors, like the sparrows, which I perceive use it
     extensively for a perch." -- Thoreau

XSL-List info and archive:

Current Thread