473,782 Members | 2,458 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems with whitespace in output document

I have made an XSLT document, looking like this.

<xsl:styleshe et version="2.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes" method="text"/>
<xsl:template match="/">
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY>
<xsl:apply-templates/>
</BODY>
</HTML>
</xsl:template>
<xsl:template match="*">
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>

Nothing fancy about that, just writing out the elements. So I get this
output, when I see it in the browser (Mozilla on Linux).

A
B
E
F

C
D

But I want for it to be flattened, so all of the elements are aligned
left. I feel like, I have tried everything, with xsl:output and
normalize-string(), and I have no idea, how to remove the whitespace.

I also tried removing all the whitespace from my XML document, that
didn't help either.

Anybody with some good ideas?

Michael K. P.
Jul 20 '05 #1
1 1407
Michael Kragh Pedersen <m_************ **@hotmail.com> writes:
I have made an XSLT document, looking like this.

<xsl:styleshe et version="2.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes" method="text"/>
If you use the text output method, there is no indentation possible also
all element nodes in the result tree will be discarded, so you could
drop HTML etc from the code below and get the same result.
<xsl:template match="/">
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY>
<xsl:apply-templates/>
Note this also applies templates to text nodes so will copy any
indentation and other white space to the output.
</BODY>
</HTML>
</xsl:template>
<xsl:template match="*">
<xsl:apply-templates/> similarly this. </xsl:template>
</xsl:stylesheet>

Perhaps you want to add <xsl:strip-space elements="*"/> so that white
space nodes in the input are ignored, but if you output using the html
output method then unless you use <pre> or equivalent css then newlines
in the result won't render as newlines anyway si teh result should not
look like the result you show below when rendered in the browser.
Nothing fancy about that, just writing out the elements. So I get this
output, when I see it in the browser (Mozilla on Linux).

A
B
E
F

C
D

But I want for it to be flattened, so all of the elements are aligned
left. I feel like, I have tried everything, with xsl:output and
normalize-string(), and I have no idea, how to remove the whitespace.

I also tried removing all the whitespace from my XML document, that
didn't help either.

Anybody with some good ideas?

Michael K. P.


David
Jul 20 '05 #2

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

Similar topics

6
2333
by: Florian Wilhelm | last post by:
I have some easy questions, but I cant figure them out: I want to read exactly one char from stdin, there should be no need to hit enter. import sys print "Input: (y/N) ", input = sys.stdin.read(1) print "Your input:", input
1
6045
by: John | last post by:
I have been trying with no result, to force Xerces parsers to ignore whitespace in my XML file. I have tried several of the NG suggested setFeature() methods in DOMParser to no avail. I have now started to use the newest version of Xerces and as a result I stopped using DOMParser. The following fragment of my code shows how I create the parser and parse my XML file, which still has <null> #text fields for whitespace. How can I force...
8
2941
by: Tjerk Wolterink | last post by:
Hello all, how does xsl handle white space? I know you can set domething like this for nice indentation: <xsl:output method="xhtml" indent="yes"/> But know i have xsl code like this:
2
2169
by: Wolfgang Jeltsch | last post by:
Hello, it is often convenient to insert whitespace into an XML document in order to format it nicely. For example, take this snippet of a notional DocBook XML document: <para> This is a longer paragraph. With <wordasword>longer</wordasword> I mean that it contains more than one sentence.
11
4136
by: Tim Bücker | last post by:
I want to save an object of an image in a variable. I am doing this with the internet explorer with no problems using the following line: oImage = node.childNodes(0).all Now I wanted to use the W3C-standard and thought I could get my object using this here: oImage = node.childNodes(0).getElementById("pic") The node variable is from an xsl file: .... <div onclick="window.event.cancelBubble = true; clickOnNode(this);"
12
4913
by: Anna | last post by:
Hi all, I posted the same question this afternoon but my message isn't showing up, so I thought I'd give it another try.... in case you should see it later I apologize for posting the same question twice! Here it is: I am having problems reading the value of a text Node. I think it has to do with the fact that the text is in a <span> tag. I have a table and in each <td> I have text + a checkbox. I want to retreive the text next to the...
3
5087
by: Wade G. Pemberton | last post by:
Help!: I use javascript to format repetitive data from a web page input FORM into a long string , and save it as lines of comma delimited data in a text file on a Unix server. The text file is meant to be downloaded to MS Excel on the users' computers. Several such files will be downloaded and appended into the Excel file. Problem: The text file looks good when viewed offline by any text reader, but Excel will not import it...
5
1845
by: Kevin Westhead | last post by:
I'm using XslTransform to apply a transform to an XML document, however I get validation problems when parsing the resulting XML document due to invalid whitespace. I'm passing in an XPathNavigator for the input to the Transform method and specifying a Stream for the output. Here is an example of a transform and a document (it's the IconStyle sections that are causing problems): <?xml version="1.0" encoding="UTF-16"?> <!-- Copyright...
9
2557
by: amattie | last post by:
Does anyone have any idea on how I can strip the extra whitespace in the XML that shows up when I receive a response from an ASP.NET 2.0 webservice? This has been discussed before, but no one has ever come up with a good answer to what seems like such a common question. ...
0
9641
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10146
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10080
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9944
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3643
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2875
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.