<?xml version="1.0"?>
<xsl:stylesheet version="2.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
				xmlns:fn="http://www.w3.org/2005/xpath-functions"
				xmlns:xs="http://www.w3.org/2001/XMLSchema"
                xmlns:xlsx="http://www.stylusstudio.com/XSLT/XLSX"
				xmlns:spml="http://schemas.openxmlformats.org/spreadsheetml/2006/main"
				xmlns:saxon="http://saxon.sf.net/">
	
	
	<xsl:function name="xlsx:cell">
		<xsl:param name="excelURL"/>
		<xsl:param name="sheetNumber"/>
		<xsl:param name="row"/>
		<xsl:param name="col"/>

		<xsl:variable name="jarURL" select="concat('jar:file:///', replace($excelURL, '\\', '/'), '!')"/>
		<xsl:variable name="sheetURL" select="concat($jarURL, '/xl/worksheets/sheet', $sheetNumber,'.xml')"/>
		<xsl:variable name="sharedStringsURL" select="concat($jarURL, '/xl/sharedStrings.xml')"/>
		<xsl:variable name="sheet" select="doc($sheetURL)"/>
		<xsl:variable name="sharedStrings" select="doc($sharedStringsURL)"/>
		<xsl:variable name="cell" select="$sheet/spml:worksheet/spml:sheetData/spml:row[$row]/spml:c[$col]"/>
		<xsl:choose >
      		<xsl:when test="$cell/@t = 's'">
				<xsl:variable name="ref" select="xs:integer($cell/spml:v)"/>
				<xsl:value-of select="$sharedStrings/spml:sst/spml:si[$ref+1]/spml:t"/>		
			</xsl:when>
      		<xsl:otherwise>
				<xsl:value-of select="$cell/spml:v"/>		
			</xsl:otherwise>
  		</xsl:choose>
	</xsl:function>

	<xsl:function name="xlsx:close">
		<xsl:param name="excelURL"/>
		<xsl:param name="sheetNumber"/>
		<xsl:variable name="jarURL" select="concat('jar:file:///', replace($excelURL, '\\', '/'), '!')"/>
		<xsl:variable name="sheetURL" select="concat($jarURL, '/xl/worksheets/sheet', $sheetNumber,'.xml')"/>
		<xsl:variable name="sharedStringsURL" select="concat($jarURL, '/xl/sharedStrings.xml')"/>
		<xsl:variable name="sheet" select="doc($sheetURL)"/>
		<xsl:variable name="sharedStrings" select="doc($sharedStringsURL)"/>
		<xsl:value-of select="saxon:discard-document($sheet)"/>
		<xsl:value-of select="saxon:discard-document($sharedStrings)"/>
	</xsl:function>
			

</xsl:stylesheet><!-- Stylus Studio meta-information - (c) 2004-2009. Progress Software Corporation. All rights reserved.

<metaInformation>
	<scenarios/>
	<MapperMetaTag>
		<MapperInfo srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/>
		<MapperBlockPosition></MapperBlockPosition>
		<TemplateContext></TemplateContext>
		<MapperFilter side="source"></MapperFilter>
	</MapperMetaTag>
</metaInformation>
-->