473,394 Members | 1,714 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,394 software developers and data experts.

new line

I'm generating text files containing html to be re-used elsewhere.
Naturally, the xsl code sits on different lines in the .xsl file.
However, sometimes the new lines are reflected in the resulting html
and sometimes it's not so the results of one line of xsl just
continues from the results of the previous xsl line on the same output
file line.

How can I control this more precisely?

TIA,
David

Jun 4 '07 #1
3 2952
David Schwartz wrote:
How can I control this more precisely?
XSLT has to assume that whitespace may be meaningful in your output
document, so in general it doesn't generate any unless you tell it to
either by copying the newline from your source document or by explicitly
writing one out with <xsl:text>
</xsl:text>. (Or <xsl:text> </xsl:textor
<xsl:text>&#xa;</xsl:text>, which use character references to express
the line break and may be a bit easier for other folks to read.)

If you are absolutely certain that spurious whitespace won't harm your
documents, you can also try turning on indentation in xsl:output. In
some processors you will also have to use a nonstandard feature to tell
the system how much indentation you want per level. (Xylem assumes 0
unless you tell it otherwise).

If you're getting whitespace where you didn't want it, that's a
different set of problems; normalize-space() and xsl:strip-space may be
helpful knobs to tweak in that case.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Jun 4 '07 #2
If you are absolutely certain that spurious whitespace won't harm your
documents, you can also try turning on indentation in xsl:output.
Thanks Joe. I had indent turned on which is one of the reasons I was
surprised by what I was seeing. It seemed to be somewhat random so not
sure what was going on. However, <xsl:text> </xsl:textis working
with Xalan just fine.

Thanks again.

Jun 4 '07 #3
David Schwartz wrote:
Thanks Joe. I had indent turned on which is one of the reasons I was
surprised by what I was seeing. It seemed to be somewhat random
Probably not random at all. Remember that indentation will only be added
when there is no adjacent text value it could get confused with, just as
XSLT will ignore whitespace in the stylesheet except when there's
adjacent text it might be part of. If you've explicitly output any text
content, indent won't break the line at that point.

You might want to figure out whether that's what was making the
difference, just as a learning exercise. But...
<xsl:text> </xsl:textis working with Xalan just fine.
Glad to help.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Jun 4 '07 #4

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

Similar topics

8
by: Peter A. Schott | last post by:
Per subject - I realize I can copy/paste a line at a time into an interactive session when I'm trying to debug, but was wondering if there is any tool out there that allows me to copy sections of...
65
by: Skybuck Flying | last post by:
Hi, I needed a method to determine if a point was on a line segment in 2D. So I googled for some help and so far I have evaluated two methods. The first method was only a formula, the second...
22
by: DraguVaso | last post by:
Hi, For my application I need the following behavior: When I press F4 the cursor has to move to the next line in my multiline textbox which begins with "0". Finding lines starting with 0 isn't...
3
by: Double Echo | last post by:
Hi all, I'm using PHP 4.4.2, and use PHP on both the command-line and the web. I am running PHP on SuSE 10 Linux , in a VMware 5.5 workstation, using Apache 2.0.55 , on my Dell laptop. ...
9
by: Adi | last post by:
Hello eveyone, I wanna ask a very simple question here (as it was quite disturbing me for a long time.) My problem is to read a file line by line. I've tried following implementations but still...
6
by: magix | last post by:
Hi, when I read entries in file i.e text file, how can I determine the first line and the last line ? I know the first line of entry can be filtered using counter, but how about the last line...
6
by: Jacob Rael | last post by:
Hello, I have a simple script to parse a text file (a visual basic program) and convert key parts to tcl. Since I am only working on specific sections and I need it quick, I decided not to...
14
by: WStoreyII | last post by:
the following code is supposed to read a whole line upto a new line char from a file. however it does not work. it is producing weird results. please help. I had error checking in there for...
11
by: xdevel | last post by:
Hi, I don't understand option. if I write: #line 100 "file" I change file numeration to start to line 100 but what "file" ? any example?
19
by: =?Utf-8?B?QnJpYW4gQ29vaw==?= | last post by:
This is an example of the data; 2007/07/27 11:00:03 ARES_INDICATION 010.050.016.002 404.2.01 (6511) RX 74 bytes 2007/07/27 11:00:03 65 11 26 02 BC 6C AA 20 76 93 51 53 50 76 13 48...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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...

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.