<?xml version="1.0"?>
<!-- tested with build-in processor in XMLSpy 2007 and with Saxon8b in Oxygen -->
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="text"/>
	<xsl:template match="/">
		<xsl:for-each select="products/product">
			<!--variables extra spaces-->
			<xsl:variable name="idSpace" select="for $a in 1 to (3 - string-length(name)) return ' '"/>
			<xsl:variable name="nameSpace" select="for $a in 1 to (8 - string-length(name)) return ' '"/>
			<xsl:variable name="priceSpace" select="for $a in 1 to (10 - string-length(price)) return ' '"/>
			<xsl:variable name="stockSpace" select="for $a in 1 to (3 - string-length(stock)) return ' '"/>
			<xsl:variable name="countrySpace" select="for $a in 1 to (10 - string-length(country)) return ' '"/>
			<!--fixed output begins here-->
			<xsl:value-of select="concat(string-join($idSpace, ''), @id)"/>
			<xsl:value-of select="concat(string-join($nameSpace, ''), name)"/>
			<xsl:value-of select="concat(string-join($priceSpace, ''), price)"/>
			<xsl:value-of select="concat(string-join($stockSpace, ''), stock)"/>
			<xsl:value-of select="concat(string-join($countrySpace, ''), country)"/>
			<xsl:text>&#xA;</xsl:text>
		</xsl:for-each>
	</xsl:template>
</xsl:stylesheet>