W3C home > Mailing lists > Public > www-xsl-fo@w3.org > December 2003

Re: To Remove White after the End of Element for Each CDATA element !!!

From: David Carlisle <davidc@nag.co.uk>
Date: Thu, 18 Dec 2003 14:04:20 GMT
Message-Id: <200312181404.OAA19242@penguin.nag.co.uk>
To: sguy_chennai@yahoo.co.in
Cc: www-xsl-fo@w3.org

Note CDATA sections are not elements, and XSLT does not see them, so
your input is equivalent to the input below which does not use
CDATA. This would be much easier in XSLT2, but in XSLT1 you just need a
small recursive loop to strip off the trailing space.

            <DONE>A B FL  3432
            <DONE>C C FT  1111
            <DONE>T T RT  2323

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

<xsl:template match="/">
<xsl:apply-templates select="/x/WOOD/WORK/DONE"/>

<xsl:template match="DONE">
<xsl:call-template name="x"/>

<xsl:template name="x">
<xsl:param name="s" select="."/>
<xsl:variable name="l" select="substring($s,string-length($s))"/>
<xsl:when test="$l=' ' or $l='&#10;'">
<xsl:call-template name="x">
  <xsl:with-param name="s"
<xsl:value-of select="$s"/>


$ saxon wood.xml wood.xsl
<?xml version="1.0" encoding="utf-8"?>
[A B FL  3432]
[C C FT  1111]
[T T RT  2323]


This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
Received on Thursday, 18 December 2003 09:07:59 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:58:28 UTC