an*********@yahoo.com wrote:
Hi,
Lets say I have a MIXED tag
element
in my XML DTD with content that is going to be rendered as HMTL, as
well as a <boldand <italicstag.
I would strongly recommend that you don't call elements after
appearances unless you are designing a DTD for describing typography
(and even then probably not).
What about whitespace?
Be careful.
Specifically, does the whitespace in PCDATA of the MIXED tag get
rendered into the output html? Or is it a setting in the XSL
transforming document?
It's a pitfall. Yes, the white-space in mixed content does get preserved
in the HTML serialization in XSLT, but only if you use the default
setting of preserving space.
If you use <xsl:strip-space elements="*"/to "tidy up" the output
serialization, irrelevant white-space is (correctly) suppressed between
elements in element content, and is still preserved in mixed content
*except* between adjacent elements (eg ...he said <italic>No</italic>
<bold>NO</bold>") where it is classed as a white-space-only node and
suppressed (omitted) so that you get...he said <i>No</i><b>NO</b>.
This is an unfortunate side-effect of XML being minimally processable
without a DTD or Schema (where element vs mixed content cannot be
foretold), and is one of the very few pieces of bad design in XSLT
because it happens *even* when the DTD is being used, which is precisely
the circumstance when it should *not* happen (when element vs mixed
content *is* foreknown).
You will be told -- by people who should know better -- that XSLT must
produce identical output whether run with or without a DTD/Schema, but
this is untrue (for example, default attribute values may cause
different output).
As web browsers ignore all excess white-space anyway (except in <pre>
elements), this shouldn't cause you any problems: just don't use
strip-space until you are more familiar with the rules governing
white-space nodes.
///Peter
--
XML FAQ:
http://xml.silmaril.ie/