whitespace

Prevent whitespaces between two XSLT-elements from being removed by the xslt-processor

Hi, my question is a bit different from the other ones.. i got an xsl-code like this: <xsl:value-of select="..."/> <xsl:value-of select="..."> what i want in my result is: result_of_select_1 result_of_select_2 what i get is: result_of_select_1result_of_select_2 how can i prevent this? ( any xsl:output option for example?...

Removing breaks from jsp

I have a function that transforms XML according to a XSLT. To test it, I'm using it in a jsp but it's entering a lot of breaks before my output. It seems to be the breaks I enter when setting variables: <c:set var="blah" value="blah" /> <c:set var="blah2" value="blah2" /> That will show two line breaks before the output. Is there a...

Whitespace before XML declaration from JSP

Hello I'm trying to achieve full XHTML transitional validation of my JSP output but I've hit a snag. The top of the header looks like this: <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; It is included with a stat...

Safest way to remove unwanted whitespace

Hi I have this HTML string which often has a lot of whitespaces Example: <p>All these words <br /> <strong>All</strong> <em>these</em> words <pre> All these words</pre> </p> I need to remove them using JavaScript, and have come up with this regEx: String.replace(/ {2,}/g, ''); Which seems to do the job with replacin...

How can I make lxml's parser preserve whitespace outside of the root element?

I am using lxml to manipulate some existing XML documents, and I want to introduce as little diff noise as possible. Unfortunately by default lxml.etree.XMLParser doesn't preserve whitespace before or after the root element of a document: >>> xml = '\n <etaoin>shrdlu</etaoin>\n' >>> lxml.etree.tostring(lxml.etree.fromstring(xml)) '<e...

How to strip whitespace-only text nodes from a DOM before serialization?

I have some Java (5.0) code that constructs a DOM from various (cached) data sources, then removes certain element nodes that are not required, then serializes the result into an XML string using: // Serialize DOM back into a string Writer out = new StringWriter(); Transformer tf = TransformerFactory.newInstance().newTransformer(); tf.s...

Mercurial diff: ignore trailing whitespace?

I am in the distinctly unfortunate circumstance of working in an environment which worries little of the deep evil known as "trailing whitespace"... But, alas, the enlightened Mercurial persists in warning me, by means of red highlights in diffs, that code I will be checking in contains this unholy thing. So, is there any way to tell Me...

Stylistic Question: Use of White Space

I have a particularly stupid insecurity about the aesthetics of my code... my use of white space is, frankly, awkward. My code looks like a geek dancing; not quite frightening, but awkward enough that you feel bad staring, yet can't look away. I'm just never sure when I should leave a blank line or use an end of line comment instead of...

Regexp require # of non-whitespace characters

I have a textarea. I am trying to check that it contains atleast 3 non-whitespace characters in javascript, and if it does, I need to recheck the posted message in php. I think once I get it working in php, I can use the same regexp for javascript. However, the whitespaces are messing it up. I don't understand why the following does no...

Alt+Space on a OSX causing defective code in HTML (Coda)

Hello, Is it a known problem that unregular spaces used in code can cause a CSS or an HTML to be defective ? When typing a bit fast, I sometimes type ALT+SPACE instead of SPACE (before the curly braces most of the time). Is it possible to make all alternative spaces symbols (that are invisible to the eyes, but not to the code) be the ...

How to auto-remove trailing whitespace in Eclipse?

Hello, The question has two parts, one of which I already have the answer for. How to auto-remove trailing whitespace from the entire file being edited? -> Answer: use the AnyEdit plugin, which can be set to do that on any save to the file. How to auto-remove trailing whitespace only from the lines I changed? -> This I don't know and ...

Simple bash script to read from one file having double quotes in content

Hi everyone. Well i am really pissed off :( I have a file called test.txt. and here it is: "/var/lib/backup.log" "/var/lib/backup2.log" double quotes are included in the file each at beginning and end of the directory and i can not remove them. i am trying to write a script to remove files in test.txt. like this: for del in `cat tes...

For loop using find lacks doesn't properly handle directory names having white space character

Hi everyone.. Well i am really stuck at this one. I have dirs.txt which is as follows: /var/tmp/old files.txt /var/tmp/old backups.bak dirs.txt file is generated by the script itself. When i want to use dirs.txt in a for loop like: for dir in `cat dirs.txt` ; do ls -al $dir done Here is what the command throws: ls: cannot ac...

Objective-C tab settings and whitespace style

Apple's Objective-C documentation, references, and generated code seem to be totally inconsistent with their coding style. I can not determine the "preferred" style (if one exists) for Objective-C and Cocoa source code. Here's what I've ran into so far. Tab settings Xcode's default setting is set to tabs. However, generated projects ...

Trim leading white space with PHP?

There seems to be a bug in a Wordpress PHP function that leaves whitespace in front of the title of the page generated by <?php echo wp_title(''); ?> I've been through the Wordpress docs and forums on that function without any luck. I'm using it this way <body id="<?php echo wp_title(''); ?>"> in order to generate an HTML body tag with...

How do you show formating charachters in a FlowDocumentPageViewer?

I am building a tool to display diffs between two text documents and I need to show formatting. Anyone know how to do it in a FlowDocumentPageViewer or WPF? ...

Is it good practice to trim whitespace (leading and trailing) when selecting/inserting/updating table field data?

Presuming that the spaces are not important in a field's data, is it good practice to trim off the spaces when inserting, updating or selecting data from the table ? I imagine different databases implement handling of spaces differently, so to avoid that headache, I'm thinking I should disallow leading and trailing spaces in any field d...

Antlr hidden channel whitespace problem

Hello, I have the following Antlr grammar: grammar MyGrammar; doc : intro planet; intro : 'hi'; planet : 'world'; MLCOMMENT : '/*' ( options {greedy=false;} : . )* '*/' { $channel = HIDDEN; }; WHITESPACE : ( (' ' | '\t' | '\f')+ | // handle newlines ( '\r\n' // DOS/Windows | '\r' // Macintosh | '\...

PHP - detect whitespace between strings

How would I go about detecting whitespace within a string? For example, I have a name string like: "Jane Doe" Keep in mind that I don't want to trim or replace it, just detect if whitespace exists between the first and second string. ...

whitespace UNION bug

This one got me the other day. What would you expect the following to return? SELECT 'X' AS line UNION SELECT 'X ' AS line Notice the space in the second SELECT. Well apparently SQL 2000 and 2005 both return 1 result. Even though its a UNION (and not a UNION ALL). There is nothing I can see in Books on line about this. Why does it ha...