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

	<xsl:output method="html" indent="yes" encoding="utf-8"/>

	<xsl:variable name="skinPath"><xsl:value-of select="/SITEBUILDER-PAGE/PROPERTIES/SKIN-PATH" disable-output-escaping="yes"/></xsl:variable>

	<xsl:template match="/">
		<xsl:apply-templates select="SITEBUILDER-PAGE/JS-LOCALE"/>
		<xsl:apply-templates select="SITEBUILDER-PAGE/ERROR"/>
		<xsl:apply-templates select="SITEBUILDER-PAGE/VIEW-CONTENT"/>
	</xsl:template>

	<xsl:template match="SITEBUILDER-PAGE/ERROR">
		<table border="0" cellpadding="5" cellspacing="0" class="sb-statusbar-admin-error sb-statusbar-admin" style="margin: 0;">
			<tr>
				<td>
					<table border="0" cellpadding="0" cellspacing="0">
						<tr valign="top">
							<td style="text-valign:middle; padding-left: 5px;">
								<img src="{$skinPath}/icons/error.png" style="border-width:0px;" alt="{/SITEBUILDER-PAGE/LOCALE/ERROR}">
								</img>
							</td>
							<td id="fotoliaPurchaseErrorTextContainer" width="100%" class="sb-statusbar-admin-text" style="padding-left: 5px;">
								<xsl:value-of select="."/>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	</xsl:template>

	<xsl:template match="JS-LOCALE">
		<script src='/js/locale.js?{$version}.{$build}' type='text/javascript'></script>
		<script type="text/javascript" language="javascript">
			<xsl:for-each select="*">
				SbAppendLocaleKey('<xsl:value-of select="name()"/>', '<xsl:value-of select="."/>');
			</xsl:for-each>
		</script>
	</xsl:template>
	
	<xsl:template name="nl2br">
		<xsl:param name="string"/>
		<xsl:value-of select="normalize-space(substring-before($string,'&#10;'))" />
		<xsl:choose>
			<xsl:when test="contains($string,'&#10;')">
				<br />
				<xsl:call-template name="nl2br">
					<xsl:with-param name="string" select="substring-after($string,'&#10;')"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:copy-of select="$string"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	
</xsl:stylesheet>
