<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  version="1.0">
	<xsl:output method="xml" version="1.0" encoding="UTF-8" omit-xml-declaration="no" indent="no" media-type="text/html"/>
	<!-- - - - - - - - - - - - - - - - -+- - - - - - - - - - - - - - - - - -->
	<!--                              root                                 -->
	<!-- - - - - - - - - - - - - - - - -+- - - - - - - - - - - - - - - - - -->
	<!--   This template controls formatting of the Court Filing 1.1 xml by matching the
       document root.  The second tier of formatting is controlled by the
       /legalEnvelope template.
-->
	<xsl:template match="/">
		<HTML>
			<HEAD>
				<TITLE>
					<xsl:text>Court Filing for Charging Documents</xsl:text>
				</TITLE>
			</HEAD>
			<BODY BGCOLOR="#B0C4DE">
				<xsl:apply-templates select="/legalEnvelope"/>
			</BODY>
		</HTML>
	</xsl:template>
	<!-- - - - - - - - - - - - - - - - -+- - - - - - - - - - - - - - - - - -->
	<!--                        format-personName                         -->
	<!-- - - - - - - - - - - - - - - - -+- - - - - - - - - - - - - - - - - -->
	<!--   This template controls formatting of personName.-->
	
	<xsl:template name="format-personName">
		<xsl:param name="personName" select="."/>
		<xsl:if test="$personName/namePrefix!=''">
			<xsl:value-of select="$personName/namePrefix"/>
			<xsl:text> </xsl:text>
		</xsl:if>
		<xsl:if test="$personName/firstName!=''">
			<xsl:value-of select="$personName/firstName"/>
			<xsl:text> </xsl:text>
		</xsl:if>
		<xsl:if test="$personName/middleName!=''">
			<xsl:value-of select="$personName/middleName"/>
			<xsl:text> </xsl:text>
		</xsl:if>
		<xsl:if test="$personName/lastName!=''">
			<xsl:value-of select="$personName/lastName"/>
			<xsl:text> </xsl:text>
		</xsl:if>
		<xsl:if test="$personName/nameSuffix!=''">
			<xsl:value-of select="$personName/nameSuffix"/>
			<xsl:text> </xsl:text>
		</xsl:if>
		<xsl:if test="$personName/fullName!=''">
			<xsl:value-of select="$personName/fullName"/>
			<xsl:text> </xsl:text>
		</xsl:if>

	</xsl:template>
	<!-- - - - - - - - - - - - - - - - -+- - - - - - - - - - - - - - - - - -->
	<!--                        format-verticalDisplay                    -->
	<!-- - - - - - - - - - - - - - - - -+- - - - - - - - - - - - - - - - - -->
	<!--   This template provides vertical display formatting .-->
	
	<xsl:template name="format-verticalDisplay">
		<xsl:param name="verticalDisplay" select="."/>
		<xsl:for-each select="./*">
			<i><xsl:value-of select="local-name(.)"/>
			<xsl:text>: </xsl:text></i>
			<xsl:value-of select="."/>
			<BR/>
		</xsl:for-each>	
	

	</xsl:template>

	<!-- - - - - - - - - - - - - - - - -+- - - - - - - - - - - - - - - - - -->
	<!--                        format-telephone                            -->
	<!-- - - - - - - - - - - - - - - - -+- - - - - - - - - - - - - - - - - -->
	<!--   This template controls formatting of telephone numbers.-->
	
	<xsl:template name="format-telephone">
		<xsl:param name="telephone" select="."/>
		
		<xsl:if test="$telephone/telephonePrefix/telephoneCountryCode!=''">
			<xsl:text>(</xsl:text>
			<xsl:value-of select="$telephone/telephonePrefix/telephoneCountryCode"/>
			<xsl:text>) </xsl:text>
		</xsl:if>
		<xsl:if test="$telephone/telephonePrefix/telephoneCityCode!=''">
			<xsl:text>(</xsl:text>
			<xsl:value-of select="$telephone/telephonePrefix/telephoneCityCode"/>
			<xsl:text>) </xsl:text>
		</xsl:if>
		<xsl:if test="$telephone/telephonePrefix/areaCode!=''">
			<xsl:text>(</xsl:text>
			<xsl:value-of select="$telephone/telephonePrefix/areaCode"/>
			<xsl:text>) </xsl:text>
		</xsl:if>

		<xsl:if test="$telephone/telephoneNumber!=''">
			<xsl:value-of select="$telephone/telephoneNumber"/>
			<xsl:text> </xsl:text>
		</xsl:if>
		<xsl:if test="$telephone/telephoneSuffix!=''">
			<xsl:text>ext.  </xsl:text>
			<xsl:value-of select="$telephone/telephoneSuffix"/>
		</xsl:if>	
	</xsl:template>

	<!-- - - - - - - - - - - - - - - - -+- - - - - - - - - - - - - - - - - -->
	<!--                           format-date                             -->
	<!-- - - - - - - - - - - - - - - - -+- - - - - - - - - - - - - - - - - -->
	<!--   The following template does all standard formatting of dates in
       the stylesheet.  The optional parameter date can be used to 
       select which date field to format but the default is to format 
       the field named date with the current element as parent.
-->
	<xsl:template name="format-date">
		<xsl:param name="date" select="."/>
		<xsl:choose>
			<xsl:when test="$date!=''">
				<xsl:value-of select="substring($date,7,2)"/>
				<xsl:text>-</xsl:text>
				<xsl:value-of select="substring-before(substring-after('01Jan 02Feb 03Mar 04Apr 05May 06Jun 07Jul 08Aug 09Sep 10Oct 11Nov 12Dec ',substring($date,5,2)),' ')"/>
				<xsl:text>-</xsl:text>
				<xsl:value-of select="substring($date,1,4)"/>
			</xsl:when>
			<xsl:otherwise>No Date Given</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<!-- - - - - - - - - - - - - - - - -+- - - - - - - - - - - - - - - - - -->
	<!--                           courtFiling                             -->
	<!-- - - - - - - - - - - - - - - - -+- - - - - - - - - - - - - - - - - -->
	<!--   This template controls second tier formatting of the courtFiling xml
       by generating the top level headings and then calling next tier
       templates to format those sections.
-->
	<xsl:template match="/legalEnvelope">
		<CENTER>
			<H1>
				<FONT COLOR="000080">Court Filing Version 1.1 (2/18/2002)</FONT>
			</H1>
		</CENTER>
		<BR/>
		<BR/>
		<H2>
			<A NAME="legalEnvelope">legalEnvelope Section</A>
		</H2>
		<xsl:apply-templates select="messageIdentification"/>
		<BR/>
		<H2>
			<A NAME="filingActorStart">Begin filing Actor Section</A>
		</H2>
			<xsl:apply-templates select="legal/courtFiling/filing/actor"/>
		<BR/>
		<BR/>
		<H2>
			<A NAME="filingActorEnd">End filing Actor Section</A>
		</H2>
		<BR/>
		<BR/>
		<H2>
			<A NAME="filingInformationStart">Begin filing FilingInformation Section</A>
		</H2>
			<xsl:apply-templates select="legal/courtFiling/filing/filingInformation"/>
		<BR/>
		<BR/>
		<H2>
			<A NAME="filingInformationEnd">End filing FilingInformation Section</A>
		</H2>
		<BR/>
		<BR/>
		<H2>
			<A NAME="leadDocumentStart">Begin filing LeadDocument Section</A>
		</H2>
			<xsl:apply-templates select="legal/courtFiling/filing/leadDocument"/>
		<BR/>
		<BR/>
		
		<xsl:choose>
			<xsl:when test="//leadDocument/documentInformation!=''">
				<xsl:for-each select="//leadDocument/documentInformation/*">
					
					<xsl:if test="local-name(.)='administrativeLaw'">
						<xsl:value-of select="local-name(.)"/>
					</xsl:if>
					<xsl:if test="local-name(.)='appeals'">
						<xsl:value-of select="local-name(.)"/>
					</xsl:if>
					<xsl:if test="local-name(.)='bankrupcy'">
						<xsl:value-of select="local-name(.)"/>
					</xsl:if>
					<xsl:if test="local-name(.)='civil'">
						<xsl:value-of select="local-name(.)"/>
					</xsl:if>
					<xsl:if test="local-name(.)='criminal'">
						<h3>
						<xsl:value-of select="local-name(.)"/>
						<xsl:text> Case</xsl:text>
						</h3>
					 </xsl:if>
					<xsl:if test="local-name(.)='domesticRelations'">
						<xsl:value-of select="local-name(.)"/>
					</xsl:if>
					<xsl:if test="local-name(.)='juvenile'">
						<xsl:value-of select="local-name(.)"/>
					</xsl:if>
					<xsl:if test="local-name(.)='probate'">
						<xsl:value-of select="local-name(.)"/>
					</xsl:if>
					<xsl:if test="local-name(.)='smallClaims'">
						<xsl:value-of select="local-name(.)"/>
					</xsl:if>
					<xsl:if test="local-name(.)='traffic'">
						<xsl:value-of select="local-name(.)"/>
					</xsl:if>
				
				</xsl:for-each>
			</xsl:when>
		</xsl:choose>
		
		<xsl:apply-templates select="legal/courtFiling/filing/leadDocument/documentInformation/administrativeLaw"/>
		<xsl:apply-templates select="legal/courtFiling/filing/leadDocument/documentInformation/appeals"/>
		<xsl:apply-templates select="legal/courtFiling/filing/leadDocument/documentInformation/bankrupcy"/>
		<xsl:apply-templates select="legal/courtFiling/filing/leadDocument/documentInformation/civil"/>
		<xsl:apply-templates select="legal/courtFiling/filing/leadDocument/documentInformation/criminal/filingCharges/charge"/>
		<xsl:apply-templates select="legal/courtFiling/filing/leadDocument/documentInformation/domesticRelations"/>
		<xsl:apply-templates select="legal/courtFiling/filing/leadDocument/documentInformation/juvenile"/>
		<xsl:apply-templates select="legal/courtFiling/filing/leadDocument/documentInformation/probate"/>
		<xsl:apply-templates select="legal/courtFiling/filing/leadDocument/documentInformation/smallClaims"/>
		<xsl:apply-templates select="legal/courtFiling/filing/leadDocument/documentInformation/traffic"/>

		<H2>
			<A NAME="leadDocumentEnd">End filing LeadDocument Section</A>
		</H2>
		<BR/>
		<BR/>

	</xsl:template>
	<!-- - - - - - - - - - - - - - - - -+- - - - - - - - - - - - - - - - - -->
	<!--                          navigation-bar                           -->
	<!-- - - - - - - - - - - - - - - - -+- - - - - - - - - - - - - - - - - -->
	<!--   This template controls formatting of a navigation bar of hyperlinks
       to the various sections.  This allows easy switching from one part
       to another.
       This version is actually not working and the real navigation bar is
       generated in the following template.
-->
<!--	<xsl:template name="navigation-bar"/>
-->	<!-- - - - - - - - - - - - - - - - -+- - - - - - - - - - - - - - - - - -->
	<!--                          navigation-bar                           -->
	<!-- - - - - - - - - - - - - - - - -+- - - - - - - - - - - - - - - - - -->
	<!--   This template controls formatting of a navigation bar of hyperlinks
       to the various sections.  This allows easy switching from one part
       to another.
-->
<!--	<xsl:template name="navigation-bar-for-real">
		<HR/>
		<TABLE BORDER="0" CELLPADDING="0" WIDTH="100%">
			<TR>
				<TD>
					<A HREF="#legalEnvelope">
						<strong>legalEnvelope</strong>
					</A>
				</TD>
				<TD>
					<A HREF="#identification">
						<strong>Identification</strong>
					</A>
				</TD>
				<TD>
					<A HREF="#summary">
						<strong>Summary</strong>
					</A>
				</TD>
				<TD>
					<A HREF="#corrections">
						<strong>Corrections</strong>
					</A>
				</TD>
				<TD>
					<A HREF="#arrests">
						<strong>Criminal History</strong>
					</A>
				</TD>
				<TD>
					<A HREF="#index">
						<strong>Agencies</strong>
					</A>
				</TD>
			</TR>
		</TABLE>
		<HR/>
	</xsl:template>
-->	<!-- - - - - - - - - - - - - - - - -+- - - - - - - - - - - - - - - - - -->
	<!--                           legalEnvelopeSection                            -->
	<!-- - - - - - - - - - - - - - - - -+- - - - - - - - - - - - - - - - - -->
	<!--   This template controls formatting of information from the 
       legalEnvelope element.  It is called from the /legalEnvelope template.
-->
	<xsl:template match="messageIdentification">
		<BLOCKQUOTE>
			<TABLE BORDER="0" CELLPADDING="0" WIDTH="90%" BGCOLOR="E4E4E4">
				
				<xsl:if test="self::messageIdentification!=''">
					<TR>
						<TD>messageIdentification</TD>
						<TD>
							<xsl:value-of select="self::messageIdentification"/>
						</TD>
					</TR>
				</xsl:if>
				<xsl:if test="../to/addressee/email!=''">
					<TR>
						<TD>to</TD>
						<TD>
							<xsl:value-of select="../to/addressee/email"/>
						</TD>
					</TR>
				</xsl:if>
				<xsl:if test="../from/sender/email!=''">
					<TR>
						<TD>from</TD>
						<TD>
							<xsl:value-of select="../from/sender/email"/>
						</TD>
					</TR>
				</xsl:if>
 				<xsl:if test="../creation/dateTime!=''">
					<TR>
						<TD>creation</TD>
						<TD>
							<xsl:call-template name="format-date">
								<xsl:with-param name="date" select="../creation/dateTime/date"/>
							</xsl:call-template>
						</TD>
					</TR>
				</xsl:if>

				<TR>
					<TD>legal</TD>
					<TD>
						<xsl:text>courtFiling(filing)</xsl:text> 
					</TD>
				</TR>
			</TABLE>
			</BLOCKQUOTE>
<!--		<xsl:call-template name="navigation-bar"/> -->
	</xsl:template>
	<!-- - - - - - - - - - - - - - - - -+- - - - - - - - - - - - - - - - - -->
	<!--                          filing-actor Section                                 -->
	<!-- - - - - - - - - - - - - - - - -+- - - - - - - - - - - - - - - - - -->
	<!--   This template controls formatting of information from the 
       filing element.  It is called from the /legalEnvelope template.
-->
	<xsl:template match="legal/courtFiling/filing/actor">
		<BLOCKQUOTE>
			<TABLE BORDER="0" CELLPADDING="2" WIDTH="90%">
<xsl:if test="boolean(./@id|./title|./name|./name/personName/designation|./designation)">	
	<xsl:if test="./name/personName">		
				<TR ALIGN="LEFT">
					<TH WIDTH="10%">actor ID#</TH>
					<TH WIDTH="10%">title</TH>
					<TH WIDTH="40%">personName</TH>
					<TH WIDTH="40%">designation</TH>
				</TR>
	
				<TR VALIGN="TOP">
					<TD>
					
						<xsl:choose>
							<xsl:when test="./@id!=''">
								<xsl:value-of select="./@id"/>
							</xsl:when>
							<xsl:otherwise>none</xsl:otherwise>
						</xsl:choose>
					</TD>
					<TD>
						<xsl:choose>
							<xsl:when test="./title!=''">
								<xsl:value-of select="./title"/>
							</xsl:when>
							<xsl:otherwise/>
						</xsl:choose>
					</TD>
					<TD>
						<xsl:choose>
							<xsl:when test="./name/personName!=''">
								<xsl:call-template name="format-personName">
								<xsl:with-param name="personName" select=".//personName"/>
								</xsl:call-template>
							</xsl:when>
							<xsl:otherwise/>
						</xsl:choose>
					</TD>
					
					<TD>
						<xsl:choose>
						
							<!-- personName designation elements -->
							
							<xsl:when test="./name/personName/designation//barNumber!=''">
								
									<xsl:if   test="./name/personName/designation//barNumber!=''">
										<i><xsl:text>barNumber: </xsl:text></i>
									<xsl:value-of select="./name/personName/designation//barNumber"/>									<BR/>
									</xsl:if>
									<xsl:if   test="./name/personName/designation//licenseAuthority!=''">
										<i><xsl:text>licenseAuthority: </xsl:text></i>
							<xsl:value-of select="./name/personName/designation//licenseAuthority"/>	<BR/>
									</xsl:if>
									<xsl:if   test="./name/personName/designation//yearAdmitted!=''">
										<i><xsl:text>yearAdmitted: </xsl:text></i>
									<xsl:value-of select="./name/personName/designation//yearAdmitted"/>									<BR/>
									</xsl:if>
									<xsl:if   test="./name/personName/designation//barStatus!=''">
										<i><xsl:text>barStatus: </xsl:text></i>
									<xsl:value-of select="./name/personName/designation//barStatus"/>										<BR/>
									</xsl:if>

							</xsl:when>
							
							<!-- actor designation elements -->
							
							<xsl:when test="./designation//barNumber!=''">
								
									<xsl:if   test="./designation//barNumber!=''">
										<i><xsl:text>barNumber: </xsl:text></i>
									<xsl:value-of select="./designation//barNumber"/>	<BR/>
									</xsl:if>
									<xsl:if   test="./designation//licenseAuthority!=''">
										<i><xsl:text>licenseAuthority: </xsl:text></i>
									<xsl:value-of select="./designation//licenseAuthority"/>	<BR/>
									</xsl:if>
									<xsl:if   test="./designation//yearAdmitted!=''">
										<i><xsl:text>yearAdmitted: </xsl:text></i>
									<xsl:value-of select="./designation//yearAdmitted"/>	<BR/>
									</xsl:if>
									<xsl:if   test="./designation//barStatus!=''">
										<i><xsl:text>barStatus: </xsl:text></i>
									<xsl:value-of select="./designation//barStatus"/>	<BR/>
									</xsl:if>

							</xsl:when>
							<xsl:when test="./designation!=''">
									<xsl:value-of select="./designation"/>	<BR/>
							</xsl:when>
							<xsl:when test="./name/personName/designation!=''">
									<xsl:value-of select="./name/personName/designation"/>	<BR/>
							</xsl:when>


							<xsl:otherwise>none</xsl:otherwise>
						</xsl:choose>
					</TD>
				</TR>
				<TR>
					<TD COLSPAN="4">
						<HR/>
					</TD>
				</TR>
		</xsl:if>
		<xsl:if test="./name/entity">		
				<TR ALIGN="LEFT">
					<TH WIDTH="10%">actor ID#</TH>
					<TH WIDTH="50%">entityName</TH>
					<TH WIDTH="20%">abbreviatedName</TH>
					<TH WIDTH="20%">ori</TH>
				</TR>
	
				<TR VALIGN="TOP">
					<TD>
					
						<xsl:choose>
							<xsl:when test="./@id!=''">
								<xsl:value-of select="./@id"/>
							</xsl:when>
							<xsl:otherwise></xsl:otherwise>
						</xsl:choose>
					</TD>
					<TD>
					
						<xsl:choose>
							<xsl:when test="./name/entity//entityName!=''">
								<xsl:value-of select="./name/entity//entityName"/>
							</xsl:when>
							<xsl:otherwise></xsl:otherwise>
						</xsl:choose>
					</TD>
					<TD>
					
						<xsl:choose>
							<xsl:when test="./name/entity//entityAbbreviatedName!=''">
								<xsl:value-of select="./name/entity//entityAbbreviatedName"/>
							</xsl:when>
							<xsl:otherwise></xsl:otherwise>
						</xsl:choose>
					</TD>
					<TD>
					
						<xsl:choose>
							<xsl:when test="./name/entity//ori!=''">
								<xsl:value-of select="./name/entity//ori"/>
							</xsl:when>
							<xsl:otherwise></xsl:otherwise>
						</xsl:choose>
					</TD>
					</TR>
				<TR>
					<TD COLSPAN="4">
						<HR/>
					</TD>
				</TR>
		</xsl:if>
</xsl:if>				
<xsl:if test="boolean(./name/personName/name|./telephone|./role)">					
				<TR ALIGN="LEFT">
					<TH COLSPAN="2">Additional Names</TH>
					<TH>telephone</TH>
					<TH>role</TH>
				</TR>
				
				<!-- AKA's , Moniikers, Name permutations -->
				
				<TR VALIGN="TOP">
					<TD COLSPAN="2">
						<xsl:choose>
							<xsl:when test="./name/personName/name/personName!=''">
								<xsl:for-each select="./name/personName/name/personName">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:call-template name="format-personName"/>
								</xsl:for-each>
							</xsl:when>
							<xsl:otherwise>none</xsl:otherwise>
						</xsl:choose>
					</TD>
					
					<!-- telephone numbers -->
				
					<TD>
						<xsl:choose>
							<xsl:when test="./telephone!=''">
								<xsl:for-each select="./telephone">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:call-template name="format-telephone"/>
								</xsl:for-each>
							</xsl:when>
							<xsl:otherwise>none</xsl:otherwise>
						</xsl:choose>
					</TD>
					
					<!-- roles -->
				
					<TD VALIGN="TOP">
						<xsl:choose>
							<xsl:when test="./role!=''">
								<xsl:for-each select="./role">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:value-of select="roleName"/>
									<xsl:if  test="./role/roleWith/@actorID!=''">
										<i><xsl:text> actorID: </xsl:text></i>
										<xsl:value-of select="rolename/roleWith/@actorID"/>
									</xsl:if>
									<xsl:if  test="./role/roleWith/@matterID!=''">
										<i><xsl:text> matterID: </xsl:text></i>
										<xsl:value-of select="rolename/roleWith/@matterID"/>
									</xsl:if>
								</xsl:for-each>
							</xsl:when>
							<xsl:otherwise>none</xsl:otherwise>
						</xsl:choose>
					</TD>
				</TR>
				<TR>
					<TD COLSPAN="4">
						<HR/>
					</TD>
				</TR>
</xsl:if>				
<xsl:if test="boolean(./postalAddress|./email|./group)">					
				<!-- postalAddresses, emails, groups -->
				
				<TR ALIGN="LEFT">
					<TH COLSPAN="4">postalAddress</TH>
					<TH>email</TH>
					<TH>group</TH>
				</TR>
				
				<!-- postalAddress -->
				
				<TR VALIGN="TOP">
					<TD COLSPAN="4">
						<xsl:choose>
							<xsl:when test="./postalAddress!=''">
								<xsl:for-each select="./postalAddress">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:call-template name="format-verticalDisplay"/>
								</xsl:for-each>
							</xsl:when>
							<xsl:otherwise>none</xsl:otherwise>
						</xsl:choose>
					</TD>
				
				<!-- email -->
					
					<TD>
						<xsl:choose>
							<xsl:when test="./email!=''">
								<xsl:for-each select="./email">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:value-of select="."/>
								</xsl:for-each>
							</xsl:when>
							<xsl:otherwise>Unknown</xsl:otherwise>
						</xsl:choose>
					</TD>
					
				<!-- group -->
					

					<TD>
						<xsl:choose>
							<xsl:when test="./group!=''">
								<xsl:for-each select="./group">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:value-of select="group"/>
								</xsl:for-each>
							</xsl:when>
							<xsl:otherwise>tbd</xsl:otherwise>
						</xsl:choose>
					</TD>
				</TR>						
				<TR>
					<TD COLSPAN="4">
						<HR/>
					</TD>
				</TR>
</xsl:if>				
<xsl:if test="boolean(./personDescription/sex|./personDescription/race|./personDescription/height|./personDescription/weight)">					
				<TR ALIGN="LEFT">
					<TH>Sex</TH>
					<TH>Race</TH>
					<TH>Height</TH>
					<TH>Weight</TH>
				</TR>
				<TR VALIGN="TOP">
					<TD>
						<xsl:choose>
							
							<xsl:when test="./personDescription/sex!=''">
								<xsl:for-each select="./personDescription/sex">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:value-of select="."/>
								</xsl:for-each>	
							</xsl:when>
							
						</xsl:choose>
					</TD>
					<TD>
						<xsl:choose>
							<xsl:when test="./personDescription/race!=''">
								<xsl:for-each select="./personDescription/race">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:value-of select="."/>
								</xsl:for-each>	
							</xsl:when>
							
						</xsl:choose>
					</TD>

					<TD>
						<xsl:choose>
							<xsl:when test="./personDescription/height!=''">
								<xsl:for-each select="./personDescription/height">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<!--xsl:value-of select="."/-->
									<xsl:choose>
										<xsl:when test="./@units='inches'">
											<xsl:value-of select="floor((.) div 12)"/>
											<xsl:text>'</xsl:text>
											<xsl:value-of select="(.) mod 12"/>
											<xsl:text>"</xsl:text>
										</xsl:when>
										<xsl:otherwise>
											<xsl:value-of select="floor((.) div 100)"/>
											<xsl:text>'</xsl:text>
											<xsl:value-of select="(.) mod 100"/>
											<xsl:text>"</xsl:text>
										</xsl:otherwise>
									</xsl:choose>
          							</xsl:for-each>
							</xsl:when>
							
						</xsl:choose>
					</TD>
					<TD>
						<xsl:choose>
							<xsl:when test="./personDescription/weight!=''">
								<xsl:for-each select="./personDescription/weight">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:value-of select="."/>
								</xsl:for-each>
							</xsl:when>
							
						</xsl:choose>
					</TD>
					
				</TR>
				
				<TR>
					<TD COLSPAN="4">
						<HR/>
					</TD>
				</TR>
	</xsl:if>			
	<xsl:if test="boolean(./personDescription/eyeColor|./personDescription/hairColor|./personDescription/birthPlace|./personDescription/citizenship)">		
				<TR ALIGN="LEFT">
					<TH>Eye Color</TH>
					<TH>Hair Color</TH>
					<TH>Place of Birth</TH>
					<TH>Citizenship</TH>
				</TR>
	
				<TR VALIGN="TOP">
					<TD>
						<xsl:choose>
							<xsl:when test="./personDescription/eyeColor!=''">
								<xsl:for-each select="./personDescription/eyeColor">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:value-of select="."/>
								</xsl:for-each>
							</xsl:when>
							
						</xsl:choose>
					</TD>
					<TD>
						<xsl:choose>
							<xsl:when test="./personDescription/hairColor!=''">
								<xsl:for-each select="./personDescription/hairColor">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:value-of select="."/>
								</xsl:for-each>
							</xsl:when>
							
						</xsl:choose>
					</TD>
					<TD>
						<xsl:choose>
							<xsl:when test="./personDescription/birthPlace!=''">
								<xsl:for-each select="./personDescription/birthPlace">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:value-of select="."/>
								</xsl:for-each>
							</xsl:when>
							<xsl:otherwise>birth Place unknown</xsl:otherwise>
						</xsl:choose>
					</TD>
					<TD>
						<xsl:choose>
							<xsl:when test="./personDescription/citizenship!=''">
								<xsl:for-each select="./personDescription/citizenship">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:value-of select="."/>
								</xsl:for-each>
							</xsl:when>
							
						</xsl:choose>
					</TD>
				</TR>	
					


				<TR>
					<TD COLSPAN="4">
						<HR/>
					</TD>
				</TR>
	</xsl:if>				
	<xsl:if test="boolean(./personDescription/scarsMarksTattoos|./personDescription/birthDate|./personDescription/ethnicity|./personDescription/maritalStatus)">					
				<TR ALIGN="LEFT">
					<TH>scarsMarksTattoos</TH>
					<TH>birthDate</TH>
					<TH>ethnicity</TH>
					<TH>maritalStatus</TH>
				</TR>
				<TR VALIGN="TOP">
					<TD>
					<xsl:choose>
							<xsl:when test="./personDescription/scarsMarksTattoos!=''">
								<xsl:for-each select="./personDescription//scarsMarksTattoosDescription">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:value-of select="."/>
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					</TD>
					<TD>
					<xsl:choose>
							<xsl:when test="./personDescription/birthDate!=''">
								<xsl:for-each select="./personDescription/birthDate">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
								<xsl:call-template name="format-date">
								<xsl:with-param name="birthDate" select="./personDescription/birthDate"/>
							</xsl:call-template>
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					</TD>
					<TD>
					<xsl:choose>
							<xsl:when test="./personDescription/ethnicity!=''">
								<xsl:for-each select="./personDescription/ethnicity">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:value-of select="."/>
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					</TD>
					<TD>
					<xsl:choose>
							<xsl:when test="./personDescription/maritalStatus!=''">
								<xsl:for-each select="./personDescription/maritalStatus">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:value-of select="."/>
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					</TD>
				</TR>
	
				<TR>
					<TD COLSPAN="4">
						<HR/>
					</TD>
				</TR>
		</xsl:if>
<xsl:if test="boolean(./personDescription/personalIDNumber|./personDescription/fingerprintPattern|./personDescription/religion|./personDescription/skinTone)">					
				<TR ALIGN="LEFT">
					<TH>personalIDNumber</TH>
					<TH>fingerprintPattern</TH>
					<TH>religion</TH>
					<TH>skinTone</TH>
				</TR>
				<TR VALIGN="TOP">
					<TD>
					<xsl:choose>
							<xsl:when test="./personDescription/personalIDNumber!=''">
								<xsl:for-each select="./personDescription/personalIDNumber">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:value-of select="."/>
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					</TD>
					<TD>
					<xsl:choose>
							<xsl:when test="./personDescription/fingerprintPattern!=''">
								<xsl:for-each select="./personDescription/fingerprintPattern">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:value-of select="."/>
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					</TD>
					<TD>
					<xsl:choose>
							<xsl:when test="./personDescription/religion!=''">
								<xsl:for-each select="./personDescription/religion">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:value-of select="."/>
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					</TD>
					<TD>
					<xsl:choose>
							<xsl:when test="./personDescription/skinTone!=''">
								<xsl:for-each select="./personDescription/skinTone">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:value-of select="."/>
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					</TD>
				</TR>
	
				<TR>
					<TD COLSPAN="4">
						<HR/>
					</TD>
				</TR>
		</xsl:if>
<xsl:if test="boolean(./characteristic)">					
				<TR ALIGN="LEFT">
					<TH colspan="2">characteristicName</TH>
					<TH colspan="2">characteristicValue</TH>
				</TR>
				<TR VALIGN="TOP">
					<TD colspan="2">
					<xsl:choose>
							<xsl:when test="./characteristic/characteristicName!=''">
								<xsl:for-each select="./characteristic/characteristicName">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:value-of select="."/>
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					</TD>
					<TD colspan="2">
					<xsl:choose>
							<xsl:when test=".//characteristicValue!=''">
								<xsl:for-each select=".//characteristicValue">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:value-of select="."/>
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					</TD>
				</TR>
	
				<TR>
					<TD COLSPAN="4">
						<HR/>
					</TD>
				</TR>
		</xsl:if>
		<xsl:if test="boolean(./personDescription/bloodType|./personDescription/medicalCondition)">					
				<TR ALIGN="LEFT">
					<TH colspan="2">bloodType</TH>
					<TH colspan="2">medicalCondition</TH>
				</TR>
				<TR VALIGN="TOP">
					<TD colspan="2">
					<xsl:choose>
							<xsl:when test="./personDescription/bloodType!=''">
								<xsl:for-each select="./personDescription/bloodType">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:value-of select="."/>
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					</TD>
					<TD colspan="2">
					<xsl:choose>
							<xsl:when test="./personDescription/medicalCondition!=''">
								<xsl:for-each select="./personDescription/medicalCondition">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:value-of select="."/>
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					</TD>
				</TR>
	
				<TR>
					<TD COLSPAN="4">
						<HR/>
					</TD>
				</TR>
		</xsl:if>
			</TABLE>
		</BLOCKQUOTE>
<!--	<xsl:call-template name="navigation-bar"/> -->
</xsl:template>


	<!-- - - - - - - - - - - - - - - - -+- - - - - - - - - - - - - - - -      -->
	<!--                          filing-filingInformation Section         -->
	<!-- - - - - - - - - - - - - - - - -+- - - - - - - - - - - - - - - - - - -->
	<!--   This template controls formatting of information from the 
       filing element.  It is called from the /legalEnvelope template.
-->
	<xsl:template match="legal/courtFiling/filing/filingInformation">
		<BLOCKQUOTE>
			<TABLE BORDER="0" CELLPADDING="2" WIDTH="90%">
				<xsl:if test="boolean(./@id)">	
					
				<TR ALIGN="LEFT">
					<TH WIDTH="25%">filing ID</TH>
					<TH WIDTH="25%">specialHandling</TH>
					<TH WIDTH="25%">paymentInformation</TH>
					<TH WIDTH="25%">authentication</TH>
				</TR>
	
				<TR VALIGN="TOP">
					<TD>
					
						<xsl:choose>
							<xsl:when test="./@id!=''">
								<xsl:value-of select="./@id"/>
							</xsl:when>
							<xsl:otherwise>none</xsl:otherwise>
						</xsl:choose>
					</TD>
					<TD>
					
						<xsl:choose>
							<xsl:when test="./specialHandling!=''">
								<xsl:for-each select="./specialHandling">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:value-of select="."/>
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					</TD>
					<TD>
											
					<xsl:choose>
							<xsl:when test="./paymentInformation!=''">
								<xsl:for-each select="./paymentInformation">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:value-of select="."/>
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					</TD>

					<TD>
					
						<xsl:choose>
							<xsl:when test="./authentication!=''">
								<xsl:for-each select="./authentication">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:value-of select="."/>
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					</TD>

					</TR>
				<TR>
					<TD COLSPAN="4">
						<HR/>
					</TD>
				</TR>
				
				</xsl:if>
				<xsl:if test="boolean(./courtInformation/physicalLocation)">	
					
				<TR ALIGN="LEFT">
					<TH WIDTH="25%">locationText</TH>
					<TH WIDTH="25%">postalAddress</TH>
					<TH WIDTH="25%">relatedLocation</TH>
					<TH WIDTH="25%">locationType</TH>
				</TR>
	
				<TR VALIGN="TOP">
					<TD>
					<xsl:choose>
							<xsl:when test=".//locationText!=''">
								<xsl:for-each select=".//locationText">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:call-template name="format-verticalDisplay">
									</xsl:call-template>
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					</TD>
					<TD>
					
						<xsl:choose>
							<xsl:when test=".//postalAddress!=''">
								<xsl:for-each select=".//postalAddress">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:call-template name="format-verticalDisplay">
									</xsl:call-template>
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					</TD>
					<TD>
											
					<xsl:choose>
							<xsl:when test=".//relatedLocation!=''">
								<xsl:for-each select=".//relatedLocation">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:value-of select="."/>
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					</TD>

					<TD>
					
						<xsl:choose>
							<xsl:when test=".//locationType!=''">
								<xsl:for-each select=".//locationType">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:value-of select="."/>
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					</TD>

					</TR>
				<TR>
					<TD COLSPAN="4">
						<HR/>
					</TD>
				</TR>
				
				</xsl:if>
				<xsl:if test="boolean(./courtInformation/courtType)">	
					
				<TR ALIGN="LEFT">
					<TH WIDTH="25%">courtType</TH>
					<TH WIDTH="25%">courtName</TH>
					<TH WIDTH="50%">CaseInformation</TH>
				</TR>
	
				<TR VALIGN="TOP">
					<TD>
					<xsl:choose>
							<xsl:when test=".//courtType!=''">
								<xsl:for-each select=".//courtType">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
										<xsl:value-of select="."/>
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					</TD>
					<TD>
					
					<xsl:choose>
							<xsl:when test=".//courtName!=''">
								<xsl:for-each select=".//courtName">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
										<xsl:value-of select="."/>
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					</TD>
					<TD>
											
					<xsl:choose>
							<xsl:when test="./caseInformation!=''">
								<xsl:for-each select="./caseInformation">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:call-template name="format-verticalDisplay">
									</xsl:call-template>
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					</TD>

					
					</TR>
				<TR>
					<TD COLSPAN="4">
						<HR/>
					</TD>
				</TR>
				
				</xsl:if>
				<xsl:if test="boolean(./actor|./courtEvent|./memo)">	
					
				<TR ALIGN="LEFT">
					<TH WIDTH="25%">actor</TH>
					<TH WIDTH="25%">courtEvent</TH>
					<TH WIDTH="50%">memo</TH>
				</TR>
	
				<TR VALIGN="TOP">
					<TD>
					<xsl:choose>
							<xsl:when test="./actor!=''">
								<xsl:for-each select="./actor">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
										<xsl:text>tbd</xsl:text>
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					</TD>
					<TD>
					
					<xsl:choose>
							<xsl:when test="./courtEvent!=''">
								<xsl:for-each select="./courtEvent">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
										<xsl:text>tbd</xsl:text>
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					</TD>
					<TD>
											
					<xsl:choose>
							<xsl:when test="./memo!=''">
								<xsl:for-each select="./memo">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
										<xsl:value-of select="."/>
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					</TD>

					
					</TR>
				<TR>
					<TD COLSPAN="4">
						<HR/>
					</TD>
				</TR>
				
				</xsl:if>
					
					
					
			</TABLE>
		</BLOCKQUOTE>
<!--	<xsl:call-template name="navigation-bar"/> -->		
	</xsl:template>
	
	<!-- This begins the LeadDocument Section -->
	

	<!-- - - - - - - - - - - - - - - - -+- - - - - - - - - - - - - - - -      -->
	<!--                          filing-leadDocument Section         -->
	<!-- - - - - - - - - - - - - - - - -+- - - - - - - - - - - - - - - - - - -->
	<!--   This template controls formatting of information from the 
       filing element.  It is called from the /legalEnvelope template.
-->
	<xsl:template match="legal/courtFiling/filing/leadDocument">
		<BLOCKQUOTE>
			<TABLE BORDER="0" CELLPADDING="2" WIDTH="90%">
				<xsl:if test="boolean(./@id)">	
					
				<TR ALIGN="LEFT">
					<TH WIDTH="25%">leadDoc ID</TH>
					<TH WIDTH="25%">actor</TH>
					<TH WIDTH="25%">submitted</TH>
					<TH WIDTH="25%">documentDescription</TH>
				</TR>
	
				<TR VALIGN="TOP">
					<TD>
					
						<xsl:choose>
							<xsl:when test="./@id!=''">
								<xsl:value-of select="./@id"/>
							</xsl:when>
							<xsl:otherwise>none</xsl:otherwise>
						</xsl:choose>
					</TD>
					<TD>
					
					<xsl:choose>
							<xsl:when test="./documentInformation/actor!=''">
								<xsl:for-each select="./documentInformation/actor">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:text>tbd</xsl:text>
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					<xsl:choose>
							<xsl:when test="./documentInformation/actor/@id!=''">
								<xsl:for-each select="./documentInformation/actor/@*">
									
									<i><xsl:value-of select="local-name(.)"/>
									<xsl:text>: </xsl:text></i>
									<xsl:value-of select="."/>
									<BR/>

								</xsl:for-each>
							</xsl:when>
					</xsl:choose>

					</TD>
					<TD>
										
					<xsl:choose>
							<xsl:when test="./documentInformation/submitted//date!=''">
								<xsl:for-each select="./documentInformation/submitted//date">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:call-template name="format-date"></xsl:call-template>
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					</TD>

					<TD>
					
						<xsl:choose>
							<xsl:when test="./documentInformation/documentDescription!=''">
								<xsl:for-each select="./documentInformation/documentDescription">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:call-template name="format-verticalDisplay"></xsl:call-template>
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					</TD>

					</TR>
				<TR>
					<TD COLSPAN="4">
						<HR/>
					</TD>
				</TR>
				
				</xsl:if>
				
				<!-- CaseLaw, Matter, CauseOfAction -->
				<xsl:if test="boolean(./@id)">	
					
				<TR ALIGN="LEFT">
					<TH WIDTH="25%">Case Law</TH>
					<TH WIDTH="25%">matter</TH>
					<TH WIDTH="50%">causeOfAction</TH>
					<TH WIDTH="50%">documentContent</TH>

				</TR>
	
				<TR VALIGN="TOP">
					<TD>
					<xsl:choose>
							<xsl:when test="./documentInformation!=''">
								<xsl:for-each select="./documentInformation/*">
									
									<xsl:if test="local-name(.)='administrativeLaw'">
										<xsl:value-of select="local-name(.)"/>
									</xsl:if>
									<xsl:if test="local-name(.)='appeals'">
										<xsl:value-of select="local-name(.)"/>
									</xsl:if>
									<xsl:if test="local-name(.)='bankrupcy'">
										<xsl:value-of select="local-name(.)"/>
									</xsl:if>
									<xsl:if test="local-name(.)='civil'">
										<xsl:value-of select="local-name(.)"/>
									</xsl:if>
									<xsl:if test="local-name(.)='criminal'">
										<xsl:value-of select="local-name(.)"/>
									</xsl:if>
									<xsl:if test="local-name(.)='domesticRelations'">
										<xsl:value-of select="local-name(.)"/>
									</xsl:if>
									<xsl:if test="local-name(.)='juvenile'">
										<xsl:value-of select="local-name(.)"/>
									</xsl:if>
									<xsl:if test="local-name(.)='probate'">
										<xsl:value-of select="local-name(.)"/>
									</xsl:if>
									<xsl:if test="local-name(.)='smallClaims'">
										<xsl:value-of select="local-name(.)"/>
									</xsl:if>
									<xsl:if test="local-name(.)='traffic'">
										<xsl:value-of select="local-name(.)"/>
									</xsl:if>
				
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					</TD>
					<TD>
					
					<xsl:choose>
							<xsl:when test="./documentInformation/matter!=''">
								<xsl:for-each select="./documentInformation/matter">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:value-of select="."/>
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					</TD>
					<TD>
										
					<xsl:choose>
							<xsl:when test="./documentInformation/causeOfAction!=''">
								<xsl:for-each select="./documentInformation/causeOfAction">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:value-of select="."/>															</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					</TD>
					<TD>
										
					<xsl:choose>
							<xsl:when test="./documentContent/@id!=''">
								<xsl:for-each select="./documentContent/@*">
										
									<i><xsl:value-of select="local-name(.)"/>
									<xsl:text>: </xsl:text></i>
									<xsl:if test="local-name(.)= 'href'">
										<a href= ".\LACmplntFelonySample.pdf">Sample</a>
		  								<BR/>
									</xsl:if>
									<xsl:value-of select="."/>
									 
									
									  
								
									<BR/>
									
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					</TD>

					
					</TR>
				<TR>
					<TD COLSPAN="4">
						<HR/>
					</TD>
				</TR>
				
				</xsl:if>
				
					
			</TABLE>
		</BLOCKQUOTE>
<!--	<xsl:call-template name="navigation-bar"/>  -->		
	</xsl:template>
	
	<!-- This begins the Criminal Case Section -->
	

	<!-- - - - - - - - - - - - - - - - -+- - - - - - - - - - - - - - - -      -->
	<!--                          filing-CriminalCase Section         -->
	<!-- - - - - - - - - - - - - - - - -+- - - - - - - - - - - - - - - - - - -->
	<!--   This template controls formatting of information from the 
       filing element.  It is called from the /legalEnvelope template.
-->


	<xsl:template match="legal/courtFiling/filing/leadDocument/documentInformation/criminal/filingCharges/charge">
		<BLOCKQUOTE>
			<TABLE BORDER="0" CELLPADDING="2" WIDTH="90%">
				<xsl:if test="boolean(./@id)">	
					
				<TR ALIGN="LEFT">
					<TH WIDTH="25%">charge ID</TH>
					<TH WIDTH="25%">Count Number</TH>
					<TH WIDTH="25%">Qualifier</TH>
					<TH WIDTH="25%">chargeName</TH>
				</TR>
	
				<TR VALIGN="TOP">
					<TD>
					
						<xsl:choose>
							<xsl:when test="./@id!=''">
								<xsl:value-of select="./@id"/>
							</xsl:when>
							<xsl:otherwise>none</xsl:otherwise>
						</xsl:choose>
					</TD>
					<TD>
					
					<xsl:choose>
							<xsl:when test="./chargeNumber!=''">
								<xsl:value-of select="./chargeNumber"/>
							</xsl:when>
					</xsl:choose>
					</TD>
					<TD>
										
					<xsl:choose>
							<xsl:when test="./inchoateCharge!=''">
								<xsl:value-of select="./inchoateCharge"/>
							</xsl:when>
					</xsl:choose>
					</TD>

					<TD>
					
						<xsl:choose>
							<xsl:when test="./chargeName!=''">
								<xsl:value-of select="./chargeName"/>
							</xsl:when>
					</xsl:choose>
					</TD>

					</TR>
				<TR>
					<TD COLSPAN="4">
						<HR/>
					</TD>
				</TR>
				
			</xsl:if>
				<!-- Charges - Degree,Statute,Severity,CJIS Code  -->
				<xsl:if test="boolean(./chargeDegree|./chargeStatute|./chargeSeverity|./cjisCode|./ncicCode)">	
					
				<TR ALIGN="LEFT">
					<TH WIDTH="20%">Degree</TH>
					<TH WIDTH="20%">Statute</TH>
					<TH WIDTH="20%">Severity</TH>
					<TH WIDTH="20%">CJIS Code</TH>
					<TH WIDTH="20%">NCIC Code</TH>
				</TR>
	
				<TR VALIGN="TOP">
					<TD>
					
						<xsl:choose>
							<xsl:when test="./chargeDegree!=''">
								<xsl:value-of select="./chargeDegree"/>
							</xsl:when>
							<xsl:otherwise>none</xsl:otherwise>
						</xsl:choose>
					</TD>
					<TD>
					
					<!--xsl:choose>
							<xsl:when test="./chargeStatute!=''">
								<xsl:value-of select="./chargeStatute"/>
							</xsl:when>
					</xsl:choose> -->
					<xsl:choose>
							<xsl:when test="./chargeStatute!=''">
								<xsl:for-each select="./chargeStatute/*">
									<i><xsl:value-of select="local-name(.)"/>
									<xsl:text>: </xsl:text></i>
									<xsl:value-of select="."/>
									<BR/>
								</xsl:for-each>	
							</xsl:when>
					</xsl:choose>

					</TD>
					<TD>
										
					<xsl:choose>
							<xsl:when test="./chargeSeverity!=''">
								<xsl:value-of select="./chargeSeverity"/>
							</xsl:when>
					</xsl:choose>
					</TD>

					<TD>
					
						<xsl:choose>
							<xsl:when test="./cjisCode!=''">
								<xsl:value-of select="./cjisCode"/>
							</xsl:when>
					</xsl:choose>
					</TD>
					<TD>
					
						<xsl:choose>
							<xsl:when test="./ncicCode!=''">
								<xsl:value-of select="./ncicCode"/>
							</xsl:when>
					</xsl:choose>
					</TD>


					</TR>
				<TR>
					<TD COLSPAN="4">
						<HR/>
					</TD>
				</TR>
				</xsl:if>
			<!-- Charges - offenseDate, Sentence Range, Disposition,comment  -->
				<xsl:if test="boolean(./offenseDate|./chargeSentenceRange|./chargeDisposition|./commentInformation)">	
					
				<TR ALIGN="LEFT">
					<TH WIDTH="25%">Offense Date</TH>
					<TH WIDTH="25%">Sentence Range</TH>
					<TH WIDTH="50%">Dispostion</TH>
					<TH WIDTH="25%">Comment</TH>
				</TR>
	
				<TR VALIGN="TOP">
					<TD>
					
						<xsl:choose>
							<xsl:when test="./offenseDate!=''">
								<xsl:call-template name="format-date">
								<xsl:with-param name="date" select="offenseDate"/>
								</xsl:call-template>
							</xsl:when>
							<xsl:otherwise>none</xsl:otherwise>
						</xsl:choose>
					</TD>
					<TD>
					
					<xsl:choose>
							<xsl:when test="./chargeSentenceRange!=''">
								<xsl:value-of select="./chargeSentenceRange"/>
							</xsl:when>
					</xsl:choose>
					</TD>
					<TD>
										
					<xsl:choose>
							<xsl:when test="./chargeDisposition!=''">
								<xsl:value-of select="./chargeDisposition"/>
							</xsl:when>
					</xsl:choose>
					</TD>

					<TD>
					
						<xsl:choose>
							<xsl:when test="./commentInformation!=''">
								<xsl:text>tbd</xsl:text>
							</xsl:when>
					</xsl:choose>
					</TD>

					</TR>
				<TR>
					<TD COLSPAN="4">
						<HR/>
					</TD>
				</TR>
				</xsl:if>
				<!-- Charges - Sequence Number, Tracking No., Identical Charges, Charge Reducing Factor  -->
				<xsl:if test="boolean(./chargeSequenceNumber|./chargeTrackingNumber|./numberOfIdenticalCharges|./chargeReducingFactor)">	
					
				<TR ALIGN="LEFT">
					<TH WIDTH="25%">Sequence #</TH>
					<TH WIDTH="25%">Tracking #</TH>
					<TH WIDTH="50%">Number of Identical Charges</TH>
					<TH WIDTH="25%">Charge Reducing Factors</TH>
				</TR>
	
				<TR VALIGN="TOP">
					<TD>
					<xsl:choose>
							<xsl:when test="./chargeSequenceNumber!=''">
								<xsl:value-of select="./chargeSequenceNumber"/>
							</xsl:when>
					</xsl:choose>
					</TD>
					<TD>
					
					<xsl:choose>
							<xsl:when test="./chargeTrackingNumber!=''">
								<xsl:value-of select="./chargeTrackingNumber"/>
							</xsl:when>
					</xsl:choose>
					</TD>
					<TD>
										
					<xsl:choose>
							<xsl:when test="./numberOfIdenticalCharges!=''">
								<xsl:value-of select="./numberOfIdenticalCharges"/>
							</xsl:when>
					</xsl:choose>
					</TD>

					<TD>
					
					<xsl:choose>
						<xsl:when test="./chargeReducingFactor!=''">
							<xsl:for-each select="./chargeReducingFactor">
								<xsl:if test="position()>1">
										<BR/>
								</xsl:if>
								<xsl:value-of select="."/>
							</xsl:for-each>	
						</xsl:when>
					</xsl:choose>
					</TD>

					</TR>
				<TR>
					<TD COLSPAN="4">
						<HR/>
					</TD>
				</TR>
				</xsl:if>
		
	<!-- ////////////////////////////////////////////////////////////////////////////////// -->
	<!--  Need to Do Originating Jurisdiction Here Later         -->
	<!-- ////////////////////////////////////////////////////////////////////////////////// -->	
	
	
	<!-- Charges - Special Allegations, Priors  -->
		
	<xsl:choose>
		<xsl:when test="./chargeEnhancingFactor!=''">
			<xsl:for-each select="./chargeEnhancingFactor">
							
				<!-- Charges - Special Allegations  -->
				
				<xsl:if test="boolean(./allegationCharge)">	
					
				<TR ALIGN="LEFT">
					<TH WIDTH="20%">Allegation</TH>
					<TH WIDTH="20%">Alleg. Statute</TH>
					<TH WIDTH="20%">Alleg. CJIS Code</TH>
					<TH WIDTH="20%">Alleg. NCIC Code</TH>
					<TH WIDTH="20%">Alleg. Sentence Effect</TH>
				</TR>
	
				<TR VALIGN="TOP">
					<TD>
					
						<xsl:choose>
							<xsl:when test=".//chargeName!=''">
								<xsl:value-of select=".//chargeName"/>
							</xsl:when>
							<xsl:otherwise>none</xsl:otherwise>
						</xsl:choose>
					</TD>
					<TD>
					<xsl:choose>
							
							<xsl:when test="./allegationCharge/chargeStatute!=''">
								<xsl:for-each select="./allegationCharge/chargeStatute/*">
									<i><xsl:value-of select="local-name(.)"/>
									<xsl:text>: </xsl:text></i>
									<xsl:value-of select="."/>
									<BR/>
								</xsl:for-each>	
							</xsl:when>
					</xsl:choose>
					</TD>
					<TD>
										
					<xsl:choose>
							<xsl:when test=".//cjisCode!=''">
								<xsl:value-of select=".//cjisCode"/>
							</xsl:when>
					</xsl:choose>
					</TD>
					<TD>
										
					<xsl:choose>
							<xsl:when test=".//ncicCode!=''">
								<xsl:value-of select=".//ncicCode"/>
							</xsl:when>
					</xsl:choose>
					</TD>



					<TD>
					
						<xsl:choose>
							<xsl:when test=".//chargeSentenceRange!=''">
								<xsl:value-of select=".//chargeSentenceRange"/>
							</xsl:when>
					</xsl:choose>
					</TD>

					</TR>
				<TR>
					<TD COLSPAN="4">
						<HR/>
					</TD>
				</TR>
				</xsl:if>
								
				<xsl:if test="boolean(./allegationCharge)">	
					
				<TR ALIGN="LEFT">
					<TH WIDTH="25%">Alleg. Disposition</TH>
					<TH WIDTH="25%">Alleg. Comment</TH>
				</TR>
	
				<TR VALIGN="TOP">
					<TD>
					
						<xsl:choose>
							<xsl:when test=".//chargeDisposition!=''">
								<xsl:value-of select=".//chargeDisposition"/>
							</xsl:when>
							<xsl:otherwise>none</xsl:otherwise>
						</xsl:choose>
					</TD>
					<TD>
					<xsl:choose>
						<xsl:when test=".//comment!=''">
							<xsl:for-each select=".//comment">
								<xsl:if test="position()>1">
										<BR/>
								</xsl:if>
								<xsl:value-of select="."/>
							</xsl:for-each>	
						</xsl:when>
					</xsl:choose>
					</TD>
					

					</TR>
				<TR>
					<TD COLSPAN="4">
						<HR/>
					</TD>
				</TR>
				</xsl:if>
				
				<!-- Charges - Priors  -->
				
				<xsl:if test="boolean(./priors)">	
				<xsl:choose>
					<xsl:when test="./priors!=''">
						<xsl:for-each select="./priors">
							
	
				<TR ALIGN="LEFT">
					<TH WIDTH="25%">prior CaseNumber</TH>
					<TH WIDTH="25%">prior Charge</TH>
					<TH WIDTH="25%">prior Conviction Date</TH>
					<TH WIDTH="25%">prior Other Cases?</TH>
				</TR>
	
				<TR VALIGN="TOP">
					<TD>
					
						<xsl:choose>
							<xsl:when test="./lineageCaseNumber!=''">
								<xsl:for-each select="./lineageCaseNumber/*">
								<xsl:if test="local-name(.)!='courtInformation'">
									<i>	<xsl:value-of select="local-name(.)"/>
										<xsl:text>:</xsl:text>
									</i>
										<xsl:value-of select="."/>
										
									<br></br>	
								</xsl:if>
								</xsl:for-each>
							</xsl:when>
							<xsl:otherwise>none outside</xsl:otherwise>
						</xsl:choose>
						
						<xsl:choose>
							<xsl:when test=".//postalAddress!=''">
								<xsl:for-each select=".//postalAddress">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
									<xsl:call-template name="format-verticalDisplay"/>
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					<xsl:choose>
							<xsl:when test="./lineageCaseNumber/courtInformation/courtType!=''">
								
								<xsl:for-each select="./lineageCaseNumber/courtInformation/courtType">
										
										<xsl:call-template name="format-verticalDisplay"/>
									<i>	<xsl:value-of select="local-name(.)"/>
										<xsl:text>:</xsl:text>
									</i>
										<xsl:value-of select="."/>
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>
					<xsl:choose>
							<xsl:when test=".//courtName!=''">
								<xsl:for-each select=".//courtName">
									<xsl:if test="position()>1">
										<BR/>
									</xsl:if>
										<xsl:call-template name="format-verticalDisplay"/>
								</xsl:for-each>
							</xsl:when>
					</xsl:choose>


					

					</TD>
					<TD>
						<xsl:choose>
							<xsl:when test="./charge!=''">
								<xsl:for-each select="./charge">
									<xsl:call-template name="format-verticalDisplay"/>
								</xsl:for-each>
							</xsl:when>
							<xsl:otherwise>none</xsl:otherwise>
						</xsl:choose>
					</TD>
					<TD>
										
						<xsl:choose>
							<xsl:when test="./convictionDate!=''">
								<xsl:for-each select="./convictionDate/date">
									<xsl:call-template name="format-date"/>
								</xsl:for-each>
							</xsl:when>
							<xsl:otherwise>none</xsl:otherwise>
						</xsl:choose>
					</TD>

					<TD>
										
						<xsl:choose>
							<xsl:when test="./lineageCase/lineageCase!=''">
								<xsl:for-each select="./lineageCase/lineageCase">
									<xsl:text>tbd</xsl:text>
								</xsl:for-each>
							</xsl:when>
							<xsl:otherwise>none</xsl:otherwise>
						</xsl:choose>
					</TD>

					</TR>
				<TR>
					<TD COLSPAN="4">
						<HR/>
					</TD>
				</TR>
						
								</xsl:for-each>
					</xsl:when>
						
				</xsl:choose>
				</xsl:if>
			
				</xsl:for-each>	
			</xsl:when>
	</xsl:choose>
	
			</TABLE>
		</BLOCKQUOTE>
<!--	<xsl:call-template name="navigation-bar"/> -->		
	</xsl:template>
	
			
</xsl:stylesheet>
