473,402 Members | 2,055 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.

Q: strip white space

I am looking at xslt 1.0 and trying to understand if empty text nodes are
supposed to be stripped or not as the default behaviour.

3.4 starts by listing rules for when white space is not stripped and then
says "Otherwise the text node is stripped".

which appears to contradict a later paragraph that discusses the details
of the selection of nodes to be stripped ("Initially ... preserve ... all
element names").

xalan appears to keep white space by default, but I'm not yet familiar
enough with it to be sure I haven't invoked some white-space related
option with out realising it.

So, are empty text nodes in the xml source supposed to stripped or
preserved by default?
--

This space not for rent.
Jul 20 '05 #1
2 2216
yf***@vtn1.victoria.tc.ca (Malcolm Dew-Jones) writes:
I am looking at xslt 1.0 and trying to understand if empty text nodes are
supposed to be stripped or not as the default behaviour.

3.4 starts by listing rules for when white space is not stripped and then
says "Otherwise the text node is stripped".

which appears to contradict a later paragraph that discusses the details
of the selection of nodes to be stripped ("Initially ... preserve ... all
element names").

xalan appears to keep white space by default, but I'm not yet familiar
enough with it to be sure I haven't invoked some white-space related
option with out realising it.

So, are empty text nodes in the xml source supposed to stripped or
preserved by default?

text nodes are never empty: if the content of an element is empty no text
node is created. by default all nodes in the source are preserved and
all white space nodes in the stylesheet are stripped unless they are
children of xsl:text. You can change these defaults with xsl:strip-space
or xsl:preserve-space declarations. (MSXML doesn't play by the rules
here and strips white space by default, losing inter-word spaces as
often as not).

David
Jul 20 '05 #2
David Carlisle (da****@nag.co.uk) wrote:
: yf***@vtn1.victoria.tc.ca (Malcolm Dew-Jones) writes:

: > I am looking at xslt 1.0 and trying to understand if empty text nodes are
: > supposed to be stripped or not as the default behaviour.
: >
: > 3.4 starts by listing rules for when white space is not stripped and then
: > says "Otherwise the text node is stripped".
: >
: > which appears to contradict a later paragraph that discusses the details
: > of the selection of nodes to be stripped ("Initially ... preserve ... all
: > element names").
: >
: > xalan appears to keep white space by default, but I'm not yet familiar
: > enough with it to be sure I haven't invoked some white-space related
: > option with out realising it.
: >
: > So, are empty text nodes in the xml source supposed to stripped or
: > preserved by default?
: >
: >
: text nodes are never empty: if the content of an element is empty no text

"empty text nodes" was a bad choice of words by me, I meant text nodes
that contain only white space.

: node is created. by default all nodes in the source are preserved and
: all white space nodes in the stylesheet are stripped unless they are
: children of xsl:text. You can change these defaults with xsl:strip-space
: or xsl:preserve-space declarations. (MSXML doesn't play by the rules
: here and strips white space by default, losing inter-word spaces as
: often as not).

Thanks.
--

This space not for rent.
Jul 20 '05 #3

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

Similar topics

5
by: qwweeeit | last post by:
Hi all, I need to limit as much as possible the lenght of a source line, stripping white spaces (except indentation). For example: .. . max_move and AC_RowStack.acceptsCards ( self,...
17
by: Stanimir Stamenkov | last post by:
Is it possible to make two inline elements to appear adjacent stripping any white space appearing in between in the source? Example: <span class="adj">1</span> <span class="adj">2</span>...
0
by: Mark Moore | last post by:
I'm trying to layout a couple text input fields and their corresponding labels without using a table. When I was trying to debug my understanding of CSS, I was *very* surprised to see that span's...
38
by: Xah Lee | last post by:
sometimes i wish to add white space in <p> as to achived effects similar to tab. what should i do? using empty image seems the sure way but rather complicated. (and dosen't change size with...
6
by: Mark Miller | last post by:
I have a scheduled job that uses different XSL templates to transform XML and save it to disk. I am having problems with the code below. The problem shows up on both my development machine (Windows...
2
by: shagy | last post by:
Hi, I'm having a problem with a <select><option> which has white space in values... When I post the data I only get the first word (up to the white space). "Testing white space" becomes...
6
by: rtilley | last post by:
s = ' qazwsx ' # How are these different? print s.strip() print str.strip(s) Do string objects all have the attribute strip()? If so, why is str.strip() needed? Really, I'm just curious......
4
by: Nathan Sokalski | last post by:
I have two asp:ImageMaps in a table cell as follows: <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr valign="top"> <td align="center"> <asp:ImageMap ID="mapBanner"...
4
by: mosesdinakaran | last post by:
Can any one explain how the rule is applied for the following Regular expression $Str = 'the red king'; $Pattern = '/((red|white) (king|queen))/'; preg_match($Pattern,$Str,$Val); Result:
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.