<?xml version="1.0"?>
<xsl:stylesheet version='1.0'
  xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
  xmlns:fo='http://www.w3.org/1999/XSL/Format'>

<!-- Stylesheet created 19 October 2004 by Vikram Ahmed, ECU -->

	<xsl:param name='basefontsize' select='12'/>
	
  <xsl:output indent='yes' encoding="iso-8859-1"/>
  <xsl:template match='/'>

    <fo:root xmlns:fo='http://www.w3.org/1999/XSL/Format'>

 			<fo:layout-master-set>

  			<fo:simple-page-master    master-name='main'
     			  page-width='8.5in'   page-height='11in'
 			      margin-top='0.50in'   margin-bottom='0.25in'
 			      margin-left='0.25in'  margin-right='0.25in'>

						<fo:region-start extent='0.25in'/>
						<fo:region-before extent='0.25in'/>
						<fo:region-end extent='0.25in'/>
						<fo:region-after extent='0.25in'/>

						<fo:region-body margin='0.25in'/>

 			 </fo:simple-page-master>

			</fo:layout-master-set>
				<!-- frontmatter -->
	     <fo:page-sequence master-reference='main'
				initial-page-number='1'>
        <fo:flow flow-name='xsl-region-body' >
          <xsl:apply-templates select='ead/frontmatter/titlepage'/>
        </fo:flow>
      </fo:page-sequence>
				<!-- table of contents -->
	     <fo:page-sequence master-reference='main'>
						<fo:static-content flow-name='xsl-region-after' margin-left='0.5in'>
					
						<fo:table width='7.0in' table-layout='fixed'>
		<fo:table-column column-width='5.25in' column-number='1'/>
		<fo:table-column column-width='1.75in' column-number='2'/>
		<fo:table-body>
				<fo:table-row>
					<fo:table-cell>
						<fo:block text-align='center' 
							font-size='{$basefontsize - 2}pt' color='gray'>
							<xsl:value-of select='//frontmatter/titlepage/publisher'/>
						</fo:block>
					</fo:table-cell>   
				</fo:table-row>
			</fo:table-body>
	</fo:table>
	</fo:static-content>   
					<fo:flow flow-name='xsl-region-body'>
					<fo:block
							text-align='center'
 						 	font-size='{$basefontsize + 4}pt'
						 	line-height='{$basefontsize + 4}pt'
						 	font-weight='bold'
							space-after='{$basefontsize + 24}pt' >
						<xsl:text>Table of Contents</xsl:text>
					</fo:block>
					<xsl:apply-templates mode='toc' select='ead/archdesc'/>
        </fo:flow>
		</fo:page-sequence>

				<!-- body  -->
	     <fo:page-sequence master-reference='main'>
					<fo:static-content flow-name='xsl-region-before'>
						<fo:block text-align='center' font-size='{$basefontsize - 2}pt' color='gray'>
							<xsl:value-of select='//titleproper'/>
						</fo:block>
					</fo:static-content>
					<fo:static-content flow-name='xsl-region-after' margin-left='0.5in'>
					
						<fo:table width='7.0in' table-layout='fixed'>
		<fo:table-column column-width='5.25in' column-number='1'/>
		<fo:table-column column-width='1.75in' column-number='2'/>
		<fo:table-body>
				<fo:table-row>
					<fo:table-cell>
						<fo:block text-align='left' 
							font-size='{$basefontsize - 2}pt' color='gray'>
							<xsl:value-of select='//frontmatter/titlepage/publisher'/>
						</fo:block>
					</fo:table-cell>
					<fo:table-cell>
					<fo:block text-align='right' 
							font-size='{$basefontsize - 2}pt' color='gray'>
							<xsl:text>Page </xsl:text>
							<fo:page-number/>
						</fo:block>
					</fo:table-cell>
				</fo:table-row>
			</fo:table-body>
	</fo:table>
	</fo:static-content>
  
      	<fo:flow flow-name='xsl-region-body'>
          	<xsl:apply-templates select='ead/archdesc'/>
        	</fo:flow>
      </fo:page-sequence>

     </fo:root>
  </xsl:template>

<!-- titlepage -->
  <xsl:template match='titlepage'>
    <fo:block text-align='center'
							font-size='{$basefontsize + 2}pt'
  						line-height='{$basefontsize + 4}pt' >
      <xsl:apply-templates/>
    </fo:block>
  </xsl:template>

<xsl:template match='titlepage/p[1]'>
    <fo:block text-align='center'
							font-size='{$basefontsize - 2}pt'
  						line-height='{$basefontsize + 2}pt' >
      <xsl:apply-templates/>
    </fo:block>
  </xsl:template>

<xsl:template match='titlepage/p[2]'>
    <fo:block text-align='center' color='gray'
							font-size='{$basefontsize - 2}pt'
  						line-height='{$basefontsize + 24}pt' >
      <xsl:apply-templates/>
    </fo:block>
  </xsl:template>

<xsl:template match='titlepage/subtitle'>
    <fo:block space-before='0.25in'
							font-size='{$basefontsize + 8}pt'
							line-height='{$basefontsize + 10}pt'
							font-weight='bold' color="#800080" >
     <xsl:apply-templates/>
		</fo:block>
</xsl:template>

 <xsl:template match='titlepage/titleproper'>
    <fo:block space-before='0.25in'
							font-size='{$basefontsize + 8}pt'
							line-height='{$basefontsize + 10}pt'
							font-weight='bold' color="#800080" >
     <xsl:apply-templates/>
		</fo:block>
  </xsl:template>

  <xsl:template match='titlepage/publisher'>
    <fo:block space-before='0.25in'
							font-size='{$basefontsize + 4}pt'
							line-height='{$basefontsize + 6}pt'
							color="#800080">
      <xsl:apply-templates select='extptr'/>
    </fo:block>
  </xsl:template>

 <xsl:template match='titlepage/author'>
   <fo:block space-before='0.75in'
						 font-size='{$basefontsize + 2}pt'
						 line-height='{$basefontsize + 2}pt'
						 font-weight='bold' >
     <xsl:apply-templates/>
   </fo:block>
 </xsl:template>

 <xsl:template match='titlepage/date'>
   <!-- <fo:block
			font-weight='bold' color="#800080" >
     <xsl:apply-templates/>
   </fo:block> -->
 </xsl:template>

<xsl:template match='titlepage/list[@type="simple"]'>
	<xsl:if test='head'>
		<fo:block space-before='0.25in' space-after='0.25in'
		font-size='{$basefontsize + 2}pt'
	  font-weight='bold'
		line-height='{$basefontsize + 4}pt' >
			<xsl:apply-templates select='head'/>
		</fo:block>
	</xsl:if>
	<xsl:if test='not(head)'>
		<fo:block >
			<xsl:attribute name='space-before'>
				<xsl:text>0.25in</xsl:text>
			</xsl:attribute>
		</fo:block>
	</xsl:if>
	<xsl:for-each select='item'>
		<fo:block line-height='{$basefontsize + 2}pt' > 
			<xsl:apply-templates/>
		</fo:block>			
	</xsl:for-each>
</xsl:template>

<xsl:template match='titlepage/list[@type="deflist"]'>
	<xsl:if test='head'>
		<fo:block space-before='0.25in'
							space-after='0.25in'
							font-size='{$basefontsize + 2}pt'
							line-height='{$basefontsize + 2}pt' >
			<xsl:apply-templates select='head'/>
		</fo:block>
	</xsl:if>
	<xsl:if test='not(head)'>
		<fo:block space-before='0.25in' >
    </fo:block>
	</xsl:if>
<xsl:text>Guide URL: </xsl:text><xsl:value-of select='//archdesc/did/unitid'/><xsl:text>.frame.html</xsl:text>
	<xsl:for-each select='defitem'>
		<fo:block font-size='{$basefontsize + 2}pt'
							line-height='{$basefontsize + 2}pt' >
      <xsl:apply-templates select='label'/>
			<xsl:text>&#160;</xsl:text>
			<xsl:apply-templates select='item'/>
		</fo:block>			
	</xsl:for-each>
</xsl:template>

<!-- table of contents -->

 <xsl:template mode='toc' match='archdesc/*/head'>
    <fo:block 

			text-align-last='justify'
			font-size='{$basefontsize + 2}pt'
			line-height='{$basefontsize + 4}pt'
			font-weight='bold'
			space-after='{$basefontsize}pt' >
			<xsl:number count='archdesc/*[head]' format='1. '/>
			<xsl:apply-templates/>
			<xsl:text> </xsl:text>			
			<fo:inline
				font-size='{$basefontsize -2}pt'
				line-height='{$basefontsize -2}pt'
				font-weight='bold'
				space-after='{$basefontsize}pt'>
				<fo:leader  
					leader-length.minimum='0pt'
					leader-length.optimum='12pt'
					leader-length.maximum='100%'
					leader-pattern='dots'/>
<!-- 					<xsl:text></xsl:text>			 -->
				<fo:page-number-citation ref-id='{generate-id(.)}'/>
			</fo:inline>
    </fo:block>
 </xsl:template>

 <xsl:template mode='toc' match='archdesc/*/*/head'>
    <fo:block 
			text-align-last='justify'
			text-indent='12pt'
			font-size='{$basefontsize}pt'
			line-height='{$basefontsize}pt'
			font-weight='bold'
			space-after='{$basefontsize}pt' >
			<xsl:number count='archdesc/*[head]' format='1.'/>
			<xsl:number count='archdesc/*/*[head]' format='1 '/>
     	<xsl:apply-templates/>
			<xsl:text> </xsl:text>
			<fo:inline
				font-size='{$basefontsize -2}pt'
				line-height='{$basefontsize -2}pt'
				font-weight='bold'
				space-after='{$basefontsize}pt'>
				<fo:leader 
					leader-length.minimum='12pt'
					leader-length.optimum='40pt'
					leader-length.maxium='100%'
					leader-pattern='dots'/>	
					<xsl:text>  </xsl:text>			
				<fo:page-number-citation ref-id='{generate-id(.)}'/>
			</fo:inline>
    </fo:block>
 </xsl:template>

 <xsl:template mode='toc' match='archdesc/*/*/*/head'>
    <fo:block 
			text-align-last='justify'
			text-indent='18pt'
			font-size='{$basefontsize -2}pt'
			line-height='{$basefontsize -2}pt'
			font-weight='bold'
			space-after='{$basefontsize}pt' >
			<xsl:number count='archdesc/*[head]' format='1.'/>
			<xsl:number count='archdesc/*/*[head]' format='1.'/>
			<xsl:number count='archdesc/*/*/*[head]' format='1 '/>
     	<xsl:apply-templates/>
			<xsl:text> </xsl:text>
			<fo:inline
				font-size='{$basefontsize -2}pt'
				line-height='{$basefontsize -2}pt'
				font-weight='bold'
				space-after='{$basefontsize}pt'>
				<fo:leader 
					leader-length.minimum='12pt'
					leader-length.optimum='40pt'
					leader-length.maxium='100%'
					leader-pattern='dots'/>	
					<xsl:text>  </xsl:text>			
				<fo:page-number-citation ref-id='{generate-id(.)}'/>
			</fo:inline>
    </fo:block>
 </xsl:template>

<!-- body -->
 <xsl:template match='archdesc'>
    <fo:block font-size='{$basefontsize}pt'
				line-height='{$basefontsize + 2}pt' >
      <xsl:apply-templates/>
    </fo:block>
  </xsl:template>

 <xsl:template match='p'>
    <fo:block >
			<xsl:attribute name='space-before'>
				<xsl:choose>
					<xsl:when test='parent::titlepage'>
						<xsl:text>0.5in</xsl:text>
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select='$basefontsize + 2'/>
						<xsl:text>pt</xsl:text>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:attribute>					
			<xsl:if test='parent::titlepage'>
			<xsl:attribute name='font-size'>
				<xsl:value-of select='$basefontsize - 2'/>
				<xsl:text>pt</xsl:text>
			</xsl:attribute>
			<xsl:attribute name='line-height'>
				<xsl:value-of select='$basefontsize'/>
				<xsl:text>pt</xsl:text>
			</xsl:attribute>
			</xsl:if>
      <xsl:apply-templates/>
    </fo:block>
 </xsl:template>

 <xsl:template match='archdesc/*/head'>
    <fo:block
			id='{generate-id(.)}'
			keep-with-next.within-page="always"
			font-size='{$basefontsize + 4}pt'
			line-height='{$basefontsize + 6}pt'
			space-before='{$basefontsize + 12}pt'
			space-after='{$basefontsize - 2}pt'
			font-weight='bold' >
      <xsl:apply-templates/>
    </fo:block>
 </xsl:template>

 <xsl:template match='archdesc/*/*/head'>
    <fo:block
			id='{generate-id(.)}'
			keep-with-next.within-page="always"
			font-size='{$basefontsize + 2}pt'
			line-height='{$basefontsize + 4}pt'
			space-before='{$basefontsize + 2}pt'
			space-after='{$basefontsize - 2}pt'
			font-weight='bold' >
      <xsl:apply-templates/>
    </fo:block>
 </xsl:template>

 <xsl:template match='archdesc/*/*/*/head'>
    <fo:block
			id='{generate-id(.)}'
			keep-with-next.within-page="always"
			font-size='{$basefontsize + 2}pt'
			line-height='{$basefontsize + 4}pt'
			space-before='{$basefontsize + 2}pt'
			space-after='{$basefontsize - 2}pt'
			font-weight='bold' >
      <xsl:apply-templates/>
    </fo:block>
 </xsl:template>

<xsl:template match='archdesc/did'>
	<xsl:apply-templates select='head'/> 
	<fo:table width='6.0in' table-layout='fixed'>
		<fo:table-column column-width='2.25in' column-number='1'/>
		<fo:table-column column-width='3.75in' column-number='2'/>
		<fo:table-body>
			<xsl:for-each select='*[not(self::note) and not(self::head) and not(self::unitid)]'>
				<fo:table-row>
					<fo:table-cell>
						<fo:block 
							space-before='{$basefontsize}pt'
							font-weight='bold' >		
							<xsl:apply-templates select='@label'/>
							<xsl:text>: </xsl:text>
						</fo:block>
					</fo:table-cell>
					<fo:table-cell>
						<fo:block space-before='{$basefontsize}pt'>	
							<xsl:apply-templates/>
						</fo:block>
					</fo:table-cell>
				</fo:table-row>
			</xsl:for-each>
		</fo:table-body>
	</fo:table>
</xsl:template>

<xsl:template match='chronlist'>
	<xsl:apply-templates select='head'/> 
	<fo:table width='6.0in' table-layout='fixed'>
		<fo:table-column column-width='1.25in' column-number='1'/>
		<fo:table-column column-width='4.75in' column-number='2'/>
		<xsl:apply-templates select='listhead'/>
		<fo:table-body>
			<xsl:for-each select='chronitem'>
				<fo:table-row>
					<fo:table-cell>
						<fo:block 
							space-before='{$basefontsize}pt' >
							<xsl:apply-templates select='date'/>
						</fo:block>
					</fo:table-cell>
					<fo:table-cell>
						<fo:block space-before='{$basefontsize}pt'>	
							<xsl:apply-templates select='event'/>
						</fo:block>
					</fo:table-cell>
				</fo:table-row>
			</xsl:for-each>
		</fo:table-body>
	</fo:table>
</xsl:template>

<xsl:template match='listhead'>
	<fo:table-header>
		<fo:table-row>
			<fo:table-cell>
				<fo:block 
					space-before='{$basefontsize}pt'
					font-weight='bold' >
					<xsl:apply-templates select='head01'/>
				</fo:block>
			</fo:table-cell>
			<fo:table-cell>
				<fo:block space-before='{$basefontsize}pt'
					font-weight='bold' >	
					<xsl:apply-templates select='head02'/>
				</fo:block>
			</fo:table-cell>
		</fo:table-row>
	</fo:table-header>
</xsl:template>

<xsl:template match='controlaccess'>
	<xsl:for-each select='*'>
		<xsl:choose>
			<xsl:when test='self::head | self::address | self::chronlist | self::list | self::note | self::table | self::p | self::blockquote | self::controlaccess'>
				<xsl:apply-templates select='.'/>
			</xsl:when>
			<xsl:otherwise>
				<fo:block
          space-before='{$basefontsize -2}pt' >
					<xsl:apply-templates select='.'/>
				</fo:block>
			</xsl:otherwise>
		</xsl:choose>		
	</xsl:for-each>
</xsl:template>

<xsl:template match='lb'>
   <fo:block/>
</xsl:template>

<xsl:template match='controlaccess/list'>
	<xsl:if test='head'>
		<fo:block space-before='0.25in' space-after='0.25in'
		font-size='{$basefontsize + 2}pt'
	  font-weight='bold'
		line-height='{$basefontsize + 4}pt' >
			<xsl:apply-templates select='head'/>
		</fo:block>
	</xsl:if>
  <xsl:for-each select='item'>
		<fo:block line-height='{$basefontsize + 2}pt'> 
		<xsl:attribute name='space-before'>
				<xsl:text>0.25in</xsl:text>
			</xsl:attribute>
		<xsl:apply-templates/>
		<xsl:apply-templates select='lb'/>
		</fo:block>			
	</xsl:for-each>
</xsl:template>

<xsl:template match='controlaccess/list/item/list'>
	<xsl:if test='head'>
		<fo:block space-before='0.25in' space-after='0.25in'
		font-size='{$basefontsize + 2}pt'
	  font-weight='bold'
		line-height='{$basefontsize + 4}pt' >
			<xsl:apply-templates select='head'/>
		</fo:block>
	</xsl:if>
	<xsl:if test='not(head)'>
		<fo:block >
			<xsl:attribute name='space-before'>
				<xsl:text>0.25in</xsl:text>
			</xsl:attribute>
		</fo:block>
	</xsl:if>
	 <xsl:for-each select='item'>
		<fo:block line-height='{$basefontsize + 2}pt' > 
		<xsl:apply-templates/>
		</fo:block>	 
  </xsl:for-each>
</xsl:template>

<xsl:template match='//controlaccess[2]/list/item/list/item/ref'>
	<fo:block line-height='{$basefontsize + 2}pt' margin-left='1.0in'> 
		<xsl:apply-templates/>
		</fo:block>	 
 </xsl:template>



<!-- dsc -->
<xsl:template match='archdesc/dsc/c01'>
    <fo:block 

			text-align ='left'
			font-size='{$basefontsize}pt'
			line-height='{$basefontsize}pt'
			space-after='{$basefontsize}pt' >
			<xsl:apply-templates/>
			<xsl:text> </xsl:text>			
    </fo:block>
 </xsl:template>

<xsl:template match='archdesc/dsc/c01/did/unittitle'>
<fo:block
    
  			text-align ='left'
			font-weight='bold'
			font-size='{$basefontsize}pt'
			line-height='{$basefontsize}pt'
			space-after='{$basefontsize}pt' >
			<xsl:apply-templates/>
			<xsl:text> </xsl:text>	
</fo:block>
</xsl:template>

<xsl:template match='archdesc/dsc/c01/c02/did/container'>
<fo:block>
    
  <xsl:if test="@type='box'">
   <xsl:text>Box </xsl:text>
   </xsl:if>
<xsl:apply-templates/>
</fo:block>
</xsl:template>


<xsl:template match='archdesc/dsc/c01/c02'>
<fo:block 

			text-align ='left'
			text-indent='16pt'
			font-size='{$basefontsize}pt'
			line-height='{$basefontsize + 10}pt'
			space-after='{$basefontsize}pt' >
			<xsl:apply-templates/>
			<xsl:text> </xsl:text>			
    </fo:block>
 </xsl:template>

<xsl:template match='archdesc/dsc/c01/c02/c03'>
<fo:block 

			text-align ='left'
			text-indent='32pt'
			font-size='{$basefontsize}pt'
			line-height='{$basefontsize + 10}pt'
			space-after='{$basefontsize}pt' >
			<xsl:apply-templates/>
			<xsl:text> </xsl:text>		
    </fo:block>
 </xsl:template>

<xsl:template match='archdesc/dsc/c01/c02/c03/c04'>
<fo:block 

			text-align ='left'
			text-indent='48pt'
			font-size='{$basefontsize}pt'
			line-height='{$basefontsize + 10}pt'
			space-after='{$basefontsize}pt' >
			<xsl:apply-templates/>
			<xsl:text> </xsl:text>			
    </fo:block>
 </xsl:template>

<xsl:template name='c1of2'>
 <xsl:choose>
	<xsl:when test='not(did/container) and not(did/unitid)'>
		<xsl:text>&#160;</xsl:text>
	</xsl:when>
	<xsl:otherwise>
		<xsl:for-each select="did/container | did/unitid">
			<xsl:choose>
				<xsl:when test='preceding-sibling::*[1]/self::unitid'>
					<fo:block/>
				</xsl:when>
				<xsl:when test='preceding-sibling::*[1]/self::container'>
					<xsl:text>.</xsl:text>
				</xsl:when>
				<xsl:otherwise/>
			</xsl:choose>
			<xsl:apply-templates/>
		</xsl:for-each>
	</xsl:otherwise>
 </xsl:choose>
</xsl:template>

<xsl:template name='c1of3'>
 <xsl:choose>
	<xsl:when test='not(did/container) and not(did/unitid)'>
		<xsl:text>&#160;</xsl:text>
	</xsl:when>
	<xsl:when test='did/container and did/unitid'>
		<xsl:apply-templates select='did/unitid'/>
	</xsl:when>
	<xsl:otherwise>
		<xsl:apply-templates select="did/container[1]"/>
	</xsl:otherwise>
 </xsl:choose>
</xsl:template>

<xsl:template name='c2of3'>
	<xsl:choose>
		<xsl:when test='not(did/container) and not(did/unitid)'>
			<xsl:text>&#160;</xsl:text>
		</xsl:when>
		<xsl:when test='did/container[1] and did/container[2] and did/unitid'>
			<xsl:apply-templates select='did/container[1]'/>
			<xsl:text>.</xsl:text>
			<xsl:apply-templates select='did/container[2]'/>
		</xsl:when>
		<xsl:otherwise>
			<xsl:apply-templates select="did/container[2]"/>
		</xsl:otherwise>
 	</xsl:choose>
</xsl:template>

<xsl:template name='descentry'>
	<xsl:apply-templates select='did/unittitle'/>
	<!-- pass througn the children of the children of c -->
	<xsl:for-each 
			select="did/*[not(self::unittitle)]
									 [not(self::unitid)]
									 [not(self::container)]
									 [not(self::daogrp)] | 
              *[not(self::did)]
							 [not(self::c02)]
							 [not(self::c03)]
							 [not(self::c04)]
							 [not(self::c05)]
							 [not(self::c06)]
							 [not(self::c07)]
							 [not(self::c08)]
							 [not(self::c09)]
							 [not(self::c10)]
							 [not(self::c11)]
							 [not(self::c12)]">
		<fo:block/>
		<xsl:text>&#160;&#160;&#160;</xsl:text>
		<xsl:apply-templates select="."/>
	</xsl:for-each>
	<xsl:apply-templates select='did/daogrp'/>
</xsl:template>

<xsl:template match="thead[not(ancestor::table)]">
	<fo:table-row>
	<xsl:choose>
		<xsl:when test="row/entry[last()='2']">
			<fo:table-cell number-columns-spanned='6'>
				<fo:block
						
  					
							space-before='{$basefontsize}pt'
							font-weight='bold' >
					<xsl:apply-templates select="row/entry[1]"/>
				</fo:block>
			</fo:table-cell>
			<fo:table-cell number-columns-spanned='34'>
				<fo:block
						
  					
							space-before='{$basefontsize}pt'
							font-weight='bold' >
					<xsl:apply-templates select="row/entry[2]"/>
				</fo:block>
			</fo:table-cell>
		</xsl:when>
		<xsl:when test="row/entry[last()='3']">
			<fo:table-cell number-columns-spanned='6'>
				<fo:block 
						
  					
							space-before='{$basefontsize}pt'
							font-weight='bold' >
					<xsl:apply-templates select="row/entry[1]"/>
				</fo:block>
			</fo:table-cell>
			<fo:table-cell number-columns-spanned='6'>
				<fo:block 
						
  					
							space-before='{$basefontsize}pt'
							font-weight='bold' >
					<xsl:apply-templates select="row/entry[2]"/>
				</fo:block>
			</fo:table-cell>
			<fo:table-cell number-columns-spanned='28'>
				<fo:block 					
							space-before='{$basefontsize}pt'
							font-weight='bold' >
					<xsl:apply-templates select="row/entry[3]"/>
				</fo:block>
			</fo:table-cell>
		</xsl:when>
		<xsl:otherwise>
			<xsl:message>
				<xsl:text>Element thead has less than two row/entry or more than </xsl:text>
				<xsl:text>three row/entry!! Stylesheet will need to be edited to </xsl:text>
				<xsl:text>accommodate this pattern.</xsl:text>
			</xsl:message>
		</xsl:otherwise>
	</xsl:choose>
	</fo:table-row>
</xsl:template>


<xsl:template match='p[ancestor::admininfo/ancestor::*/thead]'>
			<xsl:text>&#160;&#160;&#160;</xsl:text>
			<xsl:apply-templates/>
</xsl:template>

<xsl:template match='thead/row/entry[not(ancestor::table)]'>
	<xsl:apply-templates/>
</xsl:template>


<xsl:template match='title | emph'>
	<fo:inline>
		<xsl:choose>
			<xsl:when test="@render='italic'">
				<xsl:attribute name='font-style'>italic</xsl:attribute>
			</xsl:when>
			<xsl:when test="@render='bold'">
				<xsl:attribute name='font-weight'>bold</xsl:attribute>
			</xsl:when>
			<xsl:when test="@render='bolditalic'">
				<xsl:attribute name='font-style'>italic</xsl:attribute>
				<xsl:attribute name='font-weight'>bold</xsl:attribute>
			</xsl:when>
			<xsl:when test="@render='boldunderline'">
				<xsl:attribute name='font-weight'>bold</xsl:attribute>
				<xsl:attribute name='text-decoration'>underline</xsl:attribute>
			</xsl:when>
			<xsl:when test="@render='underline'">
				<xsl:attribute name='text-decoration'>underline</xsl:attribute>
			</xsl:when>
			<xsl:when test="@render='smcaps'">
				<xsl:attribute name='font-variant'>small-caps</xsl:attribute>
			</xsl:when>
			<xsl:when test="@render='boldsmcaps'">
				<xsl:attribute name='font-weight'>bold</xsl:attribute>
				<xsl:attribute name='font-variant'>small-caps</xsl:attribute>
			</xsl:when>
			<xsl:when test="@render='sub'">
				<xsl:attribute name='vertical-align'>sub</xsl:attribute>
				<xsl:attribute name='font-size'>
					<xsl:value-of select='$basefontsize - 6'/>
					<xsl:text>pt</xsl:text>
				</xsl:attribute>
			</xsl:when>
			<xsl:when test="@render='super'">
				<xsl:attribute name='vertical-align'>super</xsl:attribute>
				<xsl:attribute name='font-size'>
					<xsl:value-of select='$basefontsize - 6'/>
					<xsl:text>pt</xsl:text>
				</xsl:attribute>
			</xsl:when>
			<xsl:otherwise>
				<xsl:attribute name='font-style'>italic</xsl:attribute>
			</xsl:otherwise>
		</xsl:choose>
		<xsl:apply-templates/>
	</fo:inline>
</xsl:template>

<xsl:template match='extptr'>
	<fo:block 					
					space-before='{$basefontsize}pt' space-after='{$basefontsize}pt' >
	<fo:external-graphic>
		<xsl:attribute name='src'>
			<xsl:choose>
				<xsl:when test='@entityref'>
					<xsl:value-of select='unparsed-entity-uri(@entityref)'/>
				</xsl:when>
				<xsl:when test='@href'>
					<xsl:value-of select='@href'/>
				</xsl:when>
				<xsl:when test='@href and @entityref'>
					<xsl:value-of select='unparsed-entity-uri(@entityref)'/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:message>
						<xsl:text>Unable to create link. No @entity ref or @href on </xsl:text>
						<xsl:value-of select='local-name()'/>
						<xsl:text>.</xsl:text>
					</xsl:message>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:attribute>
	</fo:external-graphic>
	</fo:block>
</xsl:template>

</xsl:stylesheet>

