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

[xsl] Strip space in Sablotron keeps unwanted (source XML) line breaks :-(


Subject: [xsl] Strip space in Sablotron keeps unwanted (source XML) line breaks :-(
From: Neil Smith <neil@xxxxxxxxxxxxxxx>
Date: Mon, 07 Apr 2003 18:15:22 +0100

Hi All -

Quick question if any of you have experience of using Sabloton on Apache / PHP platform :

I have xml file formatted for readbility as below, and in my stylesheet I'm using <xsl:strip-space elements="iCalendar vcalendar vevent" /> to remove the dead space.

Problem : I'm trying to output as a flat text file using Sablotron, and unfortunately I get 3 line breaks at the top of the output, which correspond to those in the top level elements in the source XML file.

I need to remove line breaks on output - any suggestions ? Is this a known limitation with Sablotron or have I overlooked some output encoding magic which will work ?

Source XML :

<iCalendar>
	<vcalendar version="2.0" prodid="-//hacksw/handcal//NONSGML 1.0//EN">
		<vevent id="1">
			<uid>19970901T130000Z-123401@xxxxxxxx</uid>
			<dtstamp>19970901T130000Z</dtstamp>
			<dtstart>19970903T163000Z</dtstart>
			<dtend>19970903T190000Z</dtend>
			<location>Location</location>
			<summary>Annual Employee Review</summary>
			<description>
		</vevent>
	.
	.
	(more vevents)
	.
	.
	</vcalendar>
</iCalendar>

Stylesheet example code :

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:strip-space elements="iCalendar vcalendar vevent" />
<xsl:preserve-space elements="description"/>
<xsl:param name="current" select="0" />

<xsl:template match="vevent">
<xsl:choose>
<xsl:when test="@id=$current">
	<xsl:text>BEGIN:VCALENDAR&#x0A;</xsl:text>
	<xsl:text>BEGIN:VEVENT&#x0A;</xsl:text>
	<xsl:apply-templates select="dtstart"/>
	<xsl:apply-templates select="dtend"/>
	<xsl:apply-templates select="uid"/>
	<xsl:apply-templates select="summary"/>
	<xsl:apply-templates select="description"/>
	<xsl:apply-templates select="location"/>
	<xsl:text>END:VEVENT&#x0A;</xsl:text>
	<xsl:text>END:VCALENDAR&#x0A;</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:template>

... templates ...

</xsl:stylesheet>


<xsl:output method="text" indent="no" />




Cheers,
Neil Smith.


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list




Current Thread
Keywords
xml