472,353 Members | 1,818 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 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 2099
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: .. . ...
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...
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...
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...
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...
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...
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...
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...
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)...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

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.