Subject: Re: [xsl] XML apparently cannot be used for general text markup: whitespace gripe From: "Winchel 'Todd' Vincent III" <winchel@xxxxxxxxxxxxxx> Date: Tue, 19 Mar 2002 05:59:16 -0500 |
Chad: This is a nasty problem, but it is really not a problem with XML (or even HTML), but simply highlights a very important difference between the two. HTML collapses multiple white space in element content to a single white space. XML preserves white space inside element content. So, if you want this XML fragment: <Paragraph>This is my name: <FirstName>John</FirstName> <LastName>Doe</LastName>.</Paragraph> to become this HTML fragment: <p>This is my name: John Doe.</p> you can't do the above, you have to do this: <p>This is my name: John Doe.</p> It is not impossible, but, yes, its not very much fun and occurs so often that it is really, really not fun. I hope this helps, Todd ========================================= Winchel "Todd" Vincent III Attorney and Technical Consultant Project Director, E-CT-Filing Project Georgia State University College of Law US Phone: 404.651.4297 US Cell: 404.822.4668 US Voice Mail: 770.216.1633 US Fax: 770.216.1633 US Fax: 425.955.1526 AU Fax : 011 61 2 9475 0147 AU Mobile: 011 61 0408 606 272 Email: winchel@xxxxxxxxxxxxxx Web: http://e-ct-file.gsu.edu/ ----- Original Message ----- From: "Chad Jones" <chad@xxxxxxxxxxxxxx> To: <XSL-List@xxxxxxxxxxxxxxxxxxxxxx> Sent: Tuesday, March 19, 2002 9:06 AM Subject: [xsl] XML apparently cannot be used for general text markup: whitespace gripe > Hi there, > > I've noticed a lot of xml-derived web pages out there have screwed up > whitespace (words crammed together or an incorrect space before ending > punctuation). > > My conclusion is that blocks straight text (such as paragraphs) cannot be > further marked up with XML without screwing up spacing. > > For example, can anyone get this simple document into HTML without either > removing required spaces or adding inappropriate spaces? > > <?xml version="1.0"?> > <book> > <par> > Is his name really <first>John</first> <last>Doe</last>? > </par> > </book> > > Either you will end up with: > "Is his name really JohnDoe?" > which is wrong, or: > "Is his name really John Doe ?" > which is also wrong. > > Of course, this is a very simple example. In real-life situations bad > whitespace causes really nasty problems. Of course, I'm pretty new to XSL > so maybe I just can't read the directions. Here's my XSL example: > > <?xml version="1.0" encoding="utf-8"?> > <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > version="1.0"> > <xsl:output method="html"/> > <xsl:preserve-space elements="*"/> > <xsl:template match="/"> > <html><xsl:apply-templates/></html> > </xsl:template> > </xsl:transform> > > Does anyone know of a work-around for this common problem? > > TIA > Chad Jones > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] XML apparently cannot be used, Chad Jones | Thread | Re: [xsl] XML apparently cannot be , David Carlisle |
RE: local-name() namespace xslt 2.0, Bryan Rasmussen | Date | Re: local-name() namespace xslt 2.0, David Carlisle |
Month |