<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<xsl:template match="/">
		<xsl:apply-templates select="table/row"/>
	</xsl:template>

	<xsl:template match="row">
		<xsl:call-template name="pad-right">
			<xsl:with-param name="str" select="brand/text()"/>
			<xsl:with-param name="len" select="12"/>
		</xsl:call-template>
		<xsl:call-template name="pad-right">
			<xsl:with-param name="str" select="year/text()"/>
			<xsl:with-param name="len" select="4"/>
		</xsl:call-template>
		<xsl:call-template name="pad-left">
			<xsl:with-param name="str" select="mileage/text()"/>
			<xsl:with-param name="len" select="8"/>
		</xsl:call-template>
	</xsl:template>

	<xsl:template name="pad-left">
		<xsl:param name="str"/>
		<xsl:param name="len"/>
		<xsl:choose>
			<xsl:when test="string-length($str) &gt; $len">
				<xsl:value-of select="substring($str, 1, $len)"/>
			</xsl:when>
			<xsl:when test="string-length($str) &lt; $len">
				<xsl:call-template name="pad-left">
					<xsl:with-param name="str" select="concat(' ', $str)"/>
					<xsl:with-param name="len" select="$len"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$str"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="pad-right">
		<xsl:param name="str"/>
		<xsl:param name="len"/>
		<xsl:choose>
			<xsl:when test="string-length($str) &gt; $len">
				<xsl:value-of select="substring($str, 1, $len)"/>
			</xsl:when>
			<xsl:when test="string-length($str) &lt; $len">
				<xsl:call-template name="pad-right">
					<xsl:with-param name="str" select="concat($str, ' ')"/>
					<xsl:with-param name="len" select="$len"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$str"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
</xsl:stylesheet><!-- Stylus Studio meta-information - (c) 2004-2005. Progress Software Corporation. All rights reserved.
<metaInformation>
<scenarios ><scenario default="yes" name="Scenario1" userelativepaths="yes" externalpreview="no" url="adapter:CSV:newline=crlf:sep=,:first=yes:escape=\:quotes='&quot;?file:///c:/demo/bikes.csv" htmlbaseurl="" outputurl="bikes.txt" processortype="internal" profilemode="0" profiledepth="" profilelength="" urlprofilexml="" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/></scenarios><MapperMetaTag><MapperInfo srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/><MapperBlockPosition></MapperBlockPosition></MapperMetaTag>
</metaInformation>
-->