[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: How to avoid a blank line

Subject: RE: How to avoid a blank line
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 21 Oct 2005 15:20:32 +0100
avoid blank spaces
A simple solution to this might be to apply normalize-space() to your text
nodes: though that will also lose some newlines that you want to keep. But
in HTML newlines are equivalent to spaces.

But you can use David Carlisle's solution if you want more control over the
appearance in a text editor.

Michael Kay
http://www.saxonica.com/

PS: if you have an earlier question that wasn't answered, it's probably a
good idea to take another look at it and ask yourself why. Probably the
question wasn't clear to people, perhaps it was too long, perhaps it was too
short. Most people only answer questions if they can understand the question
from a very quick reading. If it's an interesting and worthwhile question
they may spend a lot of time answering it, but they won't spend a lot of
time trying to understand it. And if you need to refer to it later, include
a hyperlink to the archives.



> -----Original Message-----
> From: Manfred Staudinger [mailto:manfred.staudinger@xxxxxxxxx] 
> Sent: 21 October 2005 14:22
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re:  How to avoid a blank line
> 
> > Are you generating HTML? Do you mean you have a blank line 
> in the HTML
> > source, or a blank line on the screen as shown by the browser?
> It's a switching forth and back between one large file 
> suitable for editing
> and many small xml files which are meant for a browser. One of those
> (warning: lines 5 and 6 contain utf-8 chars):
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <?xml-stylesheet href="../view-index.xsl" type="text/xsl"?>
> <body xmlns="http://www.w3.org/1999/xhtml">
>    <h3>Dr. Johann Aichholz</h3>
>    *1520, +1580 Wien
>    <br/>8 Wien, Anna
>    <br/>Beruf: Mediziner
>    <div class="index">
>       <a href="../Indices/Index.html">Personen-Index</a>
>       <span>Quellen:</span>
>       <a href="../Regesten/A1581-08-02-00535.xml">1581-08-02</a>
>    </div>
> </body>
> 
> > That kind of change has to be done in the template rules 
> for those text
> > nodes. Need to see more detail if you want more specific advice.
> True. This is my stylesheet:
> 
> <?xml version="1.0" encoding="UTF-8" ?>
> <xsl:stylesheet version="2.0"
> 			
> xpath-default-namespace="http://www.w3.org/1999/xhtml"
> 			xmlns="http://www.w3.org/1999/xhtml"
> 			
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:variable name="LF" select="'&#xA;'" />
> <xsl:output method="xml"/>
> <xsl:template match="node() | @*">
> 	<xsl:copy>
>      	<xsl:apply-templates select="node() | @*"/>
> 	</xsl:copy>
> </xsl:template>
> <xsl:template match="body">
> 	<xsl:apply-templates select="node() | @*"/>
> </xsl:template>
> <xsl:template match="div[@class='index']"/>
> <xsl:template match="/">
> <xsl:value-of select="$LF"/>
> <doc>
> 	<xsl:for-each select="collection('Tests/Indices?select=*.xml')">
> 	<xsl:value-of select="$LF"/>
> 	<reg><xsl:apply-templates select="body"/></reg>
> 	</xsl:for-each>
> <xsl:value-of select="$LF"/>
> </doc>
> </xsl:template>
> </xsl:stylesheet>
> 
> May I mention an other question (subject: Up-conversion using 
> XSLT 1.0)
> I've posted several days ago?
> 
> Regards, Manfred Staudinger

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.