<?xml version='1.0' encoding='utf-8'?>
<xsl:stylesheet version="1.0" 
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:b64="net.sf.saxon.value.Base64BinaryValue"
	xmlns:fos="java.io.FileOutputStream"
	exclude-result-prefixes="b64 fos">
<xsl:output method="html"/>

<xsl:template match="/">
	<html><head></head>
		<body>
			<table width="100%" border="1">
				<tbody>
					<xsl:for-each select="root/row">
						<tr><td><b>Employee</b></td><td><b>Picture</b></td></tr>
						<tr>
							<td width="33%">
								<xsl:value-of select="LastName"/>
							</td>
							<td width="33%">
								<xsl:variable name="img" select="concat('c:\temp\', LastName, '.jpg')"/>
								<xsl:variable name="fos" select="fos:new(string($img))"/>
								<xsl:variable name="b64" select="b64:new(string(Photo))"/>
								<xsl:value-of select="fos:write($fos, b64:getBinaryValue($b64))"/>	
								<xsl:value-of select="fos:close($fos)"/>
								<img src="{$img}"/>
							</td>
						</tr>
					</xsl:for-each>
				</tbody>
			</table>
		</body>
	</html>
</xsl:template>

</xsl:stylesheet><!-- Stylus Studio meta-information - (c) 2004-2005. Progress Software Corporation. All rights reserved.
<metaInformation>
<scenarios ><scenario default="yes" name="EmployeeWithPicture.rdbxml" userelativepaths="yes" externalpreview="no" url="EmployeeWithPicture.xml" htmlbaseurl="" outputurl="" processortype="saxon8" useresolver="yes" profilemode="0" profiledepth="" profilelength="" urlprofilexml="" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext="" validateoutput="no" validator="internal" customvalidator="" ><advancedProp name="sInitialMode" value=""/><advancedProp name="bXsltOneIsOkay" value="true"/><advancedProp name="bSchemaAware" value="true"/><advancedProp name="bXml11" value="false"/><advancedProp name="iValidation" value="0"/><advancedProp name="bExtensions" value="true"/><advancedProp name="iWhitespace" value="0"/><advancedProp name="sInitialTemplate" value=""/><advancedProp name="bTinyTree" value="true"/><advancedProp name="bWarnings" value="true"/><advancedProp name="bUseDTD" value="true"/></scenario></scenarios><MapperMetaTag><MapperInfo srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no" ><SourceSchema srcSchemaPath="EmployeeWithPicture.xml" srcSchemaRoot="root" AssociatedInstance="" loaderFunction="document" loaderFunctionUsesURI="no"/></MapperInfo><MapperBlockPosition><template match="/"><block path="html/body/table/tbody/xsl:for&#x2D;each" x="350" y="144"/><block path="html/body/table/tbody/xsl:for&#x2D;each/tr/td[2]/xsl:value&#x2D;of" x="350" y="234"/><block path="html/body/table/tbody/xsl:for&#x2D;each/tr/td[2]/xsl:value&#x2D;of[1]" x="390" y="234"/></template></MapperBlockPosition><TemplateContext></TemplateContext><MapperFilter side="source"></MapperFilter></MapperMetaTag>
</metaInformation>
-->