[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] How to put space between two characters?


Subject: RE: [xsl] How to put space between two characters?
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 06 Apr 2004 10:31:09 -0400

At 2004-04-06 07:23 -0700, puja thakral wrote:
But how can I add
<!DOCTYPE xsl:stylesheet [
> <!ENTITY nbsp " "> <!--known for HTML output,
> not in XML-->
> ]>
to my stylesheet?

Just as I showed you ... but I note that you (or my mailer?) corrupted the middle line and removed the numeric character reference.


Do I've to make a seperate doctype?

What is a "separate doctype"?


I'm sorry but I'm getting a little confused.

I'm sorry I wasn't more clear.


My stylesheet is:

<?xml version='1.0' encoding="UTF-8"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:xlink="http://www.w3.org/1999/xlink">

Then change it to:


<?xml version='1.0' encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp "&#xa0;"> <!--known for HTML output, not in XML-->
]>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:xlink="http://www.w3.org/1999/xlink">

Just add the three lines I gave you ... this is an XML issue, not an XSLT issue.

<xsl:template match="dataroot">

Unfortunately, your naked HTML got corrupted by my mail client, so I can't see what you have in the template rule.


I want to add space between the images so they're at least a little apart.

The following will place a non-breaking space between a bunch of children image elements (provided you add at the top the three lines I gave you) ... I'm only guessing at the names of your elements and attributes, but you'll get the picture (no pun intended!):


<xsl:for-each select="image">
  <xsl:if test="position()>1">&nbsp;</xsl:if>
  <img src="{@filename}"/>
</xsl:for-each>

I hope this helps.

.................. Ken

--
Public courses: Spring 2004 world tour of hands-on XSL instruction
Each week:   Monday-Wednesday: XSLT/XPath; Thursday-Friday: XSL-FO
Hong Kong May 17-21; Bremen Germany May 24-28; Helsinki June 14-18

World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Breast Cancer Awareness  http://www.CraneSoftwrights.com/s/bc


Current Thread
Keywords