Subject: RE: [xsl] How to avoid a blank line From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Fri, 21 Oct 2005 15:20:32 +0100 |
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: [xsl] 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="'
'" /> > <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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] How to avoid a blank line, Manfred Staudinger | Thread | RE: [xsl] How to avoid a blank line, Jarno.Elovirta |
RE: [xsl] break line using styleshe, Michael Kay | Date | Re: [xsl] How to avoid a blank line, Manfred Staudinger |
Month |