473,402 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

whitespace in MIXED tag

Hi,

Lets say I have a MIXED tag in my XML DTD with content that is going
to be rendered as HMTL, as well as a <boldand <italicstag. What
about whitespace? 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?

Thanks,
Andy

Feb 18 '07 #1
1 1561
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/

Feb 18 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Perttu Pulkkinen | last post by:
No questions, but just consider if this is useful to you:-) but of course feedback & corrections are welcome. function php_mixed_to_js_value($jsname, $mixed) { if(is_null($mixed)) { return "\n...
1
by: Larry | last post by:
Reposting due to lack of response - I believe the .Net XmlValidatingReader should fail when validating XML that contains a ComplexType element with white space when the ComplexType element has the...
2
by: Wolfgang Jeltsch | last post by:
Hello, it is often convenient to insert whitespace into an XML document in order to format it nicely. For example, take this snippet of a notional DocBook XML document: <para> This is a...
4
by: Dwayne Epps | last post by:
I've created a function that checks form fields that only will have letters. This is the script: <script type="text/javascript" language="javascript"> function validateString(field, msg, min,...
4
by: Larry | last post by:
I believe the .Net XmlValidatingReader should fail when validating XML that contains a ComplexType element with white space when the ComplexType element has the mixed attribute set to false in the...
9
by: Edward Diener | last post by:
I received no answers about this the first time I posted, so I will try again. My inability to decipher an MSDN topic may find others who have the same inability and someone who can decipher and...
8
by: Bern McCarty | last post by:
Is it at all possible to leverage mixed-mode assemblies from AppDomains other than the default AppDomain? Is there any means at all of doing this? Mixed-mode is incredibly convenient, but if I...
44
by: Joe | last post by:
Is Python going to support s syntax the does not use it's infamous whitespace rules? I recall reading that Python might include such a feature. Or, maybe just a brace-to-indentation preprocessor...
8
by: Edward Diener | last post by:
By reuse, I mean a function in an assembly which is called in another assembly. By a mixed-mode function I mean a function whose signature has one or more CLR types and one or more non-CLR...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.