AutoCapture Default XSLT Style Sheet (AC.xslt)

The default style sheet AC.xslt is located in the AutoStore installation directory and contains templates that match XML element names for field types (ACBoolean, ACButton, ACDateTime, ACLabel, ACNumber, ACString, ACList, ACStringMultiline).

<?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" encoding="utf-8" indent="yes" />
		<xsl:template match="/">
						
		<xsl:param name="stringNoSpaces" >
			<xsl:call-template name="stringreplace">
				<xsl:with-param name="stringvalue" select="@Field-XPath" />
				<xsl:with-param name="from" select="string(' ')" />
			</xsl:call-template>
		</xsl:param>
			
		<xsl:text disable-output-escaping='yes'><!DOCTYPE html></xsl:text>	
		<xsl:text disable-output-escaping='yes'>
		
			<!-- saved from url=(0016)http://localhost -->
			
		</xsl:text>
		<xsl:text disable-output-escaping='yes'>
			<!--
		</xsl:text>
		<xsl:copy-of select="*"/>
		<xsl:text disable-output-escaping='yes'>
			-->
		</xsl:text>

		<html>
			<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
			<head>
				<title>AutoCapture</title>
				<xsl:text disable-output-escaping='yes'><meta http-equiv="X-UA-Compatible" content="IE=Edge" ></xsl:text>
				<xsl:text disable-output-escaping='yes'><meta http-equiv="MSThemeCompatible" content="NO"></xsl:text>
				<link rel="stylesheet" href="AC.css" type="text/css"/>
				<script type="text/javascript" src="AC.js"/>
				<script type="text/javascript">
					var nsi_FORMTAGS = {};
					<xsl:for-each select="ACForm">
					nsi_FORMTAGS["<xsl:value-of select="@Title"/>"] = "<xsl:value-of select="@Tags"/>";
					</xsl:for-each>

					$(document).ready(function(){						
						nsi.autocapture.theme.applyFromTagArray(nsi_FORMTAGS);
						var ac = nsi.autocapture.getInstance();
					});
				</script>
			</head>
			<body>
				<div class="ACBody">
					<div class="header">
						<div class="OEMLogo"></div>
						<div class="title">
							<xsl:text>Send To</xsl:text>
						</div>
					</div>
					<form id="ACForm" method="POST" action="--WEBBOT-SELF--">
						<xsl:for-each select="ACForm">
							<div class="ACForm">
								<xsl:attribute name="id">ACForm_<xsl:value-of select="@Title"/></xsl:attribute>
								
								<xsl:if test="@Smallimage">
									<div class="icon">
										<image width="32" height="32" border="0">
											<xsl:attribute name="src">
												<xsl:text>data:image/png;base64,</xsl:text>
												<xsl:value-of select="@Smallimage"/>
											</xsl:attribute>
										</image>
									</div>
								</xsl:if>
								<div class="name"><xsl:value-of select="@Title"/></div>
								<div class="form">
									<xsl:apply-templates select="ACString | ACStringMultiline | ACList  | ACBoolean | ACDateTime | ACNumber | ACLabel | ACButton"/>
								</div>
								<div class="clear" style="height:20px;"></div>
							</div>
						</xsl:for-each>
					</form>
					<div class="push"></div>
				</div>
				<div class="footer">
					<div class="AutoStoreLogo"></div>
				</div>
			</body>
		</html>
	</xsl:template>
	
	<xsl:template match="ACString">
		<div class="ACInputField ACString">
			<div class="ACLabel">
				<xsl:choose>
					<xsl:when test="@Required = 'true'">
						<xsl:attribute name="class"><xsl:text>ACLabel ACRequired</xsl:text></xsl:attribute>
						<div class="Icon"><xsl:text>*</xsl:text></div>
						<div class="Title"><xsl:value-of select="@Title"/></div>
					</xsl:when>
					<xsl:otherwise>
						<div class="Title"><xsl:value-of select="@Title"/></div>
					</xsl:otherwise>
				</xsl:choose>
			</div>
			
			<div class="ACInput">
				<xsl:if test="@HelpMsg">
					<xsl:attribute name="title"><xsl:value-of select="@HelpMsg"/></xsl:attribute>
				</xsl:if>
				<input type="text">
					
					<xsl:attribute name="id">
						<xsl:call-template name="stringreplace">
							<xsl:with-param name="stringvalue" select="@Title" />
							<xsl:with-param name="from" select="string(' ')" />
						</xsl:call-template>					
					</xsl:attribute>
					
					<xsl:attribute name="name"><xsl:value-of select="@Title"/></xsl:attribute>
					<xsl:attribute name="size"><xsl:value-of select="@Size"/></xsl:attribute>
					<xsl:attribute name="maxlength"><xsl:value-of select="@MaxLength"/></xsl:attribute>
					<xsl:attribute name="value"><xsl:value-of select="."/></xsl:attribute>
					<xsl:if test="@Required = 'true'">
						<xsl:attribute name="class"><xsl:text>required</xsl:text></xsl:attribute>
					</xsl:if>
				</input>

			</div>
			<div class="clear"></div>
		</div>
	</xsl:template>
	
	<xsl:template match="ACButton">
		<div class="ACInputField ACButton">
			<button class="ACButton" type="button">
				<xsl:attribute name="id">
					<xsl:call-template name="stringreplace">
						<xsl:with-param name="stringvalue" select="@Title" />
						<xsl:with-param name="from" select="string(' ')" />
					</xsl:call-template>					
				</xsl:attribute>
				<xsl:attribute name="name"><xsl:value-of select="@Title"/></xsl:attribute>
				<xsl:attribute name="value"><xsl:value-of select="@Title"/></xsl:attribute>
				<span><xsl:value-of select="@Title"/></span>
			</button>
		</div>
	</xsl:template>
	
	<xsl:template match="ACLabel">
		<div class="ACLabelField ACLabel">
			<div class="ACLabel">
				<xsl:attribute name="id">
					<xsl:call-template name="stringreplace">
						<xsl:with-param name="stringvalue" select="@Title" />
						<xsl:with-param name="from" select="string(' ')" />
					</xsl:call-template>					
				</xsl:attribute>
				<div class="Title">
					<xsl:attribute name="style">
				                <xsl:text>font-size:</xsl:text>
				     		<xsl:value-of select="@FontSize"/>			
	         			</xsl:attribute>
				<xsl:value-of select="@Text"/>
				</div>
			</div>
			<div class="clear"></div>
		</div>
	</xsl:template>
	
	<xsl:template match="ACNumber">
		<div class="ACInputField ACNumber">
			<div class="ACLabel">
				<xsl:choose>
					<xsl:when test="@Required = 'true'">
						<xsl:attribute name="class"><xsl:text>ACLabel ACRequired</xsl:text></xsl:attribute>
						<div class="Icon"><xsl:text>*</xsl:text></div>
						<div class="Title"><xsl:value-of select="@Title"/></div>
					</xsl:when>
					<xsl:otherwise>
						<div class="Title"><xsl:value-of select="@Title"/></div>
					</xsl:otherwise>
				</xsl:choose>
			</div>
			
			<div class="ACInput">
				<xsl:if test="@HelpMsg">
					<xsl:attribute name="title"><xsl:value-of select="@HelpMsg"/></xsl:attribute>
				</xsl:if>
				<input type="text" class="number">
					<xsl:attribute name="id">
						<xsl:call-template name="stringreplace">
							<xsl:with-param name="stringvalue" select="@Title" />
							<xsl:with-param name="from" select="string(' ')" />
						</xsl:call-template>					
					</xsl:attribute>
					<xsl:attribute name="name"><xsl:value-of select="@Title"/></xsl:attribute>
					<xsl:attribute name="min"><xsl:value-of select="@Min"/></xsl:attribute>
					<xsl:attribute name="max"><xsl:value-of select="@Max"/></xsl:attribute>          
					<xsl:attribute name="value"><xsl:value-of select="."/></xsl:attribute>
					<xsl:if test="@Required = 'true'">
						<xsl:attribute name="class"><xsl:text>number required</xsl:text></xsl:attribute>
					</xsl:if>
				</input>

			</div>
			<div class="clear"></div>
		</div>
	</xsl:template>
	
	<xsl:template match="ACStringMultiline">
		<div class="ACInputField ACStringMultiline">
			<div class="ACLabel">
				<xsl:choose>
					<xsl:when test="@Required = 'true'">
						<xsl:attribute name="class"><xsl:text>ACLabel ACRequired</xsl:text></xsl:attribute>
						<div class="Icon"><xsl:text>*</xsl:text></div>
						<div class="Title"><xsl:value-of select="@Title"/></div>
					</xsl:when>
					<xsl:otherwise>
						<div class="Title"><xsl:value-of select="@Title"/></div>
					</xsl:otherwise>
				</xsl:choose>
			</div>
		
			<div class="ACInput">
				<textarea>
					<xsl:attribute name="id">
						<xsl:call-template name="stringreplace">
							<xsl:with-param name="stringvalue" select="@Title" />
							<xsl:with-param name="from" select="string(' ')" />
						</xsl:call-template>					
					</xsl:attribute>
					<xsl:attribute name="name">
						<xsl:value-of select="@Title"/>
					</xsl:attribute>
					<xsl:if test="@HelpMsg">
						<xsl:attribute name="title"><xsl:value-of select="@HelpMsg"/></xsl:attribute>
					</xsl:if>
					<xsl:if test="@Width">
						<xsl:attribute name="cols">
							<xsl:value-of select="@Width"/>
						</xsl:attribute>
					</xsl:if>
					<xsl:if test="@Height">
						<xsl:attribute name="rows">
							<xsl:value-of select="@Height"/>
						</xsl:attribute>
					</xsl:if>
					<xsl:if test="@Required = 'true'">
						<xsl:attribute name="class"><xsl:text>required</xsl:text></xsl:attribute>
					</xsl:if>
					<xsl:value-of select="."/>
				</textarea>
			</div>
			<div class="clear"></div>
		</div>
	</xsl:template>
	
	<xsl:template match="ACList">
		<div class="ACInputField ACList">
			<div class="ACLabel">
				<xsl:choose>
					<xsl:when test="@Required = 'true'">
						<xsl:attribute name="class"><xsl:text>ACLabel ACRequired</xsl:text></xsl:attribute>
						<div class="Icon"><xsl:text>*</xsl:text></div>
						<div class="Title"><xsl:value-of select="@Title"/></div>
					</xsl:when>
					<xsl:otherwise>
						<div class="Title"><xsl:value-of select="@Title"/></div>
					</xsl:otherwise>
				</xsl:choose>
			</div>
		
			<div class="ACInput">
				<select>
					<xsl:attribute name="id">
						<xsl:call-template name="stringreplace">
							<xsl:with-param name="stringvalue" select="@Title" />
							<xsl:with-param name="from" select="string(' ')" />
						</xsl:call-template>					
					</xsl:attribute>
					<xsl:attribute name="name"><xsl:value-of select="@Title"/></xsl:attribute>
					<xsl:if test="@HelpMsg">
						<xsl:attribute name="title"><xsl:value-of select="@HelpMsg"/></xsl:attribute>
					</xsl:if>
					<xsl:for-each select="ACOption">
						<xsl:element name="option">
							<xsl:attribute name="value"><xsl:value-of select="."/></xsl:attribute>
							<xsl:if test="boolean(@Selected)">
								<xsl:attribute name="selected">on</xsl:attribute>
							</xsl:if>
							<xsl:value-of select="@Label"/>
						</xsl:element>
					</xsl:for-each>
					<xsl:if test="@Required = 'true'">
						<xsl:attribute name="class"><xsl:text>required</xsl:text></xsl:attribute>
					</xsl:if>
				</select>
			</div>
			<div class="clear"></div>
		</div>
	</xsl:template>
	
	<xsl:template match="ACBoolean">
		<div class="ACInputField ACBoolean">
			<div class="ACLabel">
				<xsl:choose>
					<xsl:when test="@Required = 'true'">
						<xsl:attribute name="class"><xsl:text>ACLabel ACRequired</xsl:text></xsl:attribute>
						<div class="Icon"><xsl:text>*</xsl:text></div>
						<div class="Title"><xsl:value-of select="@Title"/></div>
					</xsl:when>
					<xsl:otherwise>
						<div class="Title"><xsl:value-of select="@Title"/></div>
					</xsl:otherwise>
				</xsl:choose>
			</div>
		
			<div class="ACInput">
				<input type="radio">
					<xsl:attribute name="name">
						<xsl:value-of select="@Title"/>
					</xsl:attribute>
					<xsl:attribute name="id">
						<xsl:call-template name="stringreplace">
							<xsl:with-param name="stringvalue" select="@Title" />
							<xsl:with-param name="from" select="string(' ')" />
						</xsl:call-template>					
					</xsl:attribute>
					<xsl:if test="@HelpMsg">
						<xsl:attribute name="title"><xsl:value-of select="@HelpMsg"/></xsl:attribute>
					</xsl:if>
					<xsl:attribute name="value">
						<xsl:value-of select="@TrueValue"/>
					</xsl:attribute>										
					
					<xsl:if test="@Value = 'true'">
						<xsl:attribute name="checked">on</xsl:attribute>
					</xsl:if>
					<xsl:if test="@Required = 'true'">
						<!--<xsl:attribute name="class"><xsl:text>required</xsl:text></xsl:attribute>-->
					</xsl:if>
				</input>
				
				<label class="ACInputValue">
					<xsl:attribute name="for">
						<xsl:text>cb_</xsl:text>
						<xsl:value-of select="@Title"/>
					</xsl:attribute>
					<xsl:value-of select="@TrueValue"/>
				</label>
				<input type="radio">
					<xsl:attribute name="name">
						<xsl:value-of select="@Title"/>
					</xsl:attribute>
					<xsl:attribute name="id">
						<xsl:call-template name="stringreplace">
							<xsl:with-param name="stringvalue" select="@Title" />
							<xsl:with-param name="from" select="string(' ')" />
						</xsl:call-template>					
					</xsl:attribute>
					<xsl:if test="@HelpMsg">
						<xsl:attribute name="title"><xsl:value-of select="@HelpMsg"/></xsl:attribute>
					</xsl:if>
					<xsl:attribute name="value">
						<xsl:value-of select="@FalseValue"/>
					</xsl:attribute>										
					
					<xsl:if test="@Value = 'false'">
						<xsl:attribute name="checked">on</xsl:attribute>
					</xsl:if>
					<xsl:if test="@Required = 'true'">
						<!--<xsl:attribute name="class"><xsl:text>required</xsl:text></xsl:attribute>-->
					</xsl:if>
				</input>
				
				<label class="ACInputValue">
					<xsl:attribute name="for">
						<xsl:text>cb_</xsl:text>
						<xsl:value-of select="@Title"/>
					</xsl:attribute>
					<xsl:value-of select="@FalseValue"/>
				</label>
				
			</div>
			<div class="clear"></div>
		</div>
	</xsl:template>
	
	<xsl:template match="ACDateTime">
		<div class="ACInputField ACDateTime">
			<div class="ACLabel">
				<xsl:choose>
					<xsl:when test="@Required = 'true'">
						<xsl:attribute name="class"><xsl:text>ACLabel ACRequired</xsl:text></xsl:attribute>
						<div class="Icon"><xsl:text>*</xsl:text></div>
						<div class="Title"><xsl:value-of select="@Title"/></div>
					</xsl:when>
					<xsl:otherwise>
						<div class="Title"><xsl:value-of select="@Title"/></div>
					</xsl:otherwise>
				</xsl:choose>
			</div>
		
			<div class="ACInput">
				<input type="text" class="date">
					<xsl:if test="@HelpMsg">
						<xsl:attribute name="title"><xsl:value-of select="@HelpMsg"/></xsl:attribute>
					</xsl:if>
					<xsl:attribute name="rel"><xsl:text>datepicker</xsl:text></xsl:attribute>
					<xsl:attribute name="id">
						<xsl:call-template name="stringreplace">
							<xsl:with-param name="stringvalue" select="@Title" />
							<xsl:with-param name="from" select="string(' ')" />
						</xsl:call-template>					
					</xsl:attribute>
					<xsl:attribute name="name"><xsl:value-of select="@Title"/></xsl:attribute>
					<xsl:attribute name="size"><xsl:value-of select="@Size"/></xsl:attribute>
					<xsl:attribute name="value"><xsl:value-of select="."/></xsl:attribute>
					<xsl:if test="@Required = 'true'">
						<xsl:attribute name="class"><xsl:text>date required</xsl:text></xsl:attribute>
					</xsl:if>
				</input>
			</div>
			<div class="clear"></div>
		</div>
	</xsl:template>
	
	<xsl:template name="stringreplace">
		<xsl:param name="stringvalue" />
		<xsl:param name="from" />

		<xsl:choose>
			<xsl:when test="contains($stringvalue, $from)"><xsl:value-of select="substring-before($stringvalue, $from)" />
				<xsl:if test="contains(substring($stringvalue, 1, string-length($stringvalue) - 1), $from)">
					<xsl:call-template name="stringreplace">
						<xsl:with-param name="stringvalue" select="substring-after($stringvalue, $from)" />
						<xsl:with-param name="from" select="$from" />
					</xsl:call-template>
				</xsl:if>
			</xsl:when>
			<xsl:otherwise><xsl:value-of select="$stringvalue" /></xsl:otherwise>
		</xsl:choose>
	</xsl:template>
</xsl:stylesheet>