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

RE: Strip space in Sablotron keeps unwanted (source XM

Subject: RE: Strip space in Sablotron keeps unwanted (source XML)li ne breaks :-(
From: "Avula, Raj" <ravula@xxxxxxxxxxx>
Date: Mon, 7 Apr 2003 11:06:27 -0700
vcalendar .xsl
If you start your xsl with the root level element it should solve the
problem.

<xsl:template match="/iCalendar">
	<xsl:apply-templates select="vcalendar/vevent" />
</xsl:template>

<xsl:template match="vevent".............

-----Original Message-----
From: Neil Smith [mailto:neil@xxxxxxxxxxxxxxx]
Sent: Monday, April 07, 2003 10:15 AM
To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Subject:  Strip space in Sablotron keeps unwanted (source XML) line
breaks :-(


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



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


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.