473,395 Members | 2,713 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,395 software developers and data experts.

Controlling EOL Convention for XSLT Output

Is there any standard way to control the end-of-line convention (LF
versus CR/LF) for XSLT processor output?

The obvious logical point to control this would be in xsl:output.
However, Kay says of its 'media-type' attribute "The specification
doesn't say what use is made of this information[...]", which sounds
pretty discouraging. I wonder how many XSLT processors running on *nix
actually emit CR/LF sequences when the output media-type is set to
"text/plain".

Note that this is *not* a question about what the octal code is for
carriage return, or how to manually insert a literal carriage return
into XSLT output.

Oct 9 '07 #1
6 5820
ronburk wrote:
Is there any standard way to control the end-of-line convention (LF
versus CR/LF) for XSLT processor output?
Remember, XML doesn't distinguish between these, and XSLT processes XML
data. This was deliberately left as an implementation detail so software
could use whichever convention made sense for the target processing
environment.

Some processors may support a PI, or command-line option, or extension
attribute, or some other hint to tell them which to use. Those which are
called via an API may be configurable at that level, by setting up the
output stream appropriately or setting a flag.

But there's no way to express this preference in pure XSLT itself.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Oct 9 '07 #2
ronburk wrote:
Is there any standard way to control the end-of-line convention (LF
versus CR/LF) for XSLT processor output?
No.
>
The obvious logical point to control this would be in xsl:output.
However, Kay says of its 'media-type' attribute "The specification
doesn't say what use is made of this information[...]", which sounds
pretty discouraging. I wonder how many XSLT processors running on *nix
actually emit CR/LF sequences when the output media-type is set to
"text/plain".

Note that this is *not* a question about what the octal code is for
carriage return, or how to manually insert a literal carriage return
into XSLT output.
If you are using xml output method then it's fairly system dependent how
it gets serialised as the system can use any serialisation that would
parse the same way, so line endings are out of your control (unless
there is a processor-specific configuration)
but if you are using media type text/plain then presumably you are also
using thet text output method in which case I think it's reasonably safe
(but not guaranteed) that you just get whatever characters you have in
the result tree so use & # 1 3 ; & # 1 0 ; explictly to get crlf.

David
--
http://dpcarlisle.blogspot.com
Oct 9 '07 #3
Remember, XML doesn't distinguish between these, and XSLT processes XML
data.
That's not the issue. The issue is that XSLT does, after all, define
a 'media-type' attribute for output -- but renders it useless (that
is,
of less use than it could have been) by not requiring processors
to do anything with it.

The issue is nothing to do with what is happening with the EOL
during XSLT processing, it's only to do with xsl:output, where
the standard goes all the way to specify how one specifies
a MIME type -- which is apparently of no portable use (since
the processor can ignore it).
Oct 10 '07 #4
but if you are using media type text/plain then presumably you are also
using thet text output method in which case I think it's reasonably safe
(but not guaranteed) that you just get whatever characters you have in
the result tree so use & # 1 3 ; & # 1 0 ; explictly to get crlf.
In contrast, *I* think it's reasonably safe that text/plain will get
you
the EOL convention your XSLT processor (or its VM) was compiled with
(CR/LF for Windows processors, LF for Unix processors),
so you won't be able to get rid of that CR when you want
to run under Windows and produce text output suitable
for *nix. (I predicted I would get handed the character code for
CR and instructions for manually inserting, but was still unable
to prevent it. Damn your curse, Apollo! :-)

Oh well, it all comes down to "tr -d '\r'" and an extra pass to
make things slower. Humph, but such is life.

Oct 10 '07 #5
ronburk wrote:
Oh well, it all comes down to "tr -d '\r'" and an extra pass to
make things slower. Humph, but such is life.
>

that is always an option, although as far as I can see saxon 8 (even on
windows) uses unix style endings always so if you want dos style ones
using an explict #13 as i suggested does the trick. But perhaps this
depends on exactly what jvm settings you have? I must admit I have
pretty much converged on saxon these days so I'm not sure what other
processors do.

david

--
http://dpcarlisle.blogspot.com
Oct 11 '07 #6
David Carlisle wrote:
pretty much converged on saxon these days so I'm not sure what other
processors do.
I suspect many (most?) of those written in Java use the standard Java
mechanism for specifying newline, which would let you select either
option by setting the System Property "line.separator" before running
the transformation.
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Oct 12 '07 #7

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

Similar topics

6
by: Pete | last post by:
I am just getting to grips with XML and I was wondering if you could help me with something that no-one seems able or willing to help with.. I have an XSLT file which should be transforming a...
1
by: Wolfgang | last post by:
XSLT transformations by default seem to pass name space attributes into the root element of their output (example below). QUESTION: Is it possible to control this, i.e. not genrating a name...
2
by: Andy Fish | last post by:
Hi, I was wondering if there is any way to control the whitespace (specifically line breaks) that are generated using Xalan XSLT processor with output method=html. I find it sometimes...
1
by: Lisa | last post by:
I need to apply the HTML formatting tags and the French accented characters in a XML document. The XML is generated from a database that has HTML tags and French accented characters in the records....
2
by: Taare | last post by:
Hi, I got <xsl:output method="html" encoding="iso-8859-1" doctype-public="-//W3C//DTD HTML 4.01//EN" doctype-system=" http://www.w3.org/TR/html4/strict.dtd"/> in my XSLT file. This should remove...
3
by: danmc91 | last post by:
Hi, I'm just getting going with xml and xslt. I'm trying to write what are essentially man pages and I need 3 output formats. 1) nroff -man format for real man pages 2) html for an online...
7
by: Harolds | last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005 the pmID is evaluated to "" instead of what the value is set to: .... xmlItems.Document = pmXML // Add the pmID...
18
by: yinglcs | last post by:
Hi, I have a newbie XSLT question. I have the following xml, and I would like to find out the children of feature element in each 'features' element. i.e. for each <featuresI would like to...
2
jkmyoung
by: jkmyoung | last post by:
Here's a short list of useful xslt general tricks that aren't taught at w3schools. Attribute Value Template Official W3C explanation and example This is when you want to put dynamic values...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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.