xsl-list
[Top] [All Lists]

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

2003-05-22 00:36:52
Wendell and Mike,

Thanks for that.  I would have considerably overcomplicated things if I'd
stuck with my current plan.

Thanks again

Simon


----- Original Message -----
From: "Wendell Piez" <wapiez(_at_)mulberrytech(_dot_)com>
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Sent: Wednesday, May 21, 2003 5:21 PM
Subject: RE: [xsl] [OT] Can XML elements contain text as well as other
elements?


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....

Cheers,
Wendell

___&&__&_&___&_&__&&&__&_&__&__&&____&&_&___&__&_&&_____&__&__&&_____&_&&_
     "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:  http://www.mulberrytech.com/xsl/xsl-list




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list