<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet version="1.0" xsi:schemaLocation="http://www.w3.org/1999/XSL/Transform xslt.xsd" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:fox="http://xml.apache.org/fop/extensions" xmlns:rx="http://www.renderx.com/XSL/Extensions" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xmlns:LT="Lookuptable">
	<!--
******************************************************************************
* XSL FORMATTING STYLESHEET: APPLICATION-BODY, wo-application-body           *
* DTD Version       : v1.8   01-07-2021,   v1.9   01-07-2021                 *
* Stylesheet Version: v                                                      *
*		1.93                                                                 *
*		28/02/2026                                                           *
******************************************************************************
*  contacts:                                                                 *
*  WIPO:  Tadanori MORIGUCHI; tadanori.moriguchi@wipo.int                    *
*  Special thanks to John Dunning                                            *
******************************************************************************
	-->  
	<xsl:output method="xml" version="1.0" indent="no" encoding="UTF-8"></xsl:output>
	<!-- KEY TO GENERATE HYPERLINKS FOR <figref> WHEN 'num' ATTRIBUTE IS USED. -->
	   
	<xsl:key name="fig_ref" match="figure" use="@num"></xsl:key>
	<xsl:param name="dtd-version" select="//@dtd-version"></xsl:param>

	<!-- *********************************************************************
     * PARAMETER page_size                                               *
     *  VALUES :  (a4 | A4 ) | (Letter | letter)                         *
     *  DEFAULT:  A4                                                     *
     *  Set at run-time via XSL Processor; calculates margins, page size *
     *  based on page size                                               *
     ********************************************************************* -->
	<xsl:param name="page_size" select="A4"></xsl:param>
	<!-- *********************************************************************
     * PARAMETER: renderer                                               *
     * VALUES:    (FOP | XEP)                                            *
     * DEFAULT:    FOP                                                   *
     * sets rendering tool (XEP | FOP) for bookmark extensions           *
     ********************************************************************* -->
	   
	<xsl:param name="renderer"></xsl:param> 
	<!-- *********************************************************************
     * PARAMETER: lang                                                   *
     * sets language for biolerplate text, hyphenation                   *
     ********************************************************************* -->
	   
	<xsl:param name="lang" select="substring(translate(//@lang,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'),1,2)"></xsl:param>
	<!-- *********************************************************************
     * PARAMETER: country_code                                              *
     * sets country code in header                                          *
     ********************************************************************* -->
	   
	<xsl:param name="country_code" select= "//wo-application-body/publication-reference/document-id/country"></xsl:param>
	<!-- *********************************************************************
     * PARAMETER: doc_number                                              *
     * sets document number in header                                          *
     ********************************************************************* -->
	   
	<xsl:param name="doc_number" select= "//wo-application-body/publication-reference/document-id/doc-number"></xsl:param>
	<!-- *********************************************************************
     * PARAMETER: ia_number                                              *
     * sets IA number in header                                          *
     ********************************************************************* -->
	   
	<xsl:param name="ia_number" select= "//wo-application-body/application-reference/document-id/doc-number"></xsl:param>
	<!-- *********************************************************************
     * PARAMETER: rendering_mode                                         *
     * VALUES:    (DESC | CLMS | ABST | DRAW | '')                       *
     * DEFAULT:    "" (empty string)                                     *
     * denotes what to render :
     *  ''   - all sections
     *  DESC - description only
     *  CLMS - claims only
     *  ABST - abstract only
     *  DRAW - drawings only
     ********************************************************************* -->
	<xsl:param name="rendering_mode"></xsl:param>
	<xsl:param name="typeDoc"></xsl:param>

	<!-- parameter "baseDir":
     It holds a direct path to an image data referred from an input XML file.
     This is used only with  stylesheet with FOP1.1.-->
	<xsl:param name="baseDir"></xsl:param>
	
	 <!-- VARIABLE 'fop_version': finds this PI -->
	<xsl:param name="fop_version">
		<xsl:value-of select="processing-instruction('fop_version')"></xsl:value-of>
	</xsl:param>

	<!-- *********************************************************************
     * DEFINE PAGE MEASUREMENTS                                          *
     ********************************************************************* -->
	   
	<xsl:variable name="page_height">      
		<xsl:choose>         
			<xsl:when test="$page_size='A4' or $page_size='a4'">297</xsl:when>         
			<xsl:when test="$page_size='Letter' or $page_size='letter'">279</xsl:when>         
			<xsl:otherwise>297</xsl:otherwise>      
		</xsl:choose>   
	</xsl:variable>   
	<xsl:variable name="page_width">
		<xsl:choose>
			<xsl:when test="$page_size='A4' or $page_size='a4'">210</xsl:when>
			<xsl:when test="$page_size='Letter' or $page_size='letter'">215</xsl:when>
			<xsl:otherwise>210</xsl:otherwise>
		</xsl:choose>
	</xsl:variable>
	<!-- available height = page height - top, bottom margins and region before/after -->
	<xsl:variable name="avail_height">
		<xsl:value-of select="$page_height - 55"></xsl:value-of>
	</xsl:variable>

	<!-- *********************************************************************
     * PARAMETER: XXX_font for application body
	 * Some fonts settings are different from request forms.
	 * Note: It seems that FOP0.2X does not work well for font-family lists.
	 *       FOP0.2X always uses the first font so long as it is defined.
	 *        (even if it fails to render some characters)
     ********************************************************************* -->
	 <xsl:param name="helvetica_font">
		<xsl:choose>
			<xsl:when test="$lang = 'ar' ">Arialuni, Helvetica, WIPOUni</xsl:when>
			<!-- IPAGothic should be used for Japanese appb instead of IPAMincho -->
			<xsl:when test="$lang = 'ja' ">IPAGothic, WIPOUni, Helvetica</xsl:when>
			<xsl:when test="$lang = 'zh' ">FZSongS-SIP, FZSongS, Simsun, WIPOUni, Helvetica</xsl:when>
			<!-- for other languages, FOP1.1 should use WIPOUni because FOP0.2X has been using WIPOUni -->
			<xsl:otherwise>WIPOUni, Arialuni, Helvetica</xsl:otherwise>
		</xsl:choose>
	</xsl:param>

	<xsl:param name="monospace_font">
		<xsl:choose>
			<xsl:when test="$lang = 'ar' ">Arialuni, monospace, WIPOUni</xsl:when>
			<xsl:when test="$lang = 'ja' ">IPAGothic, monospace, WIPOUni</xsl:when>
			<xsl:when test="$lang = 'zh' ">FZSongS-SIP, FZSongS, Simsun, WIPOUni, monospace</xsl:when>
			<!-- for other languages, FOP1.1 should use WIPOUni because FOP0.2X has been using WIPOUni -->
			<xsl:otherwise>WIPOUni, Arialuni, monospace</xsl:otherwise>
		</xsl:choose>
	</xsl:param>

	<xsl:param name="serif_font">
		<xsl:choose>
			<xsl:when test="$lang = 'ar' ">Arialuni, serif, WIPOUni</xsl:when>
			<xsl:when test="$lang = 'ja' ">IPAGothic, serif, WIPOUni</xsl:when>
			<xsl:when test="$lang = 'zh' ">FZSongS-SIP, FZSongS, Simsun, WIPOUni, serif</xsl:when>
			<!-- for other languages, FOP1.1 should use WIPOUni because FOP0.2X has been using WIPOUni -->
			<xsl:otherwise>WIPOUni, Arialuni, serif</xsl:otherwise>
		</xsl:choose>
	</xsl:param>

	<xsl:variable name="page_margin_left" select="25"></xsl:variable>
	<xsl:variable name="page_margin_right" select="20"></xsl:variable>
	
	<xsl:variable name="content_table_width" select="$page_width - $page_margin_left - 2"></xsl:variable>

	
	<!--xsl:variable name="rule_change_column_width" select="20"/-->

	<xsl:variable name="rule_change_column_width">
		<xsl:choose>
			<xsl:when test="(contains( $fop_version, '2.8')) and ($lang='ja')">20</xsl:when><!--19-->
			<xsl:otherwise>20</xsl:otherwise>
		</xsl:choose>  
	</xsl:variable>

	<xsl:variable name="without_margin_page_width" select="$page_width - $page_margin_left - $page_margin_right"></xsl:variable>
	<xsl:variable name="p_num_column_width">
		<xsl:choose>
			<xsl:when test="$lang='zh'">0</xsl:when>
			<xsl:otherwise>15</xsl:otherwise>
		</xsl:choose>
	</xsl:variable>

	<xsl:variable name="p_content_column_width" select="$content_table_width - $p_num_column_width - $rule_change_column_width"></xsl:variable>

	<xsl:variable name="figure_content_column_width" select="$page_width - $page_margin_left - $rule_change_column_width"/>

	<xsl:variable name="claim_num_column_width">
		<xsl:choose>
			<xsl:when test="$dtd-version &gt;= 1.6">
				<xsl:choose>
					<xsl:when test="$lang='en'">41</xsl:when>
					<xsl:when test="$lang='ja'">35</xsl:when>
					<xsl:when test="$lang='es'">
						<xsl:choose>
							<xsl:when test="not( contains( $fop_version, '0.2') ) and ( $fop_version != '' )">41</xsl:when>
							<xsl:otherwise>50</xsl:otherwise>
						</xsl:choose>
					</xsl:when>
					<xsl:when test="$lang='de'">35</xsl:when>
					<xsl:when test="$lang='zh'">0</xsl:when>
					<xsl:when test="$lang='fr'">45</xsl:when>
					<xsl:when test="$lang='pt'">45</xsl:when>
					<xsl:when test="$lang='ru'">30</xsl:when>
					<xsl:when test="$lang='ko'">
						<xsl:choose>
							<xsl:when test="not( contains( $fop_version, '0.2') ) and ( $fop_version != '' )">28</xsl:when>
							<xsl:otherwise>30</xsl:otherwise>
						</xsl:choose>
					</xsl:when>
					<xsl:otherwise>50</xsl:otherwise>
				</xsl:choose>
			</xsl:when>
			<xsl:otherwise>
				<xsl:choose>
				<xsl:when test="$lang='zh'">0</xsl:when>
				<xsl:otherwise>15</xsl:otherwise>
				</xsl:choose>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:variable>

	<!--Logical variable for column width of claim contents. It is different from the real value. See the comment of match = "claim".  -->
	<xsl:variable name="claim_content_column_width" select="$content_table_width - $claim_num_column_width - $rule_change_column_width"></xsl:variable>

	<xsl:template match="/">
		<fo:root xmlns:fox="http://xml.apache.org/fop/extensions"
	xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:rx="http://www.renderx.com/XSL/Extensions">
		<xsl:choose>
			<xsl:when test="$lang ='ar'">
				<xsl:attribute name="writing-mode">rl</xsl:attribute>
			</xsl:when>
			<xsl:otherwise >
				<xsl:attribute name="font-family">
					<xsl:value-of select="$helvetica_font"/>
				</xsl:attribute>
			</xsl:otherwise>
		</xsl:choose>
			<fo:layout-master-set>
				<!-- DEFINE PAGE LAYOUTS FOR DOCUMENT SECTIONS -->
				<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'DESC')">
					<xsl:choose>
						<xsl:when test="$lang='zh'">
							<fo:simple-page-master master-name="descriptionPages" page-width="{$page_width}mm" page-height="{$page_height}mm" margin-top="20mm" margin-bottom="15mm" margin-left="{$page_margin_left}mm" margin-right="{$page_margin_right}mm">
								<fo:region-body margin-bottom="0mm" margin-right="0mm" margin-left="0mm" margin-top="5mm"></fo:region-body>
								<fo:region-before extent="15mm"></fo:region-before>
							</fo:simple-page-master>
						</xsl:when>
						<xsl:when test="$lang='ja'">
							<fo:simple-page-master master-name="descriptionPages" page-width="{$page_width}mm" page-height="{$page_height}mm" margin-top="10mm" margin-bottom="20mm" margin-left="{$page_margin_left}mm" margin-right="{$page_margin_right}mm">
								<fo:region-body margin-bottom="5mm" margin-right="0mm" margin-left="0mm" margin-top="20mm"></fo:region-body>
								<fo:region-before extent="15mm"></fo:region-before>
							</fo:simple-page-master>
						</xsl:when>
						<xsl:otherwise>
							<fo:simple-page-master master-name="descriptionPages" page-width="{$page_width}mm" page-height="{$page_height}mm" margin-top="7mm" margin-bottom="23mm" margin-left="{$page_margin_left}mm" margin-right="{$page_margin_right}mm">
								<fo:region-body margin-bottom="5mm" margin-right="0mm" margin-left="0mm" margin-top="20mm"></fo:region-body>
								<fo:region-before extent="15mm"></fo:region-before>
							</fo:simple-page-master>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:if>
				<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'CLMS')">
					<xsl:choose>
						<xsl:when test="$lang='zh'">
							<fo:simple-page-master master-name="claimsPages" page-width="{$page_width}mm" page-height="{$page_height}mm" margin-top="20mm" margin-bottom="15mm" margin-left="{$page_margin_left}mm" margin-right="{$page_margin_right}mm">
								<fo:region-body margin-bottom="0mm" margin-right="0mm" margin-left="0mm" margin-top="5mm"></fo:region-body>    
								<fo:region-before extent="15mm"></fo:region-before>
							</fo:simple-page-master>
						</xsl:when>
						<xsl:when test="$lang='ja'">
							<fo:simple-page-master master-name="claimsPages" page-width="{$page_width}mm" page-height="{$page_height}mm" margin-top="10mm" margin-bottom="20mm" margin-left="{$page_margin_left}mm" margin-right="{$page_margin_right}mm">
								<fo:region-body margin-bottom="5mm" margin-right="0mm" margin-left="0mm" margin-top="20mm"></fo:region-body>    
								<fo:region-before extent="15mm"></fo:region-before>
							</fo:simple-page-master>
						</xsl:when>
						<xsl:otherwise>
							<fo:simple-page-master master-name="claimsPages" page-width="{$page_width}mm" page-height="{$page_height}mm" margin-top="7mm" margin-bottom="23mm" margin-left="{$page_margin_left}mm" margin-right="{$page_margin_right}mm">
								<fo:region-body margin-bottom="5mm" margin-right="0mm" margin-left="0mm" margin-top="20mm"></fo:region-body>    
								<fo:region-before extent="15mm"></fo:region-before>
							</fo:simple-page-master>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:if>
				<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'AMD-CLMS')">
					<xsl:choose>
						<xsl:when test="$lang='zh'">
							<fo:simple-page-master master-name="amended-claimsPages" page-width="{$page_width}mm" page-height="{$page_height}mm" margin-top="20mm" margin-bottom="15mm" margin-left="{$page_margin_left}mm" margin-right="{$page_margin_right}mm">
								<fo:region-body margin-bottom="0mm" margin-right="0mm" margin-left="0mm" margin-top="5mm"></fo:region-body>    
								<fo:region-before extent="15mm"></fo:region-before>
							</fo:simple-page-master>
						</xsl:when>
						<xsl:when test="$lang='ja'">
							<fo:simple-page-master master-name="amended-claimsPages" page-width="{$page_width}mm" page-height="{$page_height}mm" margin-top="10mm" margin-bottom="20mm" margin-left="{$page_margin_left}mm" margin-right="{$page_margin_right}mm">
								<fo:region-body margin-bottom="5mm" margin-right="0mm" margin-left="0mm" margin-top="20mm"></fo:region-body>    
								<fo:region-before extent="15mm"></fo:region-before>
							</fo:simple-page-master>
						</xsl:when>
						<xsl:otherwise>
							<fo:simple-page-master master-name="amended-claimsPages" page-width="{$page_width}mm" page-height="{$page_height}mm" margin-top="7mm" margin-bottom="23mm" margin-left="{$page_margin_left}mm" margin-right="{$page_margin_right}mm">
								<fo:region-body margin-bottom="5mm" margin-right="0mm" margin-left="0mm" margin-top="20mm"></fo:region-body>    
								<fo:region-before extent="15mm"></fo:region-before>
							</fo:simple-page-master>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:if>
				<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'ABST')">
					<xsl:choose>
						<xsl:when test="$lang='zh'">
							<fo:simple-page-master master-name="abstractPages" page-width="{$page_width}mm" page-height="{$page_height}mm" margin-top="20mm" margin-bottom="15mm" margin-left="{$page_margin_left}mm" margin-right="{$page_margin_right}mm">
								<fo:region-body margin-bottom="0mm" margin-right="0mm" margin-left="0mm" margin-top="5mm"></fo:region-body>   
								<fo:region-before extent="15mm"></fo:region-before>
							</fo:simple-page-master>
						</xsl:when>
						<xsl:when test="$lang='ja'">
							<fo:simple-page-master master-name="abstractPages" page-width="{$page_width}mm" page-height="{$page_height}mm" margin-top="10mm" margin-bottom="20mm" margin-left="{$page_margin_left}mm" margin-right="{$page_margin_right}mm">
								<fo:region-body margin-bottom="5mm" margin-right="0mm" margin-left="0mm" margin-top="20mm"></fo:region-body>   
								<fo:region-before extent="15mm"></fo:region-before>
							</fo:simple-page-master>
						</xsl:when>
						<xsl:otherwise>
							<fo:simple-page-master master-name="abstractPages" page-width="{$page_width}mm" page-height="{$page_height}mm" margin-top="7mm" margin-bottom="23mm" margin-left="{$page_margin_left}mm" margin-right="{$page_margin_right}mm">
								<fo:region-body margin-bottom="5mm" margin-right="0mm" margin-left="0mm" margin-top="20mm"></fo:region-body>   
								<fo:region-before extent="15mm"></fo:region-before>
							</fo:simple-page-master>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:if>
				<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'DRAW')">
					<xsl:choose>
					<xsl:when test="$lang='zh'">
						<fo:simple-page-master master-name="figures" page-width="{$page_width}mm" page-height="{$page_height}mm" margin-top="5mm" margin-bottom="20mm" margin-left="{$page_margin_left}mm" margin-right="{$page_margin_right}mm">
							<fo:region-body margin-bottom="0mm" margin-right="0mm" margin-left="0mm" margin-top="5mm"></fo:region-body> 
							<fo:region-before extent="15mm"></fo:region-before>
						</fo:simple-page-master>
					</xsl:when>
					<xsl:otherwise>
						<fo:simple-page-master master-name="figures" page-width="{$page_width}mm" page-height="{$page_height}mm" margin-top="5mm" margin-bottom="10mm" margin-left="{$page_margin_left}mm" margin-right="{$page_margin_right}mm">
							<fo:region-body margin-bottom="0mm" margin-right="0mm" margin-left="0mm" margin-top="20mm"></fo:region-body> 
							<fo:region-before extent="15mm"></fo:region-before>
						</fo:simple-page-master>
					</xsl:otherwise>
					</xsl:choose>
				</xsl:if>
				<fo:page-sequence-master master-name="application-body">
					<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'DESC') or (wo-application-body/description)">
						<fo:repeatable-page-master-reference master-reference="descriptionPages"></fo:repeatable-page-master-reference>
					</xsl:if>
					<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'CLMS')">
						<fo:repeatable-page-master-reference master-reference="claimsPages"></fo:repeatable-page-master-reference>
					</xsl:if>
					<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'AMD-CLMS')">
						<fo:repeatable-page-master-reference master-reference="amended-claimsPages"></fo:repeatable-page-master-reference>
					</xsl:if>
					<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'ABST')">
						<fo:repeatable-page-master-reference master-reference="abstractPages"></fo:repeatable-page-master-reference>
					</xsl:if>
					<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'DRAW')">
						<fo:repeatable-page-master-reference master-reference="figures"></fo:repeatable-page-master-reference>
					</xsl:if>
				</fo:page-sequence-master>
				<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'DESC')">
					<fo:page-sequence-master master-name="description">
						<fo:repeatable-page-master-reference master-reference="descriptionPages"></fo:repeatable-page-master-reference>
					</fo:page-sequence-master>
				</xsl:if>
				<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'CLMS')">
					<fo:page-sequence-master master-name="claims">
						<fo:repeatable-page-master-reference master-reference="claimsPages"></fo:repeatable-page-master-reference>
					</fo:page-sequence-master>
				</xsl:if>
				<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'AMD-CLMS')">
					<fo:page-sequence-master master-name="wo-amended-claims">
						<fo:repeatable-page-master-reference master-reference="amended-claimsPages"></fo:repeatable-page-master-reference>
					</fo:page-sequence-master>
				</xsl:if>
				<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'ABST')">
					<fo:page-sequence-master master-name="abstract">
						<fo:repeatable-page-master-reference master-reference="abstractPages"></fo:repeatable-page-master-reference>
					</fo:page-sequence-master>
				</xsl:if>
				<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'DRAW')">
					<fo:page-sequence-master master-name="drawings">
						<fo:repeatable-page-master-reference master-reference="figures"></fo:repeatable-page-master-reference>
					</fo:page-sequence-master>
				</xsl:if>
			</fo:layout-master-set>
			<!-- IF THE DOCUMENT CONSISTS OF SUB-SECTIONS (NOT JUST <doc-page>s)
                 SET BOOKMARKS ACCORDING TO RENDERING TOOL (SPECIFIED PRIOR TO THIS POINT) -->
			<xsl:choose>   
				<xsl:when test="$renderer='FOP'">   
					<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'DESC')">
						<xsl:if test="./*/description">
							<fox:outline internal-destination="descriptionSec">
								<fox:label><xsl:call-template name="description_ChoiceText"></xsl:call-template></fox:label>
							</fox:outline>
						</xsl:if>
					</xsl:if>
					<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'CLMS')">
						<xsl:if test="./*/claims">
							<fox:outline internal-destination="claimSec">
								<fox:label><xsl:call-template name="claim_ChoiceText"></xsl:call-template></fox:label>
							</fox:outline>
						</xsl:if>
					</xsl:if>
					<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'AMD-CLMS')">
						<xsl:if test="./*/wo-amended-claims">
							<fox:outline internal-destination="amd-claimSec">
								<fox:label><xsl:call-template name="amended_claims_ChoiceText"></xsl:call-template></fox:label>
							</fox:outline>
						</xsl:if>
					</xsl:if>
					<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'ABST')">
						<xsl:if test="./*/abstract">
							<fox:outline internal-destination="abstractSec">
								<fox:label><xsl:call-template name="abstract_ChoiceText"></xsl:call-template></fox:label>
							</fox:outline>
						</xsl:if>
					</xsl:if>
					<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'DRAW')">
						<xsl:if test="./*/drawings">
							<fox:outline internal-destination="drawingSec">
								<fox:label><xsl:call-template name="drawing_ChoiceText"></xsl:call-template></fox:label>
							</fox:outline>
						</xsl:if>
					</xsl:if>
				</xsl:when>
				<xsl:when test="$renderer='XEP'">
					<xsl:if test="./*/child::*[name(.) != 'doc-page']">
						<rx:outline>
							<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'DESC')">
								<xsl:if test="./*/description">
									<rx:bookmark internal-destination="descriptionSec">
										<rx:bookmark-label>
											<xsl:call-template name="description_ChoiceText"></xsl:call-template>
										</rx:bookmark-label>
									</rx:bookmark>
								</xsl:if>
							</xsl:if>
							<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'CLMS')">
								<xsl:if test="./*/claims">
									<rx:bookmark internal-destination="claimSec">
										<rx:bookmark-label>
											<xsl:call-template name="claim_ChoiceText"></xsl:call-template>
										</rx:bookmark-label>
									</rx:bookmark>
								</xsl:if>
							</xsl:if>
							<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'AMD-CLMS')">
								<xsl:if test="./*/wo-amended-claims">
									<rx:bookmark internal-destination="amd-claimSec">
										<rx:bookmark-label>
											<xsl:call-template name="amended_claims_ChoiceText"></xsl:call-template>
										</rx:bookmark-label>
									</rx:bookmark>
								</xsl:if>
							</xsl:if>
							<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'ABST')">
								<xsl:if test="./*/abstract">
									<rx:bookmark internal-destination="abstractSec">
										<rx:bookmark-label>
											<xsl:call-template name="abstract_ChoiceText"></xsl:call-template>
										</rx:bookmark-label>
									</rx:bookmark>
								</xsl:if>
							</xsl:if>
							<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'DRAW')">
								<xsl:if test="./*/drawings">
									<rx:bookmark internal-destination="drawingSec">
										<rx:bookmark-label>
											<xsl:call-template name="drawing_ChoiceText"></xsl:call-template>
										</rx:bookmark-label>
									</rx:bookmark>
								</xsl:if>
							</xsl:if>
						</rx:outline>               
					</xsl:if>            
				</xsl:when>
			</xsl:choose>
			<xsl:if test="(($rendering_mode = '') or ($rendering_mode = 'DESC') or (wo-application-body/description)) and ($typeDoc != 'AMD-CLMS')">
				<xsl:choose>
					<xsl:when test="$lang='ja'">
						<fo:page-sequence master-reference="description" force-page-count="no-force">
							<fo:static-content flow-name="xsl-region-before">
								<fo:table table-layout="fixed" width="{$without_margin_page_width}mm">
									<fo:table-column column-width="{$without_margin_page_width div 2}mm"></fo:table-column>
									<fo:table-column column-width="{$without_margin_page_width div 2}mm"></fo:table-column>
									<xsl:choose>
										<xsl:when test="//wo-application-body">
											<xsl:call-template name="docIaNumHeader"/>
										</xsl:when>
										<xsl:otherwise>
											<fo:table-body>
												<fo:table-row>
													<fo:table-cell>
														<fo:block text-align="left" font-size="10pt" background-color="white">
															<xsl:if test="not(./*/description/doc-page)">
																<xsl:value-of select="./*/@file-reference-id"></xsl:value-of>
															</xsl:if>
														</fo:block>
													</fo:table-cell>
													<fo:table-cell>
														<fo:block text-align="right" font-size="10pt" background-color="white">
															<xsl:value-of select="$ia_number"></xsl:value-of>
														</fo:block>
													</fo:table-cell>
												</fo:table-row>
											</fo:table-body>
										</xsl:otherwise>
									</xsl:choose>
								</fo:table>
								<fo:block> </fo:block>
								<fo:block text-align="center" font-size="10pt" color="black" background-color="white">
									<fo:page-number></fo:page-number>
								</fo:block>
							</fo:static-content>
							<fo:flow flow-name="xsl-region-body">
								<fo:block xsl:use-attribute-sets="hyphenation" id="descriptionSec" line-height="2.0">
									<xsl:apply-templates select="./*/description | ./*/doc-page"></xsl:apply-templates>
								</fo:block>
							</fo:flow>
						</fo:page-sequence>
					</xsl:when>
					<xsl:when test="$lang='ar'">
					<fo:page-sequence master-reference="description" force-page-count="no-force">
							<fo:static-content flow-name="xsl-region-before">
								<fo:table table-layout="fixed" width="{$without_margin_page_width}mm">
									<fo:table-column column-width="{$without_margin_page_width div 2}mm"></fo:table-column>
									<fo:table-column column-width="{$without_margin_page_width div 2}mm"></fo:table-column>
									<fo:table-body>
										<fo:table-row>
											<fo:table-cell>
												<fo:block text-align="left" font-size="10pt" background-color="white">
													<xsl:if test="not(./*/description/doc-page)">
														<xsl:value-of select="./*/@file-reference-id"></xsl:value-of>
													</xsl:if>
												</fo:block>
											</fo:table-cell>
											<fo:table-cell>
												<fo:block text-align="right" font-size="10pt" background-color="white">
													<xsl:value-of select="$ia_number"></xsl:value-of>
												</fo:block>
											</fo:table-cell>
										</fo:table-row>
									</fo:table-body>
								</fo:table>
								<fo:block text-align="center" font-size="10pt" color="black" background-color="white">
									<fo:page-number></fo:page-number>
								</fo:block>
							</fo:static-content>
							<fo:flow flow-name="xsl-region-body">
								<fo:block id="descriptionSec">
									<xsl:attribute name="line-height">1.5</xsl:attribute>
									<xsl:apply-templates select="./*/description | ./*/doc-page"></xsl:apply-templates>
								</fo:block>
							</fo:flow>
						</fo:page-sequence>
					</xsl:when>
					<xsl:when test="$lang='zh'">
						<fo:page-sequence master-reference="description" force-page-count="no-force">
							<fo:static-content flow-name="xsl-region-before">
								<fo:table table-layout="fixed" width="{$without_margin_page_width}mm">
									<fo:table-column column-width="{$without_margin_page_width div 2}mm"></fo:table-column>
									<fo:table-column column-width="{$without_margin_page_width div 2}mm"></fo:table-column>
									<xsl:choose>
										<xsl:when test="//wo-application-body">
											<xsl:call-template name="docIaNumHeader"/>
										</xsl:when>
										<xsl:otherwise>
											<fo:table-body>
												<fo:table-row>
													<fo:table-cell>
														<fo:block text-align="left" font-size="9pt" background-color="white">
															<xsl:if test="not(./*/description/doc-page)">
																<xsl:value-of select="./*/@file-reference-id"></xsl:value-of>
															</xsl:if>
														</fo:block>
													</fo:table-cell>
													<fo:table-cell>
														<fo:block text-align="right" font-size="9pt" background-color="white">
															<xsl:value-of select="$ia_number"></xsl:value-of>
														</fo:block>
													</fo:table-cell>
												</fo:table-row>
											</fo:table-body>
										</xsl:otherwise>
									</xsl:choose>
								</fo:table>
								<fo:block text-align="center" font-size="9pt" color="black" background-color="white">
									<fo:page-number></fo:page-number>
								</fo:block>
							</fo:static-content>
							<fo:flow flow-name="xsl-region-body">
								<fo:block xsl:use-attribute-sets="hyphenation" id="descriptionSec">
									<xsl:attribute name="line-height">
										<xsl:choose>
											<xsl:when test="$lang='zh'">1.5</xsl:when>
											<xsl:otherwise>1.5</xsl:otherwise>
										</xsl:choose>
									</xsl:attribute>
									<xsl:apply-templates select="./*/description | ./*/doc-page"></xsl:apply-templates>
								</fo:block>
							</fo:flow>
						</fo:page-sequence>
					</xsl:when>
					<xsl:otherwise>
						<fo:page-sequence master-reference="description" force-page-count="no-force">
							<fo:static-content flow-name="xsl-region-before">
								<fo:table table-layout="fixed" width="{$without_margin_page_width}mm">
									<fo:table-column column-width="{$without_margin_page_width div 2}mm"></fo:table-column>
									<fo:table-column column-width="{$without_margin_page_width div 2}mm"></fo:table-column>
									<xsl:choose>
										<xsl:when test="//wo-application-body">
											<xsl:call-template name="docIaNumHeader"/>
										</xsl:when>
										<xsl:otherwise>
											<fo:table-body>
												<fo:table-row>
													<fo:table-cell>
														<fo:block text-align="left" font-size="10pt" background-color="white">
															<xsl:if test="not(./*/description/doc-page)">
																<xsl:value-of select="./*/@file-reference-id"></xsl:value-of>
															</xsl:if>
														</fo:block>
													</fo:table-cell>
													<fo:table-cell>
														<fo:block text-align="right" font-size="10pt" background-color="white">
															<xsl:value-of select="$ia_number"></xsl:value-of>
														</fo:block>
													</fo:table-cell>
												</fo:table-row>
											</fo:table-body>
										</xsl:otherwise>
									</xsl:choose>
								</fo:table>
								<fo:block text-align="center" font-size="10pt" color="black" background-color="white">
									<fo:page-number></fo:page-number>
								</fo:block>
							</fo:static-content>
							<fo:flow flow-name="xsl-region-body">
								<fo:block xsl:use-attribute-sets="hyphenation" id="descriptionSec">
									<xsl:attribute name="line-height">
										<xsl:choose>
											<xsl:when test="$lang='zh'">2.0</xsl:when>
											<xsl:otherwise>1.5</xsl:otherwise>
										</xsl:choose>
									</xsl:attribute>
									<xsl:apply-templates select="./*/description | ./*/doc-page"></xsl:apply-templates>
								</fo:block>
							</fo:flow>
						</fo:page-sequence>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:if>
			<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'CLMS')">
				<xsl:if test="./*/claims">
					<xsl:choose>
						<xsl:when test="$lang='ja'">
							<fo:page-sequence master-reference="claims" force-page-count="no-force">
								<fo:static-content flow-name="xsl-region-before">
									<fo:table table-layout="fixed" width="{$without_margin_page_width}mm">
										<fo:table-column column-width="50%"></fo:table-column>
										<fo:table-column column-width="50%"></fo:table-column>
										<xsl:choose>
											<xsl:when test="//wo-application-body">
												<xsl:call-template name="docIaNumHeader"/>
											</xsl:when>
											<xsl:otherwise>
												<fo:table-body>
													<fo:table-row>
														<fo:table-cell>
															<fo:block text-align="left" font-size="10pt" background-color="white">
																<xsl:if test="not(./*/claims/doc-page)">
																	<xsl:value-of select="./*/@file-reference-id"></xsl:value-of>
																</xsl:if>
															</fo:block>
														</fo:table-cell>
														<fo:table-cell>
															<fo:block text-align="right" font-size="10pt" background-color="white">
																<xsl:value-of select="$ia_number"></xsl:value-of>
															</fo:block>
														</fo:table-cell>
													</fo:table-row>
												</fo:table-body>
											</xsl:otherwise>
										</xsl:choose>
									</fo:table>
									<fo:block> </fo:block>
									<fo:block text-align="center" font-size="10pt" color="black" background-color="white">
										<fo:page-number></fo:page-number>
									</fo:block>
								</fo:static-content>
								<fo:flow flow-name="xsl-region-body">
									<fo:block xsl:use-attribute-sets="hyphenation" id="claimSec" line-height="2.0">
										<xsl:apply-templates select="./*/claims"></xsl:apply-templates>
									</fo:block>
								</fo:flow>
							</fo:page-sequence>
						</xsl:when>
						<xsl:when test="$lang='ar'">
							<fo:page-sequence master-reference="claims" force-page-count="no-force">
								<fo:static-content flow-name="xsl-region-before">
									<fo:table table-layout="fixed" width="{$without_margin_page_width}mm">
										<fo:table-column column-width="50%"></fo:table-column>
										<fo:table-column column-width="50%"></fo:table-column>
										<fo:table-body>
											<fo:table-row>
												<fo:table-cell>
													<fo:block text-align="left" font-size="10pt" background-color="white">
														<xsl:if test="not(./*/claims/doc-page)">
															<xsl:value-of select="./*/@file-reference-id"></xsl:value-of>
														</xsl:if>
													</fo:block>
												</fo:table-cell>
												<fo:table-cell>
													<fo:block text-align="right" font-size="10pt" background-color="white">
														<xsl:value-of select="$ia_number"></xsl:value-of>
													</fo:block>
												</fo:table-cell>
											</fo:table-row>
										</fo:table-body>
									</fo:table>
									<fo:block text-align="center" font-size="10pt" color="black" background-color="white">
										<fo:page-number></fo:page-number>
									</fo:block>
								</fo:static-content>
								<fo:flow flow-name="xsl-region-body">
									<fo:block id="claimSec">
										<xsl:attribute name="line-height">1.5</xsl:attribute>
										<xsl:apply-templates select="./*/claims"></xsl:apply-templates>
									</fo:block>
								</fo:flow>
							</fo:page-sequence>
						</xsl:when>
						<xsl:when test="$lang='zh'">
							<fo:page-sequence master-reference="claims" force-page-count="no-force">
								<fo:static-content flow-name="xsl-region-before">
									<fo:table table-layout="fixed" width="{$without_margin_page_width}mm">
										<fo:table-column column-width="50%"></fo:table-column>
										<fo:table-column column-width="50%"></fo:table-column>
										<xsl:choose>
											<xsl:when test="//wo-application-body">
												<xsl:call-template name="docIaNumHeader"/>
											</xsl:when>
											<xsl:otherwise>
												<fo:table-body>
													<fo:table-row>
														<fo:table-cell>
															<fo:block text-align="left" font-size="9pt" background-color="white">
																<xsl:if test="not(./*/claims/doc-page)">
																	<xsl:value-of select="./*/@file-reference-id"></xsl:value-of>
																</xsl:if>
															</fo:block>
														</fo:table-cell>
														<fo:table-cell>
															<fo:block text-align="right" font-size="9pt" background-color="white">
																<xsl:value-of select="$ia_number"></xsl:value-of>
															</fo:block>
														</fo:table-cell>
													</fo:table-row>
												</fo:table-body>
											</xsl:otherwise>
										</xsl:choose>
									</fo:table>
									<fo:block text-align="center" font-size="9pt" color="black" background-color="white">
										<fo:page-number></fo:page-number>
									</fo:block>
								</fo:static-content>
								<fo:flow flow-name="xsl-region-body">
									<fo:block xsl:use-attribute-sets="hyphenation" id="claimSec">
										<xsl:attribute name="line-height">
											<xsl:choose>
												<xsl:when test="$lang='zh'">1.5</xsl:when>
												<xsl:otherwise>1.5</xsl:otherwise>
											</xsl:choose>
										</xsl:attribute>
										<xsl:apply-templates select="./*/claims"></xsl:apply-templates>
									</fo:block>
								</fo:flow>
							</fo:page-sequence>
						</xsl:when>
						<xsl:otherwise>
							<fo:page-sequence master-reference="claims" force-page-count="no-force">
								<fo:static-content flow-name="xsl-region-before">
									<fo:table table-layout="fixed" width="{$without_margin_page_width}mm">
										<fo:table-column column-width="50%"></fo:table-column>
										<fo:table-column column-width="50%"></fo:table-column>
										<xsl:choose>
											<xsl:when test="//wo-application-body">
												<xsl:call-template name="docIaNumHeader"/>
											</xsl:when>
											<xsl:otherwise>
												<fo:table-body>
													<fo:table-row>
														<fo:table-cell>
															<fo:block text-align="left" font-size="10pt" background-color="white">
																<xsl:if test="not(./*/claims/doc-page)">
																	<xsl:value-of select="./*/@file-reference-id"></xsl:value-of>
																</xsl:if>
															</fo:block>
														</fo:table-cell>
														<fo:table-cell>
															<fo:block text-align="right" font-size="10pt" background-color="white">
																<xsl:value-of select="$ia_number"></xsl:value-of>
															</fo:block>
														</fo:table-cell>
													</fo:table-row>
												</fo:table-body>
											</xsl:otherwise>
										</xsl:choose>
									</fo:table>
									<fo:block text-align="center" font-size="10pt" color="black" background-color="white">
										<fo:page-number></fo:page-number>
									</fo:block>
								</fo:static-content>
								<fo:flow flow-name="xsl-region-body">
									<fo:block xsl:use-attribute-sets="hyphenation" id="claimSec">
										<xsl:attribute name="line-height">
											<xsl:choose>
												<xsl:when test="$lang='zh'">2.0</xsl:when>
												<xsl:otherwise>1.5</xsl:otherwise>
											</xsl:choose>
										</xsl:attribute>
										<xsl:apply-templates select="./*/claims"></xsl:apply-templates>
									</fo:block>
								</fo:flow>
							</fo:page-sequence>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:if>
			</xsl:if>
			<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'AMD-CLMS')">
				<xsl:if test="./*/wo-amended-claims">
					<xsl:choose>
						<xsl:when test="$lang='ja'">
							<fo:page-sequence master-reference="wo-amended-claims" force-page-count="no-force">
								<fo:static-content flow-name="xsl-region-before">
									<fo:table table-layout="fixed" width="{$without_margin_page_width}mm">
										<fo:table-column column-width="50%"></fo:table-column>
										<fo:table-column column-width="50%"></fo:table-column>
										<xsl:call-template name="docIaNumHeader"/>
									</fo:table>
									<fo:block> </fo:block>
									<fo:block text-align="center" font-size="10pt" color="black" background-color="white">
										<fo:page-number></fo:page-number>
									</fo:block>
								</fo:static-content>
								<fo:flow flow-name="xsl-region-body">
									<fo:block xsl:use-attribute-sets="hyphenation" id="amd-claimSec" line-height="2.0">
										<xsl:apply-templates select="./*/wo-amended-claims"></xsl:apply-templates>
									</fo:block>
								</fo:flow>
							</fo:page-sequence>
						</xsl:when>
						<xsl:when test="$lang='zh'">
							<fo:page-sequence master-reference="wo-amended-claims" force-page-count="no-force">
								<fo:static-content flow-name="xsl-region-before">
									<fo:table table-layout="fixed" width="{$without_margin_page_width}mm">
										<fo:table-column column-width="50%"></fo:table-column>
										<fo:table-column column-width="50%"></fo:table-column>
										<xsl:call-template name="docIaNumHeader"/>
									</fo:table>
									<fo:block text-align="center" font-size="9pt" color="black" background-color="white">
										<fo:page-number></fo:page-number>
									</fo:block>
								</fo:static-content>
								<fo:flow flow-name="xsl-region-body">
									<fo:block xsl:use-attribute-sets="hyphenation" id="amd-claimSec">
										<xsl:attribute name="line-height">
											<xsl:choose>
												<xsl:when test="$lang='zh'">1.5</xsl:when>
												<xsl:otherwise>1.5</xsl:otherwise>
											</xsl:choose>
										</xsl:attribute>
										<xsl:apply-templates select="./*/wo-amended-claims"></xsl:apply-templates>
									</fo:block>
								</fo:flow>
							</fo:page-sequence>
						</xsl:when>
						<xsl:otherwise>
							<fo:page-sequence master-reference="wo-amended-claims" force-page-count="no-force">
								<fo:static-content flow-name="xsl-region-before">
									<fo:table table-layout="fixed" width="{$without_margin_page_width}mm">
										<fo:table-column column-width="50%"></fo:table-column>
										<fo:table-column column-width="50%"></fo:table-column>
										<xsl:call-template name="docIaNumHeader"/>
									</fo:table>
									<fo:block text-align="center" font-size="10pt" color="black" background-color="white">
										<fo:page-number></fo:page-number>
									</fo:block>
								</fo:static-content>
								<fo:flow flow-name="xsl-region-body">
									<fo:block xsl:use-attribute-sets="hyphenation" id="amd-claimSec">
										<xsl:attribute name="line-height">
											<xsl:choose>
												<xsl:when test="$lang='zh'">2.0</xsl:when>
												<xsl:otherwise>1.5</xsl:otherwise>
											</xsl:choose>
										</xsl:attribute>
										<xsl:apply-templates select="./*/wo-amended-claims"></xsl:apply-templates>
									</fo:block>
								</fo:flow>
							</fo:page-sequence>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:if>
			</xsl:if>
			<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'ABST')">
				<xsl:if test="./*/abstract">
					<xsl:choose>
						<xsl:when test="$lang='ja'">
							<fo:page-sequence master-reference="abstract" force-page-count="no-force">
								<fo:static-content flow-name="xsl-region-before">
									<fo:table table-layout="fixed" width="{$without_margin_page_width}mm">
										<fo:table-column column-width="50%"></fo:table-column>
										<fo:table-column column-width="50%"></fo:table-column>
										<xsl:choose>
											<xsl:when test="//wo-application-body">
												<xsl:call-template name="docIaNumHeader"/>
											</xsl:when>
											<xsl:otherwise>
												<fo:table-body>
													<fo:table-row>
														<fo:table-cell>
															<fo:block text-align="left" font-size="10pt" background-color="white">
																<xsl:if test="not(./*/claims/doc-page)">
																	<xsl:value-of select="./*/@file-reference-id"></xsl:value-of>
																</xsl:if>
															</fo:block>
														</fo:table-cell>
														<fo:table-cell>
															<fo:block text-align="right" font-size="10pt" background-color="white">
																<xsl:value-of select="$ia_number"></xsl:value-of>
															</fo:block>
														</fo:table-cell>
													</fo:table-row>
												</fo:table-body>
											</xsl:otherwise>
										</xsl:choose>
									</fo:table>
									<fo:block> </fo:block>
									<fo:block text-align="center" font-size="10pt" color="black" background-color="white">
										<fo:page-number></fo:page-number>
									</fo:block>
								</fo:static-content>
								<fo:flow flow-name="xsl-region-body">
									<fo:block xsl:use-attribute-sets="hyphenation" id="abstractSec" line-height="2.0">
										<xsl:apply-templates select="./*/abstract"></xsl:apply-templates>
									</fo:block>
								</fo:flow>
							</fo:page-sequence>
						</xsl:when>
						<xsl:when test="$lang='ar'">
							<fo:page-sequence master-reference="abstract" force-page-count="no-force">
								<fo:static-content flow-name="xsl-region-before">
									<fo:table table-layout="fixed" width="{$without_margin_page_width}mm">
										<fo:table-column column-width="50%"></fo:table-column>
										<fo:table-column column-width="50%"></fo:table-column>
										<fo:table-body>
											<fo:table-row>
												<fo:table-cell>
													<fo:block text-align="left" font-size="10pt" background-color="white">
														<xsl:if test="not(./*/claims/doc-page)">
															<xsl:value-of select="./*/@file-reference-id"></xsl:value-of>
														</xsl:if>
													</fo:block>
												</fo:table-cell>
												<fo:table-cell>
													<fo:block text-align="right" font-size="10pt" background-color="white">
														<xsl:value-of select="$ia_number"></xsl:value-of>
													</fo:block>
												</fo:table-cell>
											</fo:table-row>
										</fo:table-body>
									</fo:table>
									<fo:block text-align="center" font-size="10pt" color="black" background-color="white">
										<fo:page-number></fo:page-number>
									</fo:block>
								</fo:static-content>
								<fo:flow flow-name="xsl-region-body">
									<fo:block id="abstractSec">
										<xsl:attribute name="line-height">1.5</xsl:attribute>
										<xsl:apply-templates select="./*/abstract"></xsl:apply-templates>
									</fo:block>
								</fo:flow>
							</fo:page-sequence>
						</xsl:when>
						<xsl:when test="$lang='zh'">
							<fo:page-sequence master-reference="abstract" force-page-count="no-force">
								<fo:static-content flow-name="xsl-region-before">
									<fo:table table-layout="fixed" width="{$without_margin_page_width}mm">
										<fo:table-column column-width="50%"></fo:table-column>
										<fo:table-column column-width="50%"></fo:table-column>
										<xsl:choose>
											<xsl:when test="//wo-application-body">
												<xsl:call-template name="docIaNumHeader"/>
											</xsl:when>
											<xsl:otherwise>
												<fo:table-body>
													<fo:table-row>
														<fo:table-cell>
															<fo:block text-align="left" font-size="9pt" background-color="white">
																<xsl:if test="not(./*/claims/doc-page)">
																	<xsl:value-of select="./*/@file-reference-id"></xsl:value-of>
																</xsl:if>
															</fo:block>
														</fo:table-cell>
														<fo:table-cell>
															<fo:block text-align="right" font-size="9pt" background-color="white">
																<xsl:value-of select="$ia_number"></xsl:value-of>
															</fo:block>
														</fo:table-cell>
													</fo:table-row>
												</fo:table-body>
											</xsl:otherwise>
										</xsl:choose>
									</fo:table>
									<fo:block text-align="center" font-size="9pt" color="black" background-color="white">
										<fo:page-number></fo:page-number>
									</fo:block>
								</fo:static-content>
								<fo:flow flow-name="xsl-region-body">
									<fo:block xsl:use-attribute-sets="hyphenation" id="abstractSec">
										<xsl:attribute name="line-height">
											<xsl:choose>
												<xsl:when test="$lang='zh'">1.5</xsl:when>
												<xsl:otherwise>1.5</xsl:otherwise>
											</xsl:choose>
										</xsl:attribute>
										<xsl:apply-templates select="./*/abstract"></xsl:apply-templates>
									</fo:block>
								</fo:flow>
							</fo:page-sequence>
						</xsl:when>
						<xsl:otherwise>
							<fo:page-sequence master-reference="abstract" force-page-count="no-force">
								<fo:static-content flow-name="xsl-region-before">
									<fo:table table-layout="fixed" width="{$without_margin_page_width}mm">
										<fo:table-column column-width="50%"></fo:table-column>
										<fo:table-column column-width="50%"></fo:table-column>
										<xsl:choose>
											<xsl:when test="//wo-application-body">
												<xsl:call-template name="docIaNumHeader"/>
											</xsl:when>
											<xsl:otherwise>
												<fo:table-body>
													<fo:table-row>
														<fo:table-cell>
															<fo:block text-align="left" font-size="10pt" background-color="white">
																<xsl:if test="not(./*/claims/doc-page)">
																	<xsl:value-of select="./*/@file-reference-id"></xsl:value-of>
																</xsl:if>
															</fo:block>
														</fo:table-cell>
														<fo:table-cell>
															<fo:block text-align="right" font-size="10pt" background-color="white">
																<xsl:value-of select="$ia_number"></xsl:value-of>
															</fo:block>
														</fo:table-cell>
													</fo:table-row>
												</fo:table-body>
											</xsl:otherwise>
										</xsl:choose>
									</fo:table>
									<fo:block text-align="center" font-size="10pt" color="black" background-color="white">
										<fo:page-number></fo:page-number>
									</fo:block>
								</fo:static-content>
								<fo:flow flow-name="xsl-region-body">
									<fo:block xsl:use-attribute-sets="hyphenation" id="abstractSec">
										<xsl:attribute name="line-height">
											<xsl:choose>
												<xsl:when test="$lang='zh'">2.0</xsl:when>
												<xsl:otherwise>1.5</xsl:otherwise>
											</xsl:choose>
										</xsl:attribute>
										<xsl:apply-templates select="./*/abstract"></xsl:apply-templates>
									</fo:block>
								</fo:flow>
							</fo:page-sequence>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:if> 
			</xsl:if>
			<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'DRAW')">
				<xsl:if test="./*/drawings">
					<fo:page-sequence master-reference="drawings" initial-page-number="1" force-page-count="no-force">
						<xsl:choose>
						<xsl:when test="$lang='zh'">
						<fo:static-content flow-name="xsl-region-before">
							<fo:table table-layout="fixed" width="{$without_margin_page_width}mm">
								<fo:table-column column-width="50%"></fo:table-column>
								<fo:table-column column-width="50%"></fo:table-column>
								<xsl:choose>
									<xsl:when test="//wo-application-body">
										<xsl:call-template name="docIaNumHeader"/>
									</xsl:when>
									<xsl:otherwise>
										<fo:table-body>
											<fo:table-row>
												<fo:table-cell>
													<fo:block text-align="left" font-size="9pt" background-color="white">
														<xsl:if test="not(./*/drawings/doc-page)">
															<xsl:value-of select="./*/@file-reference-id"></xsl:value-of>
														</xsl:if>
													</fo:block>
												</fo:table-cell>
												<fo:table-cell>
													<fo:block text-align="right" font-size="9pt" background-color="white">
														<xsl:value-of select="$ia_number"></xsl:value-of>
													</fo:block>
												</fo:table-cell>
											</fo:table-row>
										</fo:table-body>
									</xsl:otherwise>
								</xsl:choose>
							</fo:table>
							<fo:block text-align="center" font-size="9pt" color="black" background-color="white"> 
								<fo:page-number></fo:page-number>/<fo:page-number-citation ref-id="endOfDrawingsDoc"></fo:page-number-citation>
							</fo:block>
						</fo:static-content>
						</xsl:when>
						<xsl:otherwise>
						<fo:static-content flow-name="xsl-region-before">
							<fo:table table-layout="fixed" width="{$without_margin_page_width}mm">
								<fo:table-column column-width="50%"></fo:table-column>
								<fo:table-column column-width="50%"></fo:table-column>
								<xsl:choose>
									<xsl:when test="//wo-application-body">
										<xsl:call-template name="docIaNumHeader"/>
									</xsl:when>
									<xsl:otherwise>
										<fo:table-body>
											<fo:table-row>
												<fo:table-cell>
													<fo:block text-align="left" font-size="10pt" background-color="white">
														<xsl:if test="not(./*/drawings/doc-page)">
															<xsl:value-of select="./*/@file-reference-id"></xsl:value-of>
														</xsl:if>
													</fo:block>
												</fo:table-cell>
												<fo:table-cell>
													<fo:block text-align="right" font-size="10pt" background-color="white">
														<xsl:value-of select="$ia_number"></xsl:value-of>
													</fo:block>
												</fo:table-cell>
											</fo:table-row>
										</fo:table-body>
									</xsl:otherwise>
								</xsl:choose>
							</fo:table>
							<fo:block text-align="center" font-size="10pt" color="black" background-color="white"> 
								<fo:page-number></fo:page-number>/<fo:page-number-citation ref-id="endOfDrawingsDoc"></fo:page-number-citation>
							</fo:block>
						</fo:static-content>
						</xsl:otherwise>
						</xsl:choose>
						<fo:flow flow-name="xsl-region-body">
							<fo:block id="drawingSec"></fo:block>
							<xsl:apply-templates select="./*/drawings"></xsl:apply-templates>
							<fo:block id="endOfDrawingsDoc"></fo:block>
						</fo:flow>
					</fo:page-sequence>
				</xsl:if>
			</xsl:if>
		</fo:root>   
	</xsl:template>
	<!-- 
     *********************************************************************
     *  DEFINE COMMON FORMATTING ATTRIBUTE SETS                          *
     *********************************************************************-->
	   
	<xsl:attribute-set name="main_headings">      
		<xsl:attribute name="font-family"><xsl:value-of select="$serif_font"/></xsl:attribute>
		<xsl:attribute name="font-size">
			<xsl:choose>
				<xsl:when test="$lang='ja'">14pt</xsl:when>
				<xsl:when test="$lang='zh'">16pt</xsl:when>
				<xsl:otherwise>18pt</xsl:otherwise>
			</xsl:choose>  
		</xsl:attribute>
		<xsl:attribute name="font-weight">bold</xsl:attribute>      
		<xsl:attribute name="color">black</xsl:attribute>      
		<xsl:attribute name="text-align">center</xsl:attribute>   
	</xsl:attribute-set>   
	<xsl:attribute-set name="sub_headings">      
		<xsl:attribute name="font-family"><xsl:value-of select="$serif_font"/></xsl:attribute>
		<xsl:attribute name="font-size">
			<xsl:choose>
				<xsl:when test="$lang='ar'">18pt</xsl:when>
				<xsl:when test="$lang='zh'">12pt</xsl:when>
				<xsl:otherwise>14pt</xsl:otherwise>
			</xsl:choose>  
		</xsl:attribute>
		<xsl:attribute name="font-weight">bold</xsl:attribute>      
		<xsl:attribute name="color">black</xsl:attribute> 
		<xsl:attribute name="text-indent">
		<xsl:choose>				
			<xsl:when test="$lang='zh'">0mm</xsl:when>
			<xsl:otherwise>15mm</xsl:otherwise>
		</xsl:choose>  		
		</xsl:attribute>      
		<xsl:attribute name="text-align">
			<xsl:choose>
				<xsl:when test="$lang='ja'">left</xsl:when>
				<xsl:otherwise>start</xsl:otherwise>
			</xsl:choose>
		</xsl:attribute>   
	</xsl:attribute-set>   
	<xsl:attribute-set name="headings">      
		<xsl:attribute name="font-family"><xsl:value-of select="$serif_font"/></xsl:attribute>
		<xsl:attribute name="font-weight">bold</xsl:attribute>      
		<xsl:attribute name="color">black</xsl:attribute>       
		<xsl:attribute name="text-align">
			<xsl:choose>
				<xsl:when test="$lang='ar'">start</xsl:when>
				<xsl:otherwise>left</xsl:otherwise>
			</xsl:choose>  
		</xsl:attribute>
		<xsl:attribute name="text-indent">
		<xsl:choose>				
			<xsl:when test="$lang='zh'">0mm</xsl:when>
			<xsl:otherwise>15mm</xsl:otherwise>
		</xsl:choose> 
		</xsl:attribute>   
	</xsl:attribute-set>
	<!-- NOTE: hyphenation scheme is dependent upon language -->
	   
	<xsl:attribute-set name="hyphenation">      
		<xsl:attribute name="language">
			<xsl:value-of select="$lang"></xsl:value-of>
		</xsl:attribute>      
		<xsl:attribute name="hyphenate">
			<xsl:choose>
				<xsl:when test="$lang='ar' or $lang='ja' or $lang='zh' or $lang='ko'">false</xsl:when>
				<xsl:otherwise>true</xsl:otherwise>
			</xsl:choose>
		</xsl:attribute>    
		<xsl:attribute name="hyphenation-push-character-count">8</xsl:attribute>      
		<xsl:attribute name="hyphenation-remain-character-count">2</xsl:attribute>   
	</xsl:attribute-set>

	<xsl:attribute-set name="pre">
		<xsl:attribute name="text-align">left</xsl:attribute>
		<xsl:attribute name="font-family"><xsl:value-of select="$monospace_font" /></xsl:attribute>
		<xsl:attribute name="white-space">pre</xsl:attribute>
		<xsl:attribute name="space-before">1em</xsl:attribute>
		<xsl:attribute name="space-after">1em</xsl:attribute>
		<xsl:attribute name="line-height">100%</xsl:attribute>
		<xsl:attribute name="wrap-option">wrap</xsl:attribute>
	</xsl:attribute-set>

	<xsl:attribute-set name="rule_change">
		<xsl:attribute name="font-size">8pt</xsl:attribute>
		<xsl:attribute name="font-weight">bold</xsl:attribute>
		<xsl:attribute name="margin-left">1mm</xsl:attribute>
		<xsl:attribute name="text-indent">0mm</xsl:attribute>
		<xsl:attribute name="text-align">left</xsl:attribute>
		<xsl:attribute name="line-height">1.5</xsl:attribute>
	</xsl:attribute-set>

	<!-- *********************************************************************
     *  GENERATE SECTION HEADINGS, ANCHORS FOR CROSS-REFERENCES          *
     *********************************************************************-->
	   
	<xsl:template match="description">
		<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'DESC')">
			<fo:block xsl:use-attribute-sets="main_headings" id="{@id}">
				<xsl:if test="not( contains( $fop_version, '0.2') ) and ( $fop_version != '' )">
					<xsl:attribute name="width">
						<xsl:value-of select="$page_width - 46.5"></xsl:value-of>mm
					</xsl:attribute>
					<xsl:attribute name="margin-right">1.5mm</xsl:attribute>
				</xsl:if>
				<xsl:if test="not(./doc-page)">
					<xsl:call-template name="description_ChoiceText"></xsl:call-template>
				</xsl:if>
			</fo:block>
			<xsl:apply-templates></xsl:apply-templates>
		</xsl:if>
	</xsl:template>
	<xsl:template match="claims">
		 <xsl:if test="($rendering_mode = '') or ($rendering_mode = 'CLMS')">
			<fo:block xsl:use-attribute-sets="main_headings" id="{@id}"  keep-with-next.within-page="always">
				<xsl:if test="not( contains( $fop_version, '0.2') ) and ( $fop_version != '' )">
					<xsl:attribute name="width">
						<xsl:value-of select="$page_width - 46.5"></xsl:value-of>mm
					</xsl:attribute>
					<xsl:attribute name="margin-right">1.5mm</xsl:attribute>
				</xsl:if>
				<xsl:if test="not(./doc-page) and not(parent::amend-body)">
					<xsl:call-template name="claim_ChoiceText"></xsl:call-template>
				</xsl:if>
			</fo:block>
			<xsl:apply-templates></xsl:apply-templates>
		</xsl:if> 
	</xsl:template>
	
	<!-- Added -->
	<xsl:template match="wo-amended-claims">
		<xsl:param name="idforsearch">
			<xsl:value-of select="@id"/>
		</xsl:param>
		<xsl:param name="insertdate">
			<xsl:choose>
				<xsl:when test="/wo-application-body/wo-body-changes/wo-body-change[wo-body-change-object/@posref = $idforsearch]/@received-date">
					<xsl:value-of select="/wo-application-body/wo-body-changes/wo-body-change[wo-body-change-object/@posref = $idforsearch]/@received-date"></xsl:value-of>
				</xsl:when>
				<xsl:otherwise>
					<xsl:variable name="status_date" select="normalize-space(translate(@status,'/\.,-',''))"></xsl:variable>
					<xsl:value-of select="substring($status_date, 5,4)"></xsl:value-of>
					<xsl:text>.</xsl:text>
					<xsl:value-of select="substring($status_date, 3,2)"></xsl:value-of>
					<xsl:text>.</xsl:text>
					<xsl:value-of select="substring($status_date, 1,2)"></xsl:value-of>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:param>
		<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'AMD-CLMS')">
			<fo:block xsl:use-attribute-sets="main_headings" id="{@id}">
				<xsl:if test="not(.//doc-page)">
					<fo:inline>
						<xsl:call-template name="amended_claims_ChoiceText"></xsl:call-template>
						<fo:block></fo:block>
			<!--  different date presentation by language. Copied from description.xsl in eDossier -->
			<xsl:choose>
				<xsl:when test="$lang='ja'">
					<xsl:value-of select="substring(@status,7,4)" />
					<xsl:call-template name="year_ChoiceText"/>
					<xsl:value-of select="number(substring(@status,4,2))" />
					<xsl:call-template name="month_ChoiceText"/>
					<xsl:value-of select="number(substring(@status,1,2))" />
					<xsl:call-template name="day_ChoiceText"/>
					(
					<xsl:value-of select="@status" />
					) <xsl:call-template name="rec_ib_ChoiceText"/>
				</xsl:when>
				<xsl:when test="$lang='zh'">
					<xsl:call-template name="rec_ib_ChoiceText"/>

					<xsl:value-of select="substring(@status,7,4)" />
					<xsl:call-template name="year_ChoiceText"/>
					<xsl:value-of select="number(substring(@status,4,2))" />
					<xsl:call-template name="month_ChoiceText"/>
					<xsl:value-of select="number(substring(@status,1,2))" />
					<xsl:call-template name="day_ChoiceText"/> 
					(<xsl:value-of select="@status" />)
				</xsl:when>
				<xsl:when test="$lang='ko'">
					<xsl:call-template name="rec_ib_ChoiceText"/>

					<xsl:value-of select="substring(@status,7,4)" />
					<xsl:call-template name="year_ChoiceText"/>
					<xsl:value-of select="number(substring(@status,4,2))" />
					<xsl:call-template name="month_ChoiceText"/>
					<xsl:value-of select="number(substring(@status,1,2))" />
					<xsl:call-template name="day_ChoiceText"/> 
					(<xsl:value-of select="@status" />)
				</xsl:when>
				<xsl:otherwise>
					<xsl:call-template name="rec_ib_ChoiceText"/>

					<xsl:call-template name="format_date">  
						<xsl:with-param name="date" select="normalize-space(concat(substring(@status,7,4),substring(@status,4,2),substring(@status,1,2)))"/>                     
						<xsl:with-param name="text" select="1"/>
						<xsl:with-param name="show_date" select="1"/>                         
						<xsl:with-param name="lang" select="$lang"/>                  
					</xsl:call-template> 
					(<xsl:value-of select="@status" />)
				</xsl:otherwise>
			</xsl:choose>
					</fo:inline>
				</xsl:if>
			</fo:block>
			<xsl:apply-templates select="amend-body"></xsl:apply-templates>
			<xsl:if test="amend-statement">
				<fo:block break-before="page"></fo:block>
				<xsl:apply-templates select="amend-statement"></xsl:apply-templates>
			</xsl:if>
		</xsl:if>
	</xsl:template>
	<xsl:template match="amend-statement">
		<fo:block xsl:use-attribute-sets="main_headings" id="{@id}" font-weight="bold">
			<xsl:call-template name="state19_1_ChoiceText"/>
		</fo:block>
		<xsl:apply-templates></xsl:apply-templates>
	</xsl:template>
	<xsl:template match="amend-body">
		<xsl:apply-templates></xsl:apply-templates>
	</xsl:template>
	<xsl:template match="abstract">
		<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'ABST')">
			<fo:block xsl:use-attribute-sets="main_headings" id="{@id}">
				<xsl:if test="not( contains( $fop_version, '0.2') ) and ( $fop_version != '' )">
					<xsl:attribute name="width">
						<xsl:value-of select="$page_width - 46.5"></xsl:value-of>mm
					</xsl:attribute>
					<xsl:attribute name="margin-right">1.5mm</xsl:attribute>
				</xsl:if>
				<xsl:if test="not(./doc-page)">
					<xsl:call-template name="abstract_ChoiceText"></xsl:call-template>
				</xsl:if>
			</fo:block>
			<xsl:apply-templates></xsl:apply-templates>
		</xsl:if>
	</xsl:template>
	<xsl:template match="drawings">
		<xsl:if test="($rendering_mode = '') or ($rendering_mode = 'DRAW')">
			<xsl:apply-templates></xsl:apply-templates>
		</xsl:if>
	</xsl:template>
	<!-- *********************************************************************
     *  GENERATE HEADINGS FOR SECTIONS WITHOUT THEM, CROSS-REFERENCES    *
     *********************************************************************
     * sub-headings; each is tested for presence of a <heading>; if one  *
     * is present, that will be used, otherwise the generic heading will *
     * be generated                                                      *
     *********************************************************************
-->

	<xsl:template match="technical-field | background-art | disclosure | summary-of-invention | description-of-drawings | description-of-embodiments | best-mode | mode-for-invention | industrial-applicability | reference-signs-list | reference-to-deposited-biological-material | sequence-list-text | citation-list | tech-problem | tech-solution | advantageous-effects | embodiments-example | patent-literature | non-patent-literature ">
		<xsl:variable name="xmlTag" select="name(.)"></xsl:variable>
		<xsl:variable name="xmlHeading" select="heading[1]"></xsl:variable>
		
		<xsl:variable name="preDefinedText">
			<xsl:call-template name="preDefinedTextByTagName">
				<xsl:with-param name="tagName" select="$xmlTag"></xsl:with-param>
			</xsl:call-template>
		</xsl:variable>
		
		<xsl:variable name="addOnText">
			<xsl:choose>
				<xsl:when test="'mode-for-invention'=name(.) and (./@mode-num) !=''">
					<xsl:value-of select="@mode-num"></xsl:value-of>
				</xsl:when>
				<xsl:when test="'embodiments-example'= name(.) and (./@ex-num) !=''">
					<xsl:value-of select="@ex-num"></xsl:value-of>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="''"></xsl:value-of>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
	
		<xsl:variable name="textComparison">
			<xsl:call-template name="stringComparison">
				<xsl:with-param name="text1" select="$preDefinedText"></xsl:with-param>
				<xsl:with-param name="text2" select="$xmlHeading"></xsl:with-param>
				<xsl:with-param name="isCaseSensitive" select="'false'"></xsl:with-param>
			</xsl:call-template>
		</xsl:variable>

		<xsl:variable name="textComparison2">
			<xsl:choose>
				<xsl:when test="($lang = 'en') and ($xmlTag = 'technical-field' or $xmlTag = 'background-art' or $xmlTag = 'summary-of-invention')">
					<xsl:call-template name="stringComparison">
						<xsl:with-param name="text1">
							<xsl:choose>
								<xsl:when test="$xmlTag = 'technical-field'">
									<xsl:value-of select="'Field'"></xsl:value-of>
								</xsl:when>
								<xsl:when test="$xmlTag = 'background-art'">
									<xsl:value-of select="'Background'"></xsl:value-of>
								</xsl:when>
								<xsl:when test="$xmlTag = 'summary-of-invention'">
									<xsl:value-of select="'Summary'"></xsl:value-of>
								</xsl:when>
							</xsl:choose>
						</xsl:with-param>
						<xsl:with-param name="text2" select="$xmlHeading"></xsl:with-param>
						<xsl:with-param name="isCaseSensitive" select="'false'"></xsl:with-param>
					</xsl:call-template>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="'1'"></xsl:value-of>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>	

		<!-- 
			27.09.2018: introduce the level attribute to indicate that the text content in heading element should replace its CAF heading
			From: <xsl:if test="(($textComparison = '1') and ($textComparison2 = '1')">
			To:   <xsl:if test="($textComparison = '1') and ($textComparison2 = '1') and not($xmlHeading/@level)">
		-->
		<xsl:if test="($textComparison = '1') and ($textComparison2 = '1') and not($xmlHeading/@level)">
			<fo:block xsl:use-attribute-sets="sub_headings" id="{@id}">
				<xsl:value-of select="$preDefinedText"></xsl:value-of>
				<xsl:if test="$addOnText and not(''= $addOnText)">
					<xsl:value-of select="concat('', ' ',$addOnText)"></xsl:value-of>
				</xsl:if>
			</fo:block>
		</xsl:if>

		<xsl:apply-templates></xsl:apply-templates>
	</xsl:template>
	
	<xsl:template match="heading//text() | p//text() | claim-text//text() | invention-title//text() | table//text()">
		<xsl:choose>
			<!-- If legacy FOP is used, render it as it is. -->
			<xsl:when test="contains( $fop_version, '0.2') or ( $fop_version = '' )">
				<xsl:value-of select="."></xsl:value-of>
			</xsl:when>
			<!-- When using hyphenation, render it while replacing nbsp with normal spaces. -->
			<xsl:when test="($lang='de' or $lang='en' or $lang='es' or $lang='fr' or $lang='pt' or $lang='ru') and (not(ancestor::table) or ancestor::li)">
				<xsl:variable name="rule_residals">
					<xsl:choose>
						<xsl:when test="//wo-application-body">
							<xsl:call-template name="get_rule_text_residal">
								<xsl:with-param name="target" select="translate(.,' ',' ')"></xsl:with-param>
							</xsl:call-template>
						</xsl:when>
						<xsl:otherwise>
							<xsl:value-of select="translate(.,' ',' ')"/>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:variable>
				<xsl:value-of select="$rule_residals"></xsl:value-of>
			</xsl:when>
			<!-- Here after the logic of text indent for FOP1.1 because somehow hyphenation does not work in FOP1.1 -->
			<!-- Insert zero width space for each len_token characters if the len_token characters do not contain any space. -->
			<xsl:otherwise>
				<!-- When not Japanese, replace nbsp with normal space in the texts of description, claims, and title -->
				<xsl:variable name="self_value">
					<xsl:choose>
						<xsl:when test="$lang='ja'">
							<xsl:value-of select="."/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:value-of select="translate(.,' ',' ')"/>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:variable>
				<xsl:variable name="rule_residals">
					<xsl:choose>
						<xsl:when test="//wo-application-body">
							<xsl:call-template name="get_rule_text_residal">
								<xsl:with-param name="target" select="$self_value"></xsl:with-param>
							</xsl:call-template>
						</xsl:when>
						<xsl:otherwise>
							<xsl:value-of select="$self_value"/>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:variable>
				<!-- If text is too long, render it as it is because a deep recursive might cause a StackOverFlow. -->
				<xsl:call-template name="processRuleResidals">
					<xsl:with-param name="rule_residals" select="$rule_residals"/>
				</xsl:call-template>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="processRuleResidals">
		<xsl:param name="rule_residals"/>

		<!-- If text is too long, split into chunks because a deep recursive might cause a StackOverFlow. -->
		<xsl:variable name="chunk_size" select="500"/>
		<xsl:variable name="chunk" select="substring($rule_residals, 1, $chunk_size)"/>
		<xsl:variable name="remaining" select="substring($rule_residals, $chunk_size + 1)"/>

		<!-- Call the existing template for the first chunk -->
		<xsl:call-template name="insertZeroWidthSpace">
			<xsl:with-param name="text" select="$chunk"/>
			<xsl:with-param name="len_token">
				<!--Set appropriate len_token chars.
				In the worst case, non-space continues for 2 * $len_token -1 chars. paragraphs should contain them.-->
				<xsl:choose>
					<!-- if this text node is a table cell, set len_token to 3, while avoiding overflowing, use hyphenation as much as possible -->
					<xsl:when test="ancestor::entry and not(ancestor::li)">3</xsl:when>
					<!-- For Arabic, set len_token to 80 becaue ZWSP affects the appearance -->
					<xsl:when test="$lang='ar'">80</xsl:when>
					<!-- Otherwise, insert a zero width space every 1 chars when FOP2.X or 20 chars when FOP1.1. -->
					<xsl:when test="not ( contains( $fop_version, '1.1') ) and not ( contains( $fop_version, '0.2') ) and ( $fop_version != '' )">1</xsl:when>
					<xsl:otherwise>20</xsl:otherwise>
				</xsl:choose>
			</xsl:with-param>
			<!-- Set a node inserted as Zero Width SPace.
				When fop is v2.X, nomal zero width space does not work as word break in Korean texts.
				So insert fo:inline additionally.
			-->
			<xsl:with-param name="zwsp">
				<xsl:choose>
					<xsl:when test="contains( $fop_version, '1.1') or contains( $fop_version, '0.2') or ( $fop_version = '' )">
						<xsl:text>​</xsl:text>
					</xsl:when>
					<xsl:when test="ancestor::table and not(ancestor::entry)"></xsl:when>
					<xsl:when test="translate( normalize-space($rule_residals) , ' ', '') = ''"></xsl:when>
					<xsl:otherwise>
						<xsl:text>​</xsl:text><fo:inline></fo:inline>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:with-param>
		</xsl:call-template>

		<xsl:if test="(string-length($rule_residals) &gt; $chunk_size) and (string-length($remaining) &gt; 0)">
			<!-- Process remaining text recursively -->
			<xsl:call-template name="processRuleResidals">
				<xsl:with-param name="rule_residals" select="$remaining"/>
			</xsl:call-template>
		</xsl:if>
	</xsl:template>
	<xsl:template name="docIaNumHeader" xml:space="preserve">
		<fo:table-body>
			<fo:table-row>
			<xsl:choose>				
			<xsl:when test="$lang='zh'">
				<fo:table-cell>
					<fo:block text-align="left" font-size="9pt" background-color="white">
						<xsl:value-of select="$country_code"></xsl:value-of>
						<xsl:value-of select="$doc_number"></xsl:value-of>
					</fo:block>
				</fo:table-cell>
				<fo:table-cell>
					<fo:block text-align="right" font-size="9pt" background-color="white">
						<xsl:value-of select="$ia_number"></xsl:value-of>
					</fo:block>
				</fo:table-cell>
			</xsl:when>
			<xsl:otherwise>
				<fo:table-cell>
					<fo:block text-align="left" font-size="10pt" background-color="white">
						<xsl:value-of select="$country_code"></xsl:value-of>
						<xsl:value-of select="$doc_number"></xsl:value-of>
					</fo:block>
				</fo:table-cell>
				<fo:table-cell>
					<fo:block text-align="right" font-size="10pt" background-color="white">
						<xsl:value-of select="$ia_number"></xsl:value-of>
					</fo:block>
				</fo:table-cell>
			</xsl:otherwise>
			</xsl:choose> 
			</fo:table-row>
		</fo:table-body>
	</xsl:template>
	<xsl:template name="insertZeroWidthSpace">
		<!-- Insert zero width space into every len_token characters if the previous len_token characters do not contain any space. -->
		<xsl:param name="text"></xsl:param>
		<xsl:param name="len_token" select="1"></xsl:param>
		<xsl:param name="start_pos" select="1"></xsl:param>
		<xsl:param name="zwsp" select="'​'"></xsl:param>

		<xsl:variable name="token" select="substring($text,$start_pos,$len_token)"></xsl:variable>
		<!-- Get the next character after the current token -->
		<xsl:variable name="current_char" select="substring($text, $start_pos, 1)"/>
		<xsl:variable name="next_char" select="substring($text, $start_pos + $len_token, 1)"/>

		<xsl:if test="$token != ''">
			<xsl:variable name="next_pos">
				<xsl:choose>
					<xsl:when test="contains($token, '-')">
						<xsl:value-of select="$start_pos + string-length(substring-before($token, '-')) + 1"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="$start_pos + $len_token"/>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:variable>

			<xsl:choose>
				<xsl:when test="contains($token, '-')">
					<xsl:value-of select="substring-before($token, '-')"/>
					<xsl:value-of select="'-'"/>
					<!-- If token does not contain a space, insert zero width space -->
					<xsl:if test="not(contains(substring-before($token, '-'), ' '))">
						<xsl:copy-of select="$zwsp"/>
					</xsl:if>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="$token"/>
					<!-- To follow the punctuation rules, insert zwsp into proper positions -->
					<xsl:if test="$current_char != '(' and $current_char != '（' and $current_char != '“' and $current_char != '《' and $current_char != '≪'">
						<xsl:if test='$next_char != "&apos;"'>
							<xsl:if test="$next_char != '&quot;' and $next_char != '”' and $next_char != '’' and $next_char != '.' and $next_char != '．' and $next_char != '。' and $next_char != '?' and $next_char != '？' and $next_char != '!' and $next_char != '！' and $next_char != ',' and $next_char != '，' and $next_char != '、' and $next_char != ';' and $next_char != '；' and $next_char != ':' and $next_char != '：' and $next_char != ')' and $next_char != '）' and $next_char != '》' and $next_char != '≫' and $next_char != '%' and $next_char != '％' and $next_char != ' ' and $next_char != ''">
								<xsl:copy-of select="$zwsp"/>
							</xsl:if>
						</xsl:if>
					</xsl:if>
				</xsl:otherwise>
			</xsl:choose>

			<xsl:call-template name="insertZeroWidthSpace">
				<xsl:with-param name="text" select="$text"/>
				<xsl:with-param name="len_token" select="$len_token"/>
				<xsl:with-param name="start_pos" select="$next_pos"/>
				<xsl:with-param name="zwsp" select="$zwsp"/>
			</xsl:call-template>
		</xsl:if>
	</xsl:template>
	<xsl:template name="preDefinedTextByTagName">
		<xsl:param name="tagName"></xsl:param>
		<xsl:variable name="tagVal">
			<xsl:choose>
				<!-- START OF 'DESCRIPTION' -->
				<xsl:when test="'description'=$tagName">
					<xsl:call-template name="description_ChoiceText"></xsl:call-template>
				</xsl:when>
				<xsl:when test="'invention-title'=$tagName">
					<xsl:call-template name="titleOfInvention_ChoiceText"></xsl:call-template>
				</xsl:when>
				<xsl:when test="'technical-field'=$tagName">
					<xsl:call-template name="techField_ChoiceText"></xsl:call-template>
				</xsl:when>
				<xsl:when test="'background-art'=$tagName">
					<xsl:call-template name="backgroundArt_ChoiceText"></xsl:call-template>
				</xsl:when>
				<xsl:when test="'disclosure'=$tagName">
					<xsl:call-template name="disclosure_ChoiceText"></xsl:call-template>
				</xsl:when>
				<xsl:when test="'summary-of-invention'=$tagName">
					<xsl:call-template name="summaryOfInvention_ChoiceText"></xsl:call-template>
				</xsl:when>
				<xsl:when test="'description-of-drawings'=$tagName">
					<xsl:call-template name="descDrawings_ChoiceText"></xsl:call-template>
				</xsl:when>
				<xsl:when test="'description-of-embodiments'=$tagName">
					<xsl:call-template name="descriptionOfEmbodiments_ChoiceText"></xsl:call-template>
				</xsl:when>
				<xsl:when test="'best-mode'=$tagName">
					<xsl:call-template name="bestMode_ChoiceText"></xsl:call-template>
				</xsl:when>
				<xsl:when test="'mode-for-invention'=$tagName">
					<xsl:call-template name="mode_ChoiceText"></xsl:call-template>
				</xsl:when>
				<xsl:when test="'industrial-applicability'=$tagName">
					<xsl:call-template name="industrialApp_ChoiceText"></xsl:call-template>
				</xsl:when>
				<xsl:when test="'reference-signs-list'=$tagName">
					<xsl:call-template name="referenceSignsList_ChoiceText"></xsl:call-template>
				</xsl:when>
				<xsl:when test="'reference-to-deposited-biological-material'=$tagName">
					<xsl:call-template name="referenceToDepositedBiologicalMaterial_ChoiceText"></xsl:call-template>
				</xsl:when>
				<xsl:when test="'sequence-list-text'=$tagName">
					<xsl:choose>
						<xsl:when test="$dtd-version &gt;= 1.6">
							<xsl:call-template name="sequence_ChoiceText"></xsl:call-template>
						</xsl:when>
						<xsl:otherwise>
							<xsl:call-template name="sequenceOld_ChoiceText"></xsl:call-template>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:when>
				<xsl:when test="'citation-list'=$tagName">
					<xsl:call-template name="citationList_ChoiceText"></xsl:call-template>
				</xsl:when>

				<!-- START OF 'summary-of-invention' or 'disclosure' -->
				<xsl:when test="'tech-problem'=$tagName">
					<xsl:call-template name="techProblem_ChoiceText"></xsl:call-template>
				</xsl:when>
				<xsl:when test="'tech-solution'=$tagName">
					<xsl:choose>
						<xsl:when test="$dtd-version &gt;= 1.6">
							<xsl:call-template name="techSolution_ChoiceText"></xsl:call-template>
						</xsl:when>
						<xsl:otherwise>
							<xsl:call-template name="techSolutionOld_ChoiceText"></xsl:call-template>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:when>
				<xsl:when test="'advantageous-effects'=$tagName">
					<xsl:choose>
						<xsl:when test="$dtd-version &gt;= 1.6">
							<xsl:call-template name="advanEffects_ChoiceText"></xsl:call-template>
						</xsl:when>
						<xsl:otherwise>
							<xsl:call-template name="advanEffectsOld_ChoiceText"></xsl:call-template>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:when>
				
				<!-- START OF 'description-of-embodiments' -->
				<xsl:when test="'embodiments-example'=$tagName">
					<xsl:choose>
						<xsl:when test="(./@ex-num) !=''">
							<xsl:call-template name="embodimentsExample_ChoiceText"></xsl:call-template>
						</xsl:when>
						<xsl:otherwise>
							<xsl:call-template name="embodimentsExampleS_ChoiceText"></xsl:call-template>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:when>
	
				<!-- SRART OF 'citation-list' -->
				<xsl:when test="'patent-literature'=$tagName">
					<xsl:call-template name="patentLiterature_ChoiceText"></xsl:call-template>
				</xsl:when>
				<xsl:when test="'non-patent-literature'=$tagName">
					<xsl:call-template name="nonPatentLiterature_ChoiceText"></xsl:call-template>
				</xsl:when>
	
				<!-- CLAIMS -->
				<xsl:when test="'claims'=$tagName">
					<xsl:call-template name="claim_ChoiceText"></xsl:call-template>
				</xsl:when>
				<xsl:when test="'claim'=$tagName">
					<xsl:call-template name="claimHeading_ChoiceText"></xsl:call-template>
				</xsl:when>
	
				<!-- DRAWINGS -->
				<xsl:when test="'drawings'=$tagName">
					<xsl:call-template name="drawing_ChoiceText"></xsl:call-template>
				</xsl:when>
				<xsl:otherwise>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:value-of select="$tagVal "></xsl:value-of>
	</xsl:template>

	<!-- NOTE:  template for "maths"
			 28.05.2014 : Updated to reneder <img> even when it contains both of <math> and <img> as child elements.
									  So far, this stylesheet cannot render mathematical formulae in XML format. -->
	<!-- DO NOT DELETE: This snippet template is provisioned for when mathml is enabled using jeuclid -->  
    <!-- xsl:template match="maths">
			<fo:block>
			<fo:instream-foreign-object>
				<math xmlns="http://www.w3.org/1998/Math/MathML">
				<mstyle displaystyle="true">				
				<xsl:copy-of select="*"/>
				</mstyle>
				</math>
          	</fo:instream-foreign-object>
			</fo:block>
	</xsl:template-->											  
	<xsl:template match="maths">
		<xsl:choose>
			<xsl:when test="@num != ''">
				<fo:table table-layout="fixed" keep-together.within-page="always">
					<fo:table-column></fo:table-column>
					<fo:table-body>
						<fo:table-row>
							<fo:table-cell>
								<fo:block>
									<xsl:choose>
										<xsl:when test="./img">
											<xsl:choose>
												<xsl:when test="$lang='ar'">
													<xsl:text>رياضيات  </xsl:text>
													<xsl:value-of select="@num"></xsl:value-of>
												</xsl:when>
												<xsl:when test="$lang='ja'">
													<xsl:text>[数</xsl:text>
													<xsl:value-of select="@num"></xsl:value-of>
													<xsl:text>]</xsl:text>
												</xsl:when>
												<xsl:when test="$lang='zh'">
													<xsl:text>[数</xsl:text>
													<xsl:value-of select="@num"></xsl:value-of>
													<xsl:text>]</xsl:text>
												</xsl:when>
												<xsl:when test="$lang='ko'">
													<xsl:text>[수식</xsl:text>
													<xsl:value-of select="@num"></xsl:value-of>
													<xsl:text>]</xsl:text>
												</xsl:when>
												<xsl:when test="$lang='ru'">
													<xsl:text>[Математическая формула </xsl:text>
													<xsl:value-of select="@num"></xsl:value-of>
													<xsl:text>]</xsl:text>
												</xsl:when>
												<xsl:otherwise>
													<xsl:text>[Math.</xsl:text>
													<xsl:value-of select="@num"></xsl:value-of>
													<xsl:text>]</xsl:text>
												</xsl:otherwise>
											</xsl:choose>						
										</xsl:when>
										<xsl:when test="(./math) and not(./img)">
											<fo:inline font-weight="bold">
												<xsl:call-template name="math_ChoiceText"></xsl:call-template>
											</fo:inline>
										</xsl:when>
									</xsl:choose>
								</fo:block>
							</fo:table-cell>
						</fo:table-row>
						<fo:table-row>
							<fo:table-cell>
								<fo:block>
									<xsl:apply-templates select="./img"></xsl:apply-templates>
								</fo:block>
							</fo:table-cell>
						</fo:table-row>
					</fo:table-body>
				</fo:table>
			</xsl:when>
			<xsl:otherwise>
				<xsl:apply-templates select="./img"></xsl:apply-templates>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<!-- *********************************************************************
     *  IMPORT COMPONENT TEMPLATES                                       *
     ********************************************************************* 
-->
	<xsl:template match="article">
		<!-- param to pass the date to format_date template (formatting.xsl) -->
		      
		<xsl:param name="date" select="normalize-space(.//pubdate)"></xsl:param>      
		<xsl:choose>         
			<xsl:when test="./text">            
				<xsl:value-of select="normalize-space(.)"></xsl:value-of>            
				<xsl:if test="parent::nplcit/@url">               
					<xsl:text> 
					</xsl:text>               
					<fo:inline color="blue">        		(<fo:basic-link external-destination="{parent::nplcit/@url}">                     
							<xsl:value-of select="parent::nplcit/@url"></xsl:value-of>                  
						</fo:basic-link>).
	        
					</fo:inline>            
				</xsl:if>         
			</xsl:when>         
			<xsl:otherwise>            
				<xsl:apply-templates select=".//author"></xsl:apply-templates>            
				<xsl:if test="./atl">               
					<xsl:variable name="nAtl" select="normalize-space(./atl)"></xsl:variable>               
					<xsl:variable name="nLen" select="string-length($nAtl)"></xsl:variable>               
					<xsl:choose>
						<!-- if article title ends in comma, strip and replace with period -->
						                  
						<xsl:when test="substring($nAtl,$nLen)=','">                     
							<xsl:call-template name="rtrim">                        
								<xsl:with-param name="string" select="$nAtl"></xsl:with-param>                     
							</xsl:call-template>                     
							<xsl:text>. </xsl:text>                  
						</xsl:when>
						<!-- if it doesn't end with a period, add one -->
						                  
						<xsl:when test="not(substring($nAtl,$nLen)='.')">                     
							<xsl:value-of select="$nAtl"></xsl:value-of>                     
							<xsl:call-template name="format_period">                        
								<xsl:with-param name="string" select="$nAtl"></xsl:with-param>                     
							</xsl:call-template>                  
						</xsl:when>
						<!-- it ends with a period, just display -->
						                  
						<xsl:otherwise>                     
							<xsl:value-of select="$nAtl"></xsl:value-of>                     
							<xsl:text> 
							</xsl:text>                  
						</xsl:otherwise>               
					</xsl:choose>            
				</xsl:if>            
				<xsl:if test="./subname">               
					<xsl:apply-templates select="./subname"></xsl:apply-templates>            
				</xsl:if>
				<!-- test for comma -->
				            
				<xsl:choose>
					<!-- book | serial -->
					               
					<xsl:when test=".//book-title">                  
						<fo:inline font-style="italic">                     
							<xsl:value-of select="normalize-space(.//book-title)"></xsl:value-of>                     
							<xsl:call-template name="format_period">                        
								<xsl:with-param name="string" select=".//book-title"></xsl:with-param>                     
							</xsl:call-template>                     
							<xsl:text>  
							</xsl:text>                  
						</fo:inline>               
					</xsl:when>               
					<xsl:otherwise>
						<!-- serial -->
						                  
						<fo:inline font-style="italic">                     
							<xsl:value-of select="normalize-space(.//sertitle)"></xsl:value-of>                     
							<xsl:choose> 
								<!-- if there's following info, format with a comma -->
								                        
								<xsl:when test=".//ino | .//vid ">                           
									<xsl:call-template name="format_comma">                              
										<xsl:with-param name="string" select="normalize-space(.//sertitle)"></xsl:with-param>                           
									</xsl:call-template>                        
								</xsl:when>
								<!-- otherwise, use a period -->
								                        
								<xsl:otherwise>                           
									<xsl:call-template name="format_comma">                              
										<xsl:with-param name="string" select="normalize-space(.//sertitle)"></xsl:with-param>                           
									</xsl:call-template>                        
								</xsl:otherwise>                     
							</xsl:choose>                  
						</fo:inline>                  
						<xsl:text>  
						</xsl:text> 
               
					</xsl:otherwise>            
				</xsl:choose>
				<!-- end book-title | sertitle -->
				            
				<xsl:if test=".//edition">               
					<xsl:call-template name="rtrim">                  
						<xsl:with-param name="string" select="normalize-space(.//edition)"></xsl:with-param>               
					</xsl:call-template>            
				</xsl:if>            
				<xsl:choose>               
					<xsl:when test=".//pubdate/sdate | .//pubdate/edate">                  
						<xsl:call-template name="format_date">  
                     
							<xsl:with-param name="date" select="normalize-space(./pubdate/sdate)"></xsl:with-param>                     
							<xsl:with-param name="text" select="1"></xsl:with-param>                     
							<xsl:with-param name="lang" select="$lang"></xsl:with-param>                  
						</xsl:call-template>                  
						<xsl:if test=".//pubdate/edate">                     
							<xsl:call-template name="revised_ChoiceText"></xsl:call-template>                     
							<xsl:call-template name="format_date">  
                        
								<xsl:with-param name="date" select="normalize-space(./pubdate/edate)"></xsl:with-param>                        
								<xsl:with-param name="text" select="1"></xsl:with-param>                        
								<xsl:with-param name="lang" select="$lang"></xsl:with-param>                     
							</xsl:call-template>                  
						</xsl:if>               
					</xsl:when>               
					<xsl:when test=" .//pubdate/text()">                  
						<xsl:call-template name="format_date">                       
							<xsl:with-param name="date" select="normalize-space(.//pubdate)"></xsl:with-param>                     
							<xsl:with-param name="text" select="1"></xsl:with-param>                     
							<xsl:with-param name="lang" select="$lang"></xsl:with-param>                  
						</xsl:call-template>               
					</xsl:when>            
				</xsl:choose>            
				<xsl:if test="./edition">               
					<xsl:value-of select="./edition"></xsl:value-of>               
					<xsl:call-template name="format_comma">                  
						<xsl:with-param name="string" select="normalize-space(./edition)"></xsl:with-param>               
					</xsl:call-template>            
				</xsl:if>            
				<xsl:if test="./imprint">               
					<xsl:choose>                  
						<xsl:when test=".//address/text">                     
							<xsl:value-of select="normalize-space(.//imprint/address/text)"></xsl:value-of>                  
						</xsl:when>                  
						<xsl:otherwise>                     
							<xsl:if test=".//address/city">                        
								<xsl:value-of select=".//address/city"></xsl:value-of>                        
								<xsl:call-template name="format_comma">                           
									<xsl:with-param name="string" select="normalize-space(.//address/city)"></xsl:with-param>                        
								</xsl:call-template>                     
							</xsl:if>                     
							<xsl:if test=".//address/state">                        
								<xsl:value-of select="normalize-space(.//address/state)"></xsl:value-of>                     
							</xsl:if>                  
						</xsl:otherwise>               
					</xsl:choose>            
				</xsl:if>            
				<xsl:if test="./imprint/name">               
					<xsl:text>: </xsl:text>               
					<xsl:value-of select="normalize-space(./imprint/name)"></xsl:value-of>               
					<xsl:call-template name="format_comma">                  
						<xsl:with-param name="string" select="normalize-space(./imprint/name)"></xsl:with-param>               
					</xsl:call-template>            
				</xsl:if>            
				<xsl:if test="./imprint/pubdate">               
					<xsl:text> 
					</xsl:text>               
					<xsl:call-template name="format_date">  
                  
						<xsl:with-param name="date" select="normalize-space(.//pubdate)"></xsl:with-param>                  
						<xsl:with-param name="text" select="1"></xsl:with-param>                  
						<xsl:with-param name="lang" select="$lang"></xsl:with-param>               
					</xsl:call-template>               
					<xsl:call-template name="format_period">                  
						<xsl:with-param name="string" select="normalize-space(.//pubdate)"></xsl:with-param>               
					</xsl:call-template>            
				</xsl:if>            
				<xsl:if test=".//vid">               
					<xsl:call-template name="vid_ChoiceText"></xsl:call-template>               
					<xsl:value-of select="normalize-space(.//vid)"></xsl:value-of>               
					<xsl:call-template name="format_comma">                  
						<xsl:with-param name="string" select="normalize-space(.//vid)"></xsl:with-param>               
					</xsl:call-template>            
				</xsl:if>            
				<xsl:if test=".//ino">               
					<xsl:call-template name="ino_ChoiceText"></xsl:call-template>               
					<xsl:value-of select="normalize-space(.//ino)"></xsl:value-of>               
					<xsl:choose>
						<!-- if location elements present, write comma -->
						                  
						<xsl:when test=".//location">                     
							<xsl:call-template name="format_comma">                        
								<xsl:with-param name="string" select="normalize-space(.//ino)"></xsl:with-param>                     
							</xsl:call-template>                  
						</xsl:when>                  
						<xsl:otherwise>
							<!-- end with period -->
							                     
							<xsl:call-template name="format_period">                        
								<xsl:with-param name="string" select="normalize-space(.//ino)"></xsl:with-param>                     
							</xsl:call-template>                  
						</xsl:otherwise>               
					</xsl:choose>            
				</xsl:if>            
				<xsl:apply-templates select="location"></xsl:apply-templates>            
				<xsl:if test=".//isbn">               
					<xsl:call-template name="isbn_ChoiceText"></xsl:call-template>               
					<xsl:value-of select="normalize-space(.//isbn)"></xsl:value-of>               
					<xsl:call-template name="format_period">                  
						<xsl:with-param name="string" select="normalize-space(.//isbn)"></xsl:with-param>               
					</xsl:call-template>            
				</xsl:if>            
				<xsl:if test=".//issn">               
					<xsl:call-template name="issn_ChoiceText"></xsl:call-template>               
					<xsl:value-of select="normalize-space(.//issn)"></xsl:value-of>               
					<xsl:call-template name="format_period">                  
						<xsl:with-param name="string" select="normalize-space(.//issn)"></xsl:with-param>               
					</xsl:call-template>            
				</xsl:if>            
				<xsl:if test="parent::nplcit/@url">               
					<xsl:text> 
					</xsl:text>               
					<fo:inline color="blue">        		(<fo:basic-link external-destination="{parent::nplcit/@url}">                     
							<xsl:value-of select="parent::nplcit/@url"></xsl:value-of>                  
						</fo:basic-link>).
	        
					</fo:inline>            
				</xsl:if>         
			</xsl:otherwise>
			<!-- end article subelements (not <text>) -->
			      
		</xsl:choose>   
	</xsl:template>   
	<xsl:template match="addressbook">      
		<xsl:apply-templates></xsl:apply-templates>   
	</xsl:template><xsl:template match="dtext">      
		<xsl:value-of select="."></xsl:value-of>   
	</xsl:template><xsl:template match="address">      
		<xsl:choose>         
			<xsl:when test="./text">            
				<xsl:value-of select="./text"></xsl:value-of>         
			</xsl:when>         
			<xsl:otherwise>            
				<xsl:if test="./address-1">               
					<fo:block>                  
						<xsl:value-of select="./address-1"></xsl:value-of>               
					</fo:block>            
				</xsl:if>            
				<xsl:if test="./address-2">               
					<fo:block>                  
						<xsl:value-of select="./address-2"></xsl:value-of>               
					</fo:block>            
				</xsl:if>            
				<xsl:if test="./address-3">               
					<fo:block>                  
						<xsl:value-of select="./address-3"></xsl:value-of>               
					</fo:block>            
				</xsl:if>            
				<xsl:if test="./mailcode">               
					<fo:block>                  
						<xsl:value-of select="./mailcode"></xsl:value-of>               
					</fo:block>            
				</xsl:if>            
				<xsl:if test="./pobox">               
					<fo:block>                  
						<xsl:value-of select="./pobox"></xsl:value-of>               
					</fo:block>            
				</xsl:if>            
				<xsl:if test="./room">               
					<fo:block>                  
						<xsl:value-of select="./room"></xsl:value-of>               
					</fo:block>            
				</xsl:if>            
				<xsl:if test="./floor">               
					<fo:block>                  
						<xsl:value-of select="./floor"></xsl:value-of>               
					</fo:block>            
				</xsl:if>            
				<xsl:if test="./building">               
					<fo:block>                  
						<xsl:value-of select="./building"></xsl:value-of>               
					</fo:block>            
				</xsl:if>            
				<xsl:if test="./street">               
					<fo:block>                  
						<xsl:value-of select="./street"></xsl:value-of>               
					</fo:block>            
				</xsl:if>            
				<fo:block>               
					<xsl:value-of select="./city"></xsl:value-of>               
					<xsl:text>, </xsl:text>               
					<xsl:value-of select="./county"></xsl:value-of>               
					<xsl:text>, </xsl:text>               
					<xsl:value-of select="./state"></xsl:value-of>                
					<xsl:text> 
					</xsl:text>               
					<xsl:value-of select="./postcode"></xsl:value-of>               
					<xsl:text> 
					</xsl:text>               
					<xsl:value-of select="./country"></xsl:value-of>            
				</fo:block>            
				<xsl:for-each select="./email">               
					<fo:block>                  
						<xsl:value-of select="."></xsl:value-of>               
					</fo:block>            
				</xsl:for-each>            
				<xsl:for-each select="./phone">               
					<fo:block>                    
						<xsl:value-of select="."></xsl:value-of>               
					</fo:block>            
				</xsl:for-each>            
				<xsl:for-each select="./fax">               
					<fo:block>                  
						<xsl:value-of select="."></xsl:value-of>               
					</fo:block>            
				</xsl:for-each>            
				<xsl:for-each select="./url">               
					<fo:block>                  
						<xsl:value-of select="."></xsl:value-of>               
					</fo:block>            
				</xsl:for-each>            
				<xsl:for-each select="./ead">               
					<fo:block>                  
						<xsl:value-of select="."></xsl:value-of>               
					</fo:block>            
				</xsl:for-each>         
			</xsl:otherwise>      
		</xsl:choose>   
	</xsl:template>   
	<xsl:template match="author | subname">
      <fo:inline>
         <xsl:attribute name="id">
            <xsl:value-of select="@id"></xsl:value-of>
         </xsl:attribute>
         <xsl:choose>
            <xsl:when test="name() = 'author'">
               <fo:inline font-weight="bold">
                  <xsl:call-template name="format_full_name"></xsl:call-template>
               </fo:inline>
            </xsl:when>
            <xsl:otherwise>
               <xsl:call-template name="format_full_name"></xsl:call-template>
            </xsl:otherwise>
         </xsl:choose>
      </fo:inline>
   </xsl:template>   
	<xsl:template match="book">
<!-- param to pass the date to format_date template (formatting.xsl) -->
      <xsl:param name="date" select="normalize-space(.//pubdate)"></xsl:param>
      <xsl:choose>
         <xsl:when test="./text">
            <xsl:value-of select="normalize-space(.)"></xsl:value-of>
            <xsl:if test="parent::nplcit/@url">
               <xsl:text> </xsl:text>
               <fo:inline color="blue">
	        		(<fo:basic-link external-destination="{parent::nplcit/@url}">
                     <xsl:value-of select="parent::nplcit/@url"></xsl:value-of>
                  </fo:basic-link>).
	        	</fo:inline>
            </xsl:if>			
         </xsl:when>
         <xsl:otherwise>
            <xsl:apply-templates select="./author"></xsl:apply-templates>
			<!-- test for comma -->
            <xsl:choose><!-- book | conference -->
               <xsl:when test="./book-title">
                  <fo:inline font-style="italic">
                     <xsl:value-of select="normalize-space(./book-title)"></xsl:value-of>
                     <xsl:call-template name="format_period">
                        <xsl:with-param name="string" select="normalize-space(./book-title)"></xsl:with-param>
                     </xsl:call-template>
                  </fo:inline>
               </xsl:when>
               <xsl:otherwise><!-- conference-->
                  <fo:inline font-style="italic">
                     <xsl:value-of select="normalize-space(.//conftitle)"></xsl:value-of>
                     <xsl:call-template name="format_period">
                        <xsl:with-param name="string" select="normalize-space(.//conftitle)"></xsl:with-param>
                     </xsl:call-template>
                  </fo:inline>
                  <xsl:if test=".//conference/date">
                     <xsl:call-template name="format_date">  
                        <xsl:with-param name="date" select="normalize-space(.//conference/date)"></xsl:with-param>
                        <xsl:with-param name="text" select="1"></xsl:with-param>
                        <xsl:with-param name="add_comma" select="1"></xsl:with-param>
                        <xsl:with-param name="lang" select="$lang"></xsl:with-param>
                     </xsl:call-template>
                     <xsl:text> </xsl:text>
                  </xsl:if>
                  <xsl:if test=".//confno">
                     <xsl:value-of select="normalize-space(.//confno)"></xsl:value-of>
                     <xsl:text> </xsl:text>
                  </xsl:if>
                  <xsl:if test=".//confplace">
                     <xsl:value-of select="normalize-space(.//confplace)"></xsl:value-of>
                     <xsl:call-template name="format_period">
                        <xsl:with-param name="string" select="normalize-space(.//confplace)"></xsl:with-param>
                     </xsl:call-template>
                     <xsl:text> </xsl:text>
                  </xsl:if>
                  <xsl:if test=".//confsponsor">
                     <xsl:call-template name="confsponsor_ChoiceText"></xsl:call-template>
                     <xsl:value-of select=".//confsponsor"></xsl:value-of>
                     <xsl:call-template name="format_period">
                        <xsl:with-param name="string" select="normalize-space(.//confsponsor)"></xsl:with-param>
                     </xsl:call-template>	
                  </xsl:if>
               </xsl:otherwise>
            </xsl:choose><!-- end book-title | conference -->
            <xsl:if test="./subname">
               <xsl:apply-templates select="./subname"></xsl:apply-templates>		
            </xsl:if>
            <xsl:if test="./edition">
               <xsl:value-of select="normalize-space(./edition)"></xsl:value-of>
               <xsl:call-template name="format_comma">
                  <xsl:with-param name="string" select="normalize-space(./edition)"></xsl:with-param>
               </xsl:call-template>		
            </xsl:if>
            <xsl:if test="./imprint">
               <xsl:choose>
                  <xsl:when test="./imprint/address/text">
                     <xsl:value-of select="normalize-space(./imprint/address/text)"></xsl:value-of>
                  </xsl:when>
                  <xsl:otherwise>
                     <xsl:if test="./imprint/address/city">
                        <xsl:value-of select="normalize-space(./imprint/address/city)"></xsl:value-of>
                        <xsl:call-template name="format_comma">
                           <xsl:with-param name="string" select="normalize-space(./imprint/address/city)"></xsl:with-param>
                        </xsl:call-template>
                     </xsl:if>
                     <xsl:if test="./imprint/address/state">
                        <xsl:value-of select="normalize-space(./imprint/address/state)"></xsl:value-of>
                     </xsl:if>
                  </xsl:otherwise>
               </xsl:choose>	
            </xsl:if>
            <xsl:if test="./imprint/name">
               <xsl:text>: </xsl:text>
               <xsl:value-of select="normalize-space(./imprint/name)"></xsl:value-of>
               <xsl:call-template name="format_comma">
                  <xsl:with-param name="string" select="normalize-space(./imprint/name)"></xsl:with-param>
               </xsl:call-template>
            </xsl:if>
            <xsl:choose>
               <xsl:when test="./imprint/pubdate/sdate | ./imprint/pubdate/edate">
                  <xsl:call-template name="format_date">  
                     <xsl:with-param name="date" select="normalize-space(./imprint/pubdate/sdate)"></xsl:with-param>
                     <xsl:with-param name="year_only" select="1"></xsl:with-param>
                  </xsl:call-template>
                  <xsl:if test="./imprint/pubdate/edate">
                     <xsl:call-template name="revised_ChoiceText"></xsl:call-template>
                     <xsl:call-template name="format_date">  
                        <xsl:with-param name="date" select="normalize-space(./imprint/pubdate/edate)"></xsl:with-param>
                        <xsl:with-param name="year_only" select="1"></xsl:with-param>
                     </xsl:call-template>
                     <xsl:text>. </xsl:text>
                  </xsl:if>
               </xsl:when>
               <xsl:when test="./imprint/pubdate/text()">
                  <xsl:call-template name="format_date">  
                     <xsl:with-param name="date" select="normalize-space(./imprint/pubdate)"></xsl:with-param>
                     <xsl:with-param name="year_only" select="1"></xsl:with-param>
                  </xsl:call-template>
                  <xsl:text>. </xsl:text>
               </xsl:when>
            </xsl:choose>
            <xsl:if test="./series">
               <xsl:value-of select="./series"></xsl:value-of>
               <xsl:call-template name="format_period">
                  <xsl:with-param name="string" select="normalize-space(./series)"></xsl:with-param>
               </xsl:call-template>
            </xsl:if>
            <xsl:if test="./notes">
               <xsl:value-of select="./notes"></xsl:value-of>				
               <xsl:call-template name="format_period">
                  <xsl:with-param name="string" select="normalize-space(./notes)"></xsl:with-param>
               </xsl:call-template>
            </xsl:if>
            <xsl:if test="./book/vid">
               <xsl:call-template name="vid_ChoiceText"></xsl:call-template>
               <xsl:value-of select="normalize-space(./book/vid)"></xsl:value-of>
               <xsl:call-template name="format_comma">
                  <xsl:with-param name="string" select="normalize-space(.//vid)"></xsl:with-param>
               </xsl:call-template>
            </xsl:if>
            <xsl:apply-templates select="location"></xsl:apply-templates>
            <xsl:if test="./isbn">
               <xsl:call-template name="isbn_ChoiceText"></xsl:call-template>
               <xsl:value-of select="normalize-space(./isbn)"></xsl:value-of>
               <xsl:call-template name="format_period">
                  <xsl:with-param name="string" select="normalize-space(.//isbn)"></xsl:with-param>
               </xsl:call-template>	
            </xsl:if>
            <xsl:if test="parent::nplcit/@url">
               <xsl:text> </xsl:text>
               <fo:inline color="blue">
	        		(<fo:basic-link external-destination="{parent::nplcit/@url}">
                     <xsl:value-of select="parent::nplcit/@url"></xsl:value-of>
                  </fo:basic-link>).
	        	</fo:inline>
            </xsl:if>			
         </xsl:otherwise><!-- book subelements (not <text>) -->
      </xsl:choose>
   </xsl:template>   
	<xsl:template match="claim">      
		<!-- detect rule change. claim in art19 amendment should not display any rule change. -->
		<xsl:variable name="detected_rules">
			<xsl:choose>
				<xsl:when test="//wo-application-body">
					<xsl:if test="not( ancestor::wo-amended-claims )">
						<xsl:call-template name="detect_rule_changes">
							<xsl:with-param name="target" select="."/>
						</xsl:call-template>
					</xsl:if>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text></xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:element name="fo:block">         
			<xsl:attribute name="id">            
				<xsl:value-of select="@id"></xsl:value-of>         
			</xsl:attribute>
			<xsl:choose>
			<xsl:when test="$lang='zh'">
				<xsl:attribute name="space-after">6pt</xsl:attribute>
			</xsl:when>
			</xsl:choose>
			<!-- if rule changes are detected, put bottom space to separate lines for continuous elements-->
			<xsl:if test="$detected_rules != ''">
				<xsl:attribute name="padding-top">1mm</xsl:attribute>
			</xsl:if>
			<fo:table table-layout="fixed">            
				<xsl:attribute name="width">               
					<xsl:value-of select="$content_table_width"></xsl:value-of>mm
				</xsl:attribute>
				<fo:table-column>
					<xsl:attribute name="column-width">
						<xsl:value-of select="$claim_num_column_width"></xsl:value-of>mm
					</xsl:attribute>
				</fo:table-column>
				<fo:table-column>
					<!--Logically, this column-width should be "$content_table_width - $claim_num_column_width".
						However, some of them has been incorrect and if they are fixed, layout will be changed.
						Despite of that, claims seem to be rendered without serious problems.
						So We would like to keep them as it has been when legacy FOP is used. -->
					<xsl:choose>
						<xsl:when test="not( contains( $fop_version, '0.2') ) and ( $fop_version != '' )">
							<!-- When new FOP is used, set logical value. If fop_version is empty, it should be regarded as legacy FOP -->
							<xsl:attribute name="column-width">                  
								<xsl:value-of select="$claim_content_column_width"></xsl:value-of>mm
							</xsl:attribute>            
						</xsl:when>
						<!-- When legacy FOP ise used, set old column-width -->
						<xsl:when test="$lang='ar'">
							<fo:table-column column-width="130mm" />           
						</xsl:when>
						
						<xsl:when test="$lang='es'">
							<xsl:attribute name="column-width">                  
								<xsl:value-of select="$page_width - 67"></xsl:value-of>mm
							</xsl:attribute>            
						</xsl:when>
						<xsl:when test="$lang='de'">
							<xsl:attribute name="column-width">                  
								<xsl:value-of select="$page_width - 67"></xsl:value-of>mm
							</xsl:attribute>            
						</xsl:when>
						<xsl:when test="$lang='fr'">
							<xsl:attribute name="column-width">                  
								<xsl:value-of select="$page_width - 71"></xsl:value-of>mm
							</xsl:attribute>            
						</xsl:when>
						<xsl:when test="$lang='pt'">
							<xsl:attribute name="column-width">                  
								<xsl:value-of select="$page_width - 71"></xsl:value-of>mm
							</xsl:attribute>            
						</xsl:when>						
						<xsl:when test="$lang='ru'">
							<xsl:attribute name="column-width">                  
								<xsl:value-of select="$page_width - 61"></xsl:value-of>mm
							</xsl:attribute>            
						</xsl:when>
						<xsl:when test="$lang='zh'">
							<xsl:attribute name="column-width">                  
								<xsl:value-of select="$claim_content_column_width"></xsl:value-of>mm
							</xsl:attribute>            
						</xsl:when>						
						<xsl:when test="$lang='ko'">
							<xsl:attribute name="column-width">                  
								<xsl:value-of select="$page_width - 65"></xsl:value-of>mm
							</xsl:attribute>            
						</xsl:when>			
						<xsl:otherwise>
							<xsl:attribute name="column-width">                  
								<xsl:value-of select="$page_width - 62"></xsl:value-of>mm
							</xsl:attribute>            
						</xsl:otherwise>
					</xsl:choose> 
				</fo:table-column>
				<xsl:if test="$lang != 'ar' and not( contains( $fop_version, '0.2') ) and ( $fop_version != '') ">
					<fo:table-column>                 
						<xsl:attribute name="column-width">
							<xsl:value-of select="$rule_change_column_width"/>mm
						</xsl:attribute>
					</fo:table-column>
				</xsl:if>
				<xsl:choose>
				<xsl:when test="$lang='zh'">
				<fo:table-body>               
					<fo:table-row>                  
						<fo:table-cell>							 
							<fo:block font-family="{$serif_font}" color="black"> 
								<!-- first column empty for chinese only-->
							</fo:block>        
						</fo:table-cell>                  
						<fo:table-cell>
							<xsl:if test="$detected_rules != ''">
								<xsl:attribute name="border-right">solid 1.5pt black</xsl:attribute>
							</xsl:if>
							<fo:block font-size="11pt">                
								<xsl:text>[</xsl:text>                        
								<xsl:if test="$dtd-version &gt;= 1.6">
									<xsl:call-template name="claimHeading_ChoiceText"></xsl:call-template>
								</xsl:if>
								<xsl:value-of select="@num"></xsl:value-of>                        
								<xsl:text>]</xsl:text>							
								<xsl:apply-templates></xsl:apply-templates>
							</fo:block>
						</fo:table-cell>
						<xsl:if test="not( contains( $fop_version, '0.2') ) and ( $fop_version != '') ">
							<fo:table-cell>
								<fo:block xsl:use-attribute-sets="rule_change">
									<xsl:if test="$detected_rules != ''">
										<xsl:call-template name="extract_rule_text">
											<xsl:with-param name="target" select="."></xsl:with-param>
										</xsl:call-template>
									</xsl:if>
								</fo:block>
							</fo:table-cell>
						</xsl:if>
					</fo:table-row>
				</fo:table-body>
				</xsl:when>
				<xsl:otherwise>
				<fo:table-body>               
					<fo:table-row>                  
						<fo:table-cell>
							<fo:block font-family="{$serif_font}" color="black">                     
								<xsl:text>[</xsl:text>                        
								<xsl:if test="$dtd-version &gt;= 1.6">
									<xsl:call-template name="claimHeading_ChoiceText"></xsl:call-template>
								</xsl:if>
								<xsl:value-of select="@num"></xsl:value-of>                        
								<xsl:text>]</xsl:text>                     
							</fo:block>                  
						</fo:table-cell>                  
						<fo:table-cell>
							<xsl:if test="$detected_rules != ''">
								<xsl:attribute name="border-right">solid 1.5pt black</xsl:attribute>
							</xsl:if>
							<fo:block>                
								<xsl:apply-templates></xsl:apply-templates>
							</fo:block>
						</fo:table-cell>
						<xsl:if test="$lang != 'ar' and not( contains( $fop_version, '0.2') ) and ( $fop_version != '') ">
							<fo:table-cell>
								<fo:block xsl:use-attribute-sets="rule_change">
									<xsl:if test="$detected_rules != ''">
										<xsl:call-template name="extract_rule_text">
											<xsl:with-param name="target" select="."></xsl:with-param>
										</xsl:call-template>
									</xsl:if>
								</fo:block>
							</fo:table-cell>
						</xsl:if>
					</fo:table-row>
				</fo:table-body>
				</xsl:otherwise>
				</xsl:choose>
			</fo:table>      
		</xsl:element>   
	</xsl:template>
	<xsl:template match="claim-text/tables">
		<fo:block keep-with-previous="always">
			<xsl:if test="@num != ''">
				<xsl:choose>
					<xsl:when test="$lang='ar'">
						<xsl:text>جدول </xsl:text>
						<xsl:value-of select="@num"></xsl:value-of>
					</xsl:when>
					<xsl:when test="$lang='ja'">
						<xsl:text>[表</xsl:text>
						<xsl:value-of select="@num"></xsl:value-of>
						<xsl:text>]</xsl:text>
					</xsl:when>
					<xsl:when test="$lang='fr'">
						<xsl:text>[Tableaux</xsl:text>
						<xsl:value-of select="@num"></xsl:value-of>
						<xsl:text>]</xsl:text>
					</xsl:when>
						<xsl:when test="$lang='de'">
						<xsl:text>[Tabellen</xsl:text>
						<xsl:value-of select="@num"></xsl:value-of>
						<xsl:text>]</xsl:text>
					</xsl:when>
					<xsl:when test="$lang='zh'">
						<xsl:text>[表</xsl:text>
						<xsl:value-of select="@num"></xsl:value-of>
						<xsl:text>]</xsl:text>
					</xsl:when>
					<xsl:when test="$lang='ko'">
						<xsl:text>[표</xsl:text>
						<xsl:value-of select="@num"></xsl:value-of>
						<xsl:text>]</xsl:text>
					</xsl:when>
					<xsl:when test="$lang='it'">
						<xsl:text>[Tavola </xsl:text>
						<xsl:value-of select="@num"></xsl:value-of>
						<xsl:text>]</xsl:text>
					</xsl:when>
					<xsl:otherwise>
						<xsl:text>[Table </xsl:text>
						<xsl:value-of select="@num"></xsl:value-of>
						<xsl:text>]</xsl:text>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:if>
			<xsl:apply-templates></xsl:apply-templates>   
		</fo:block>   
	</xsl:template>
	<xsl:template match="claim-text">      
	<xsl:choose>
		<xsl:when test="$lang='zh'">
			<!-- First level claim-text (direct child of claim) - use inline -->
			<xsl:choose>
			<xsl:when test="parent::claim">
				<fo:inline font-family="{$serif_font}" color="black" font-size="11pt">
					<xsl:text> </xsl:text> <!-- Add a space before the claim text -->
					<xsl:apply-templates></xsl:apply-templates>
				</fo:inline>
			</xsl:when>
			<!-- Nested claim-text - keep as block with indentation -->
			<xsl:otherwise>
				<fo:block font-family="{$serif_font}" color="black" font-size="11pt">
					<xsl:if test="parent::claim-text">
						<xsl:variable name="parent_detected_rules">
							<xsl:call-template name="detect_rule_changes">
								<xsl:with-param name="target" select="parent::claim-text/text()"></xsl:with-param>
								<xsl:with-param name="isR37_2">yes</xsl:with-param>
							</xsl:call-template>
						</xsl:variable>
						<xsl:variable name="parent_rule_residals">
							<xsl:call-template name="get_rule_text_residal">
								<xsl:with-param name="target" select="parent::claim-text/text()"></xsl:with-param>
							</xsl:call-template>
						</xsl:variable>
						<xsl:choose>
							<xsl:when test="($parent_detected_rules != '') and ($parent_rule_residals = '')">
								<!-- if parent claim-text has a rule change and it has no original text, do not indent-->
							</xsl:when>
							<xsl:otherwise>
								<xsl:attribute name="start-indent">from-nearest-specified-value(start-indent) + 1cm</xsl:attribute>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:if>
					<xsl:apply-templates></xsl:apply-templates>
				</fo:block>
			</xsl:otherwise>
			</xsl:choose>
		</xsl:when>
		<xsl:otherwise>
			<fo:block font-family="{$serif_font}" color="black"> 			
			<xsl:if test="parent::claim-text">
				<xsl:variable name="parent_detected_rules">
					<xsl:call-template name="detect_rule_changes">
						<xsl:with-param name="target" select="parent::claim-text/text()"></xsl:with-param>
						<xsl:with-param name="isR37_2">yes</xsl:with-param>
					</xsl:call-template>
				</xsl:variable>
				<xsl:variable name="parent_rule_residals">
					<xsl:call-template name="get_rule_text_residal">
						<xsl:with-param name="target" select="parent::claim-text/text()"></xsl:with-param>
					</xsl:call-template>
				</xsl:variable>
				<xsl:choose>
					<xsl:when test="($parent_detected_rules != '') and ($parent_rule_residals = '')">
						<!-- if parent claim-text has a rule change and it has no original text, do not indent-->
					</xsl:when>
					<xsl:otherwise>
						<xsl:attribute name="start-indent">from-nearest-specified-value(start-indent) + 1cm</xsl:attribute>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:if>
			<xsl:apply-templates></xsl:apply-templates>      
			</fo:block> 
		</xsl:otherwise>  
	</xsl:choose>
	</xsl:template><xsl:template match="claim-ref">      
		<fo:inline font-weight="bold">         
			<fo:basic-link internal-destination="{@idref}">            
				<xsl:apply-templates></xsl:apply-templates>         
			</fo:basic-link>      
		</fo:inline>   
	</xsl:template>   
	<xsl:template match="b"> 
		<fo:inline>
			<xsl:if test="not(name(preceding-sibling::node()[1])='b') and not(ancestor::b)">
				<xsl:attribute name="font-weight">bold</xsl:attribute>
			</xsl:if>
			<xsl:attribute name="vertical-align">
				<xsl:choose>
					<xsl:when test="name(ancestor::sup2)">
						<xsl:choose>
							<xsl:when test="name(ancestor::sub)">baseline</xsl:when>
							<xsl:otherwise>super</xsl:otherwise>
						</xsl:choose>
					</xsl:when>
					<xsl:when test="name(ancestor::sub2)">
						<xsl:choose>
							<xsl:when test="name(ancestor::sup)">baseline</xsl:when>
							<xsl:otherwise>sub</xsl:otherwise>
						</xsl:choose>
					</xsl:when>
					<xsl:otherwise>
						<xsl:choose>
							<xsl:when test="name(ancestor::sup)">super</xsl:when>
							<xsl:when test="name(ancestor::sub)">sub</xsl:when>
							<xsl:otherwise>baseline</xsl:otherwise>
						</xsl:choose>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:attribute>
			<xsl:apply-templates></xsl:apply-templates>
		</fo:inline>   
	</xsl:template><xsl:template match="chemistry">      
		<xsl:choose>
			<xsl:when test="@num != ''">
				<fo:table table-layout="fixed" keep-together.within-page="always">
					<fo:table-column></fo:table-column>
					<fo:table-body>
						<fo:table-row>
							<fo:table-cell>
								<fo:block>
									<xsl:choose>
										<xsl:when test="$lang='ar'">
											<xsl:text> كمياء </xsl:text>
											<xsl:value-of select="@num"></xsl:value-of>
										</xsl:when>
										<xsl:when test="$lang='ja'">
											<xsl:text>[化</xsl:text>
											<xsl:value-of select="@num"></xsl:value-of>
											<xsl:text>]</xsl:text>
										</xsl:when>
										<xsl:when test="$lang='zh'">
											<xsl:text>[化</xsl:text>
											<xsl:value-of select="@num"></xsl:value-of>
											<xsl:text>]</xsl:text>
										</xsl:when>
										<xsl:when test="$lang='ko'">
											<xsl:text>[화학식</xsl:text>
											<xsl:value-of select="@num"></xsl:value-of>
											<xsl:text>]</xsl:text> 
										</xsl:when>
										<xsl:when test="$lang='ru'">
											<xsl:text>[Химическая формула </xsl:text>
											<xsl:value-of select="@num"></xsl:value-of>
											<xsl:text>]</xsl:text> 
										</xsl:when>
										<xsl:otherwise>
											<xsl:text>[Chem.</xsl:text>
											<xsl:value-of select="@num"></xsl:value-of>
											<xsl:text>]</xsl:text>
										</xsl:otherwise>
									</xsl:choose>
								</fo:block>
							</fo:table-cell>
						</fo:table-row>
						<fo:table-row>
							<fo:table-cell>
								<fo:block>
									<xsl:apply-templates></xsl:apply-templates>
								</fo:block>
							</fo:table-cell>
						</fo:table-row>
					</fo:table-body>
				</fo:table>
			</xsl:when>
			<xsl:otherwise>
				<xsl:apply-templates></xsl:apply-templates>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template><xsl:template match="pre">
    	<fo:block xsl:use-attribute-sets="pre">
    	 	<xsl:value-of select="."></xsl:value-of>
    	</fo:block>
 	</xsl:template><xsl:template match="crossref">      
		<fo:inline font-weight="bold">         
			<fo:basic-link internal-destination="{@idref}">            
				<xsl:apply-templates></xsl:apply-templates>         
			</fo:basic-link>      
		</fo:inline>   
	</xsl:template><xsl:template match="dl">  
		<xsl:if test="(count(preceding-sibling::node()[string-length(normalize-space(descendant-or-self::text()))&gt;0])=0)">
			<xsl:call-template name="enforcelinefeed"></xsl:call-template>
		</xsl:if>
		<fo:table table-layout="fixed" width="100%">
			<fo:table-column column-number="1" column-width="proportional-column-width(1)"></fo:table-column>
			<fo:table-column column-number="2" column-width="40mm"></fo:table-column>
			<fo:table-column column-number="3" column-width="90mm"></fo:table-column>
			<fo:table-column column-number="4" column-width="proportional-column-width(1)"></fo:table-column>
			<fo:table-body>
				<xsl:for-each select="dt">
					<fo:table-row height="7mm">
						<fo:table-cell><fo:block></fo:block></fo:table-cell>
						<xsl:apply-templates select="."></xsl:apply-templates>
						<xsl:apply-templates select="following-sibling::dd[1]"></xsl:apply-templates>
						<fo:table-cell><fo:block></fo:block></fo:table-cell>
					</fo:table-row>
				</xsl:for-each>
			</fo:table-body>
		</fo:table>
	</xsl:template><xsl:template match="dt">
		<fo:table-cell padding-start="2mm" padding-end="2mm">
			<fo:block start-indent="0mm" text-align="left">
				<xsl:apply-templates></xsl:apply-templates>
			</fo:block>
		</fo:table-cell>
	</xsl:template><xsl:template match="dd">
		<fo:table-cell padding-start="2mm" padding-end="2mm">
			<fo:block start-indent="0mm" text-align="left">
				<xsl:apply-templates></xsl:apply-templates>
			</fo:block>
		</fo:table-cell>
	</xsl:template><xsl:template match="email">      
		<fo:inline font-family="{$monospace_font}" font-size="11pt">         
			<xsl:apply-templates></xsl:apply-templates>      
		</fo:inline>   
	</xsl:template><xsl:template match="figref">
		<!-- generate target by attribute or key -->
			<xsl:choose>
				<!-- if idref is used -->
				<xsl:when test="@idref">               
					<fo:basic-link internal-destination="{@idref}">                  
						<xsl:choose>
							<xsl:when test="$lang='ar'">
								<fo:inline id="{@id}">
									<xsl:text>رسم </xsl:text>
									<xsl:value-of select="@num"></xsl:value-of>
									
								</fo:inline>
							</xsl:when>
							<xsl:when test="$lang='ja'">
								<fo:inline id="{@id}">
									<xsl:text>[図</xsl:text>
									<xsl:value-of select="@num"></xsl:value-of>
									<xsl:text>]</xsl:text>
								</fo:inline>
							</xsl:when>
							<xsl:when test="$lang='zh'">
								<fo:inline id="{@id}">
									<xsl:text>[图</xsl:text>
									<xsl:value-of select="@num"></xsl:value-of>
									<xsl:text>]</xsl:text>
								</fo:inline>
							</xsl:when>
							<xsl:when test="$lang='ko'">
								<fo:inline id="{@id}">
									<xsl:text>[도</xsl:text>
									<xsl:value-of select="@num"></xsl:value-of>
									<xsl:text>]</xsl:text>
								</fo:inline> 
							</xsl:when>
							<xsl:when test="$lang='ru'">
								<fo:inline id="{@id}">
									<xsl:text>[фиг.</xsl:text>
									<xsl:value-of select="@num"></xsl:value-of>
									<xsl:text>]</xsl:text>
								</fo:inline> 
							</xsl:when>
							<xsl:when test="$lang='it'">
								<fo:inline id="{@id}">
									<xsl:text>[Fig.</xsl:text>
									<xsl:value-of select="@num"></xsl:value-of>
									<xsl:text>]</xsl:text>
								</fo:inline> 
							</xsl:when>
							<xsl:otherwise>
								<fo:inline id="{@id}">
									<xsl:text>[Fig.</xsl:text>
									<xsl:value-of select="@num"></xsl:value-of>
									<xsl:text>]</xsl:text>
								</fo:inline>
							</xsl:otherwise>
						</xsl:choose>
						<xsl:apply-templates></xsl:apply-templates>               
					</fo:basic-link>            
				</xsl:when>            
				<xsl:otherwise>               
					<xsl:choose> 
						<!-- if there is a key (i.e., a figure) -->
						<xsl:when test="key('fig_ref',@num) !=''">                     
							<xsl:choose>
								<xsl:when test="$lang='ar'">
									<fo:block id="{@id}">
										<fo:basic-link internal-destination="{generate-id(key('fig_ref', @num))}">                        
											<xsl:text>[رسم </xsl:text>
											<xsl:value-of select="@num"></xsl:value-of>
											<xsl:text>] </xsl:text>
											<xsl:apply-templates></xsl:apply-templates>
										</fo:basic-link>
									</fo:block>
								</xsl:when>
								<xsl:when test="$lang='ja'">
									<fo:block id="{@id}">
										<fo:basic-link internal-destination="{generate-id(key('fig_ref', @num))}">                        
											<xsl:text>[図</xsl:text>
											<xsl:value-of select="@num"></xsl:value-of>
											<xsl:text>]</xsl:text>
											<xsl:apply-templates></xsl:apply-templates>
										</fo:basic-link>
									</fo:block>
								</xsl:when>
								<xsl:when test="$lang='zh'">
									<fo:block id="{@id}">
										<fo:basic-link internal-destination="{generate-id(key('fig_ref', @num))}">                        
											<xsl:text>[图</xsl:text>
											<xsl:value-of select="@num"></xsl:value-of>
											<xsl:text>]</xsl:text>
											<xsl:apply-templates></xsl:apply-templates>
										</fo:basic-link>
									</fo:block>
								</xsl:when>
								<xsl:when test="$lang='ko'">
									<fo:block id="{@id}">
										<fo:basic-link internal-destination="{generate-id(key('fig_ref', @num))}">                        
											<xsl:text>[도</xsl:text>
											<xsl:value-of select="@num"></xsl:value-of>
											<xsl:text>]</xsl:text>
											<xsl:apply-templates></xsl:apply-templates>
										</fo:basic-link>
									</fo:block>
								</xsl:when>
								<xsl:when test="$lang='ru'">
									<fo:block id="{@id}">
										<fo:basic-link internal-destination="{generate-id(key('fig_ref', @num))}">                        
											<xsl:text>[фиг.</xsl:text>
											<xsl:value-of select="@num"></xsl:value-of>
											<xsl:text>]</xsl:text>
											<xsl:apply-templates></xsl:apply-templates>
										</fo:basic-link>
									</fo:block>
								</xsl:when>
								<xsl:when test="$lang='it'">
									<fo:block id="{@id}">
										<fo:basic-link internal-destination="{generate-id(key('fig_ref', @num))}">                        
											<xsl:text>[Fig.</xsl:text>
											<xsl:value-of select="@num"></xsl:value-of>
											<xsl:text>]</xsl:text>
											<xsl:apply-templates></xsl:apply-templates>
										</fo:basic-link>
									</fo:block>
								</xsl:when>
								<xsl:otherwise>
									<fo:block id="{@id}">
										<fo:basic-link internal-destination="{generate-id(key('fig_ref', @num))}">                        
											<xsl:text>[Fig.</xsl:text>
											<xsl:value-of select="@num"></xsl:value-of>
											<xsl:text>]</xsl:text>
											<xsl:apply-templates></xsl:apply-templates>
										</fo:basic-link>
									</fo:block>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:when>
						<!-- otherwise, just display text with no link -->
						<xsl:otherwise>                     
							<xsl:choose>
								<xsl:when test="$lang='ar'">
										<fo:block id="{@id}">
										<xsl:text>[رسم </xsl:text>
										<xsl:value-of select="@num"></xsl:value-of>
										<xsl:text>] </xsl:text>
										<xsl:apply-templates></xsl:apply-templates>
									</fo:block>
								</xsl:when>
								<xsl:when test="$lang='ja'">
										<fo:block id="{@id}">
											<xsl:text>[図</xsl:text>
											<xsl:value-of select="@num"></xsl:value-of>
											<xsl:text>]</xsl:text>
											<xsl:apply-templates></xsl:apply-templates>
										</fo:block>
								</xsl:when>
								<xsl:when test="$lang='zh'">
										<fo:block id="{@id}">
											<xsl:text>[图</xsl:text>
											<xsl:value-of select="@num"></xsl:value-of>
											<xsl:text>]</xsl:text>
											<xsl:apply-templates></xsl:apply-templates>
										</fo:block>
								</xsl:when>
								<xsl:when test="$lang='ko'">
										<fo:block id="{@id}">
											<xsl:text>[도</xsl:text>
											<xsl:value-of select="@num"></xsl:value-of>
											<xsl:text>]</xsl:text>
											<xsl:apply-templates></xsl:apply-templates>
										</fo:block> 
										<fo:block>
											<xsl:apply-templates></xsl:apply-templates>
										</fo:block>
								</xsl:when>
								<xsl:when test="$lang='ru'">
										<fo:block id="{@id}">
											<xsl:text>[фиг.</xsl:text>
											<xsl:value-of select="@num"></xsl:value-of>
											<xsl:text>]</xsl:text>
											<xsl:apply-templates></xsl:apply-templates>
										</fo:block> 
										<fo:block>
											<xsl:apply-templates></xsl:apply-templates>
										</fo:block>
								</xsl:when>								
								<xsl:otherwise>
										<fo:block id="{@id}">
											<xsl:text>[Fig.</xsl:text>
											<xsl:value-of select="@num"></xsl:value-of>
											<xsl:text>]</xsl:text>
											<xsl:apply-templates></xsl:apply-templates>
										</fo:block>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:otherwise>               
					</xsl:choose>            
				</xsl:otherwise>         
			</xsl:choose>      
	</xsl:template><xsl:template match="heading">      
		<xsl:variable name="detected_rules">
			<xsl:call-template name="detect_rule_changes">
				<xsl:with-param name="target" select="."/>
			</xsl:call-template>
		</xsl:variable>
		<xsl:choose>
			<xsl:when test="$detected_rules != ''">
				<fo:table table-layout="fixed">
					<fo:table-column>
						<xsl:attribute name="column-width">
							<xsl:value-of select="$p_num_column_width + $p_content_column_width"></xsl:value-of>mm </xsl:attribute>
					</fo:table-column>
					<fo:table-column>
						<xsl:attribute name="column-width">
							<xsl:value-of select="$rule_change_column_width"></xsl:value-of>mm </xsl:attribute>
					</fo:table-column>
					<fo:table-body> 
						<fo:table-row>
							<fo:table-cell border-right="solid 1.5pt black">
								<xsl:call-template name="render_heading" />
							</fo:table-cell>
							<fo:table-cell>
								<!-- put rule text at the right margin-->
								<fo:block xsl:use-attribute-sets="rule_change">
									<xsl:call-template name="extract_rule_text">
										<xsl:with-param name="target" select="."></xsl:with-param>
									</xsl:call-template>
								</fo:block>
							</fo:table-cell>
						</fo:table-row>
					</fo:table-body>
				</fo:table>
			</xsl:when>
			<xsl:otherwise>
				<xsl:call-template name="render_heading" />
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="render_heading">	
		<xsl:choose>
			<xsl:when test="@level='1'">            
				<xsl:element name="fo:block" use-attribute-sets="headings">
					<xsl:choose>
						<!-- 21.09.2018 -->
						<!-- The level attribute is used to indicate that the heading should replace the expected main header (i.e CAF heading) -->
						<!-- Example:
								Input:
								<summary-of-invention>
									<heading level=”1”>Summary of THE invention</heading>
									<p num=”0003”>This is the summary of the invention.</p>
								</summary-of-invention>
								
								Output: 
								Summary of THE invention
								This is the summary of the the invention
								
								And with:
								
								<summary-of-invention>
									<heading>Summary of THE invention</heading>
									<p num=”0003”>This is the summary of the invention.</p>
								</summary-of-invention>
								
								Output:
								Summary of invention <- CAF heading added by stylesheet.
								Summary of THE invention
								This is the summary of the the invention
						-->
						<xsl:when test="(parent::technical-field or parent::technical-field or parent::background-art or parent::disclosure or parent::summary-of-invention or parent::description-of-drawings or parent::description-of-embodiments or parent::best-mode or parent::mode-for-invention or parent::industrial-applicability or parent::reference-signs-list or parent::reference-to-deposited-biological-material or parent::sequence-list-text or parent::citation-list or parent::tech-problem or parent::tech-solution or parent::advantageous-effects or parent::embodiments-example or parent::patent-literature or parent::non-patent-literature) and (self::node() = parent::*/heading[position()=1])">
							<xsl:attribute name="font-size">
								<xsl:choose>
									<xsl:when test="$lang='zh'">12pt</xsl:when>
									<xsl:otherwise>14pt</xsl:otherwise>
								</xsl:choose>
							</xsl:attribute>
						</xsl:when>
						<xsl:otherwise>
							<xsl:attribute name="font-size">
								<xsl:choose>
									<xsl:when test="$lang='ja'">14pt</xsl:when>
									<xsl:when test="$lang='zh'">16pt</xsl:when>
									<xsl:otherwise>18pt</xsl:otherwise>
								</xsl:choose>
							</xsl:attribute>
						</xsl:otherwise>
					</xsl:choose>					 
					<xsl:apply-templates></xsl:apply-templates>            
				</xsl:element>         
			</xsl:when>         
			<xsl:when test="@level='2'">            
				<xsl:element name="fo:block" use-attribute-sets="headings">               
					<xsl:attribute name="font-size">
						<xsl:choose>
							<xsl:when test="$lang='ja'">14pt</xsl:when>
							<xsl:when test="$lang='zh'">14pt</xsl:when>
							<xsl:otherwise>16pt</xsl:otherwise>
						</xsl:choose>
					</xsl:attribute>               
					<xsl:apply-templates></xsl:apply-templates>            
				</xsl:element>         
			</xsl:when>         
			<xsl:when test="@level='3'">            
				<xsl:element name="fo:block" use-attribute-sets="headings">               
					<xsl:attribute name="font-size">
						<xsl:choose>
							<xsl:when test="$lang='zh'">12pt</xsl:when>
							<xsl:otherwise>14pt</xsl:otherwise>
						</xsl:choose>
					</xsl:attribute>               
					<xsl:apply-templates></xsl:apply-templates>            
				</xsl:element>         
			</xsl:when>         
			<xsl:otherwise>            
				<xsl:element name="fo:block" use-attribute-sets="headings">               
					<xsl:attribute name="font-size">
						<xsl:choose>
							<xsl:when test="$lang='ja'">14pt</xsl:when>
							<xsl:when test="$lang='zh'">11pt</xsl:when>
							<xsl:otherwise>13pt</xsl:otherwise>
						</xsl:choose>
					</xsl:attribute>               
					<xsl:apply-templates></xsl:apply-templates>            
				</xsl:element>         
			</xsl:otherwise>      
		</xsl:choose>   
	</xsl:template><xsl:template match="i">      
		<fo:inline>
			<xsl:if test="not(name(preceding-sibling::node()[1])='i') and not(ancestor::i)">
				<xsl:attribute name="font-style">italic</xsl:attribute>
			</xsl:if>
			<xsl:attribute name="vertical-align">
				<xsl:choose>
					<xsl:when test="name(ancestor::sup2)">
						<xsl:choose>
							<xsl:when test="name(ancestor::sub)">baseline</xsl:when>
							<xsl:otherwise>super</xsl:otherwise>
						</xsl:choose>
					</xsl:when>
					<xsl:when test="name(ancestor::sub2)">
						<xsl:choose>
							<xsl:when test="name(ancestor::sup)">baseline</xsl:when>
							<xsl:otherwise>sub</xsl:otherwise>
						</xsl:choose>
					</xsl:when>
					<xsl:otherwise>
						<xsl:choose>
							<xsl:when test="name(ancestor::sup)">super</xsl:when>
							<xsl:when test="name(ancestor::sub)">sub</xsl:when>
							<xsl:otherwise>baseline</xsl:otherwise>
						</xsl:choose>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:attribute>
			<xsl:apply-templates></xsl:apply-templates>
		</fo:inline>
	</xsl:template><xsl:template match="invention-title">
		<xsl:variable name="detected_rules">
			<xsl:call-template name="detect_rule_changes">
				<xsl:with-param name="target" select="."/>
			</xsl:call-template>
		</xsl:variable>
		<fo:block font-family="{$serif_font}" font-weight="bold" color="black">
			<xsl:attribute name="text-align">
				<xsl:choose>
					<xsl:when test="$lang='ja'">left</xsl:when>
					<xsl:otherwise>center</xsl:otherwise>
				</xsl:choose>
			</xsl:attribute>         
			<xsl:attribute name="font-size">
				<xsl:choose>
					<xsl:when test="$lang='ja'">14pt</xsl:when>
					<xsl:when test="$lang='zh'">14pt</xsl:when>
					<xsl:otherwise>16pt</xsl:otherwise>
				</xsl:choose>
			</xsl:attribute>
			<xsl:if test="$lang='ja'">
				<xsl:attribute name="text-indent">15mm</xsl:attribute>
			</xsl:if>
			<xsl:choose>
				<xsl:when test="$detected_rules !=''">
					<fo:table table-layout="fixed">
						<fo:table-column>
							<xsl:attribute name="column-width">
								<xsl:value-of select="$content_table_width - $rule_change_column_width"></xsl:value-of>mm
							</xsl:attribute>
						</fo:table-column>
						<fo:table-column>
							<xsl:attribute name="column-width">
								<xsl:value-of select="$rule_change_column_width"></xsl:value-of>mm
							</xsl:attribute>
						</fo:table-column>
						<fo:table-body>
							<fo:table-row>
								<fo:table-cell>
									<xsl:if test="$detected_rules != ''">
										<xsl:attribute name="border-right">solid 1.5pt black</xsl:attribute>
									</xsl:if>
									<fo:block>
										<xsl:if test="$dtd-version &gt;= 1.6">
											<xsl:call-template name="titleOfInvention_ChoiceText"></xsl:call-template>
										</xsl:if>
										<xsl:apply-templates/>
									</fo:block>
								</fo:table-cell>
								<fo:table-cell>
									<fo:block xsl:use-attribute-sets="rule_change">
										<xsl:call-template name="extract_rule_text">
											<xsl:with-param name="target" select="."></xsl:with-param>
										</xsl:call-template>
									</fo:block>
								</fo:table-cell>
							</fo:table-row>
						</fo:table-body>
					</fo:table>
				</xsl:when>
				<xsl:otherwise>
					<xsl:if test="$dtd-version &gt;= 1.6">
						<xsl:call-template name="titleOfInvention_ChoiceText"></xsl:call-template>
					</xsl:if>
					<xsl:apply-templates/>
				</xsl:otherwise>
			</xsl:choose>     
		</fo:block>   
	</xsl:template><xsl:template match="ol | ul">      
		<fo:list-block provisional-distance-between-starts="15mm" provisional-label-separation="5mm">         
			<xsl:apply-templates></xsl:apply-templates>      
		</fo:list-block>   
	</xsl:template>
	
	 <!--
arabletters=ا ب ت ث ج ح خ د ذ رز س ش ص ض ط ظ ع غ فق ك ل م ن ه و ي ء
 -->
 
	<xsl:variable name="arabletters"
 select="'&#x0627;&#x0628;&#x062A;&#x062B;&#x062C;&#x062D;&#x062E;&#x062F;&#x0630;&#x0631;&#x0632;&#x0633;&#x0634;&#x0635;&#x0636;&#x0637;&#x0638;&#x0639;&#x063A;&#x0641;&#x0642;&#x0643;&#x0644;&#x0645;&#x0646;&#x0647;&#x0648;&#x064A;'"/>
	
	<xsl:template match="ol/li">     
		<fo:list-item>         
			<fo:list-item-label end-indent="label-end()">            
				<fo:block>               
					<xsl:choose>                  
					<!--CCS-16654-->
						<xsl:when test="($lang='ar') and (parent::ol[@ol-style='أ'] or parent::ol[@ol-style='أ ‌'])">                     
							<!--<xsl:number format="أ."></xsl:number> -->
							<!-- 
							Arabic Letter varibale initialize above for only arabic bullet
							-->
                            <xsl:value-of select="concat(substring($arabletters, count(preceding-sibling::*)  + 1, 1), '.')"/>							
						</xsl:when>	
					<!--END CCS-16654-->
						<xsl:when test="parent::ol[@ol-style='i'] or parent::ol[@ol-style='i.']">
							<xsl:number format="i."></xsl:number>                  
						</xsl:when>                  
						<xsl:when test="parent::ol[@ol-style='a'] or parent::ol[@ol-style='a.']">
							<xsl:number format="a."></xsl:number>                  
						</xsl:when>                  
						<xsl:when test="parent::ol[@ol-style='1'] or parent::ol[@ol-style='1.']"> 
							<xsl:number format="1."></xsl:number>                  
						</xsl:when>                  
						<xsl:when test="parent::ol[@ol-style='I'] or parent::ol[@ol-style='I.']">                    
							<xsl:number format="I."></xsl:number>                  
						</xsl:when>                  
						<xsl:when test="parent::ol[@ol-style='A'] or parent::ol[@ol-style='A.']">                     
							<xsl:number format="A."></xsl:number>                  
						</xsl:when>                  
						<xsl:otherwise>
							<xsl:choose>
								<xsl:when test="count(ancestor::li)=2">
									<xsl:number format="i."></xsl:number>
								</xsl:when>
								<xsl:when test="count(ancestor::li)=1">
									<xsl:number format="a."></xsl:number>
								</xsl:when>
								<xsl:when test="count(ancestor::li)=0">
									<xsl:number format="1."></xsl:number>
								</xsl:when>
								<xsl:otherwise>
									<xsl:number format="1."></xsl:number>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:otherwise>
					</xsl:choose>            
				</fo:block>         
			</fo:list-item-label>         
			<fo:list-item-body start-indent="body-start()">
				<fo:block >
					<xsl:apply-templates></xsl:apply-templates>
					<!-- 21.09.2018: Modified so that a whitespace (i.e &#160;) will be added ONLY WHEN the text content is empty. --> 
					 <xsl:variable name="text">
						<xsl:value-of select="./text()"></xsl:value-of>
					 </xsl:variable>
					<xsl:if test="$text = ''">
						<xsl:text> </xsl:text>
					</xsl:if>
				​</fo:block>
			</fo:list-item-body>      
		</fo:list-item>   
	</xsl:template><xsl:template match="nplcit">
		<fo:block>
			<xsl:attribute name="id">
				<xsl:value-of select="@id"></xsl:value-of>
			</xsl:attribute>
			<xsl:choose>
				<xsl:when test="$lang='ar'">
					<xsl:text>خلاف</xsl:text>
					<xsl:value-of select="@num"></xsl:value-of>
					<xsl:text>：</xsl:text>
				</xsl:when>
				<xsl:when test="$lang='ja'">
					<xsl:text>非特許文献</xsl:text>
					<xsl:value-of select="@num"></xsl:value-of>
					<xsl:text>：</xsl:text>
				</xsl:when>
				<xsl:when test="$lang='zh'">
					<xsl:text>非专利文献</xsl:text>
					<xsl:value-of select="@num"></xsl:value-of>
					<xsl:text>: </xsl:text>
				</xsl:when>
				<xsl:when test="$lang='ko'">
					<xsl:text>비특허 문헌</xsl:text>
					<xsl:value-of select="@num"></xsl:value-of>
					<xsl:text>: </xsl:text>  
				</xsl:when>
				<xsl:when test="$lang='ru'">
					<xsl:text>Непатентная литература </xsl:text>
					<xsl:value-of select="@num"></xsl:value-of>
					<xsl:text>: </xsl:text>  
				</xsl:when>
				<xsl:when test="$lang='it'">
					<xsl:text>NPL </xsl:text>
					<xsl:value-of select="@num"></xsl:value-of>
					<xsl:text>: </xsl:text>  
				</xsl:when>
				<xsl:when test="$lang='en'">
					<xsl:choose>
						<xsl:when test="$dtd-version &gt;= 1.6">
							<xsl:text>NPL </xsl:text>
						</xsl:when>
						<xsl:otherwise>
							<xsl:text>Non Patent Citation </xsl:text>
						</xsl:otherwise>
					</xsl:choose>
					<xsl:value-of select="@num"></xsl:value-of>
					<xsl:text>: </xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>nplcit</xsl:text>
					<xsl:value-of select="@num"></xsl:value-of>
					<xsl:text>:</xsl:text>
				</xsl:otherwise>				
			</xsl:choose>
			<xsl:apply-templates></xsl:apply-templates>
		</fo:block>
	</xsl:template><xsl:template match="othercit">      
		<xsl:apply-templates></xsl:apply-templates>      
		<xsl:if test="parent::nplcit/@url">         
			<xsl:text> 
			</xsl:text>         
			<fo:inline color="blue">(<fo:basic-link external-destination="{parent::nplcit/@url}">               
					<xsl:value-of select="parent::nplcit/@url"></xsl:value-of>            
				</fo:basic-link>).</fo:inline>      
		</xsl:if>   
	</xsl:template><xsl:template match="p[ancestor::abstract]">      
		<fo:block>         
			<xsl:attribute name="id">            
				<xsl:value-of select="@id"></xsl:value-of>         
			</xsl:attribute>         
			<fo:table table-layout="fixed">              
				<xsl:attribute name="width">               
					<xsl:value-of select="$page_width - 45"></xsl:value-of>mm</xsl:attribute>            
				<fo:table-column>               
					<xsl:attribute name="column-width">                  
						<xsl:value-of select="$page_width - 45"></xsl:value-of>mm</xsl:attribute>            
				</fo:table-column>            
				<fo:table-body>               
					<fo:table-row>                  
						<fo:table-cell>                     
							<fo:block font-family="{$serif_font}" color="black"> 
								<xsl:if test="$lang='zh'">  
									<xsl:attribute name="font-size">11pt</xsl:attribute>
								</xsl:if> 
								<xsl:if test="not($lang='ja')">
									<xsl:attribute name="text-indent">3mm</xsl:attribute>
								</xsl:if>                    
								<xsl:apply-templates></xsl:apply-templates>                     
							</fo:block>                  
						</fo:table-cell>               
					</fo:table-row>            
				</fo:table-body>         
			</fo:table>      
		</fo:block>   
	</xsl:template>
	<xsl:template match="p">
		<!-- calc displayed text (except rule change text) -->
		<xsl:variable name="value_of_self">
			<xsl:call-template name="get_rule_text_residal">
				<xsl:with-param name="target" select="normalize-space(.)"/>
			</xsl:call-template>
		</xsl:variable>
		<!-- detect rule change -->
		<xsl:variable name="detected_rules">
			<xsl:call-template name="detect_rule_changes">
				<xsl:with-param name="target" select="."/>
			</xsl:call-template>
		</xsl:variable>
		<fo:block id="{@id}">
		 	<xsl:if test="$lang='zh'">
		    	<xsl:attribute name="space-after">6pt</xsl:attribute>
		    </xsl:if>
			<!-- if rule changes are detected, put bottom space to separate lines for continuous elements-->
			<xsl:if test="$detected_rules != ''">
				<xsl:attribute name="padding-top">1mm</xsl:attribute>
			</xsl:if>
			<fo:table table-layout="fixed">
				<fo:table-column>
					<xsl:attribute name="column-width">
						<xsl:value-of select="$p_num_column_width"></xsl:value-of>mm
					</xsl:attribute>
				</fo:table-column>
				<fo:table-column>
					<xsl:attribute name="column-width">
						<xsl:value-of select="$p_content_column_width"></xsl:value-of>mm
					</xsl:attribute>
				</fo:table-column>
				<xsl:if test="$lang != 'ar' and not( contains( $fop_version, '0.2') ) and ( $fop_version != '') ">
					<fo:table-column>
						<xsl:attribute name="column-width">
							<xsl:value-of select="$rule_change_column_width"></xsl:value-of>mm
						</xsl:attribute>
					</fo:table-column>            
				</xsl:if>
				<xsl:choose>
				<xsl:when test="$lang='zh'">
				<fo:table-body>               
					<fo:table-row>
						<fo:table-cell>
							<fo:block font-family="{$serif_font}" color="black" text-align="left">	
							<!-- first column empty for chinese applications only-->
							</fo:block>
						</fo:table-cell>
						<fo:table-cell>
							<!-- if rule changes are detected, put vertical line-->
							<xsl:if test="$detected_rules != ''">
								<xsl:attribute name="border-right">solid 1.5pt black</xsl:attribute>
							</xsl:if>
							<fo:block font-family="{$serif_font}" color="black" font-size="11pt">
								<xsl:if test="not(ancestor::abstract)">
									<xsl:text>[</xsl:text>
									<xsl:value-of select="@num"></xsl:value-of>
									<xsl:text>] &#160;</xsl:text>
								</xsl:if>
								<xsl:apply-templates></xsl:apply-templates>
							</fo:block>                  
						</fo:table-cell>   
						<xsl:if test="not( contains( $fop_version, '0.2') ) and ( $fop_version != '') ">
							<fo:table-cell>
								<!-- put rule text at the right margin-->
								<fo:block xsl:use-attribute-sets="rule_change">
									<xsl:call-template name="extract_rule_text">
										<xsl:with-param name="target" select="."></xsl:with-param>
									</xsl:call-template>
								</fo:block>
							</fo:table-cell>            
						</xsl:if>
					</fo:table-row>
				</fo:table-body>  
				</xsl:when>	
				<xsl:otherwise>			
				<fo:table-body>               
					<fo:table-row>
						<fo:table-cell>
							<fo:block font-family="{$serif_font}" color="black" text-align="left">
								<xsl:if test="not(ancestor::abstract)">
									<xsl:text>[</xsl:text>
									<xsl:value-of select="@num"></xsl:value-of>
									<xsl:text>]</xsl:text>
								</xsl:if>
							</fo:block>
						</fo:table-cell>
						<fo:table-cell>
							<!-- if rule changes are detected, put vertical line-->
							<xsl:if test="$detected_rules != ''">
								<xsl:attribute name="border-right">solid 1.5pt black</xsl:attribute>
							</xsl:if>
							<fo:block font-family="{$serif_font}" color="black">
								<!--set text indent if below condition -->
								<xsl:if test="not($lang='ja') and ( normalize-space($value_of_self) != '')">
									<xsl:attribute name="text-indent">3mm</xsl:attribute>
								</xsl:if>
								<!-- TBD: make a new template for new dtd of paragraph replacement -->
								<xsl:apply-templates></xsl:apply-templates>
							</fo:block>                  
						</fo:table-cell>   
						<xsl:if test="$lang != 'ar' and not( contains( $fop_version, '0.2') ) and ( $fop_version != '') ">
							<fo:table-cell>
								<!-- put rule text at the right margin-->
								<fo:block xsl:use-attribute-sets="rule_change">
									<xsl:call-template name="extract_rule_text">
										<xsl:with-param name="target" select="."></xsl:with-param>
									</xsl:call-template>
								</fo:block>
							</fo:table-cell>            
						</xsl:if>
					</fo:table-row>
				</fo:table-body>  
				</xsl:otherwise>	
				</xsl:choose>				
			</fo:table>      
		</fo:block>    
	</xsl:template>
	<xsl:template match="br">
		<xsl:choose>
			<xsl:when test="preceding-sibling::*[1][self::img and @inline='no']"></xsl:when>
			<xsl:otherwise>
				<xsl:variable name="detected_rules">
					<xsl:call-template name="detect_rule_changes">
						<xsl:with-param name="target" select="preceding-sibling::text()[1]"></xsl:with-param>
						<xsl:with-param name="isR37_2">yes</xsl:with-param>
					</xsl:call-template>
				</xsl:variable>
				<xsl:if test="$detected_rules = ''">
					<xsl:text>&#x2028;</xsl:text>
				</xsl:if>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="smallcaps">      
		<fo:inline font-variant="small-caps">         
			<xsl:apply-templates></xsl:apply-templates>      
		</fo:inline>   
	</xsl:template><xsl:template match="sub">
		<fo:inline>
			<xsl:attribute name="vertical-align">sub</xsl:attribute>
			<xsl:attribute name="font-size">7pt</xsl:attribute>
			<xsl:apply-templates></xsl:apply-templates>
		</fo:inline>
	</xsl:template><xsl:template match="sup">
		<fo:inline>
			<xsl:attribute name="vertical-align">super</xsl:attribute>
			<xsl:attribute name="font-size">7pt</xsl:attribute>
			<xsl:apply-templates></xsl:apply-templates>
		</fo:inline>
	</xsl:template><xsl:template match="sub2">
		<fo:inline>
			<xsl:attribute name="vertical-align">
				<xsl:choose>
					<xsl:when test="name(ancestor::sup)">baseline</xsl:when>
					<xsl:when test="name(ancestor::sub)">sub</xsl:when>
					<xsl:otherwise>sub</xsl:otherwise>
				</xsl:choose>
			</xsl:attribute>
			<xsl:attribute name="font-size">5pt</xsl:attribute>
			<xsl:apply-templates></xsl:apply-templates>
		</fo:inline>
	</xsl:template><xsl:template match="sup2">
		<fo:inline>
			<xsl:attribute name="vertical-align">
				<xsl:choose>
					<xsl:when test="name(ancestor::sub)">baseline</xsl:when>
					<xsl:when test="name(ancestor::sup)">super</xsl:when>
					<xsl:otherwise>super</xsl:otherwise>
				</xsl:choose>
			</xsl:attribute>
			<xsl:attribute name="font-size">5pt</xsl:attribute>
			<xsl:apply-templates></xsl:apply-templates>
		</fo:inline>
	</xsl:template><xsl:template match="table-external-doc">
		<xsl:apply-templates></xsl:apply-templates>
	</xsl:template><xsl:template match="u">   	  
		<xsl:param name="renderer"></xsl:param>      
		<fo:inline>
			<!-- Note: FOP does not support all '@style' values for underline -->
			         
			<xsl:choose>            
				<xsl:when test="$renderer='FOP'">               
					<xsl:attribute name="text-decoration">underline</xsl:attribute>            
				</xsl:when>            
				<xsl:otherwise>               
					<xsl:choose>                  
						<xsl:when test="@style='double'">                     
							<xsl:attribute name="text-decoration">underline</xsl:attribute>                     
							<xsl:attribute name="border-bottom-style">solid</xsl:attribute>                     
							<xsl:attribute name="border-bottom-width">0.1mm</xsl:attribute>                  
						</xsl:when>                  
						<xsl:when test="@style='dash'">                     
							<xsl:attribute name="border-bottom-style">dashed</xsl:attribute>                     
							<xsl:attribute name="border-bottom-width">0.3mm</xsl:attribute>                  
						</xsl:when>                  
						<xsl:when test="@style='dots'">                     
							<xsl:attribute name="border-bottom-style">dotted</xsl:attribute>                     
							<xsl:attribute name="border-bottom-width">0.3mm</xsl:attribute>                  
						</xsl:when>                  
						<xsl:otherwise>                     
							<xsl:attribute name="text-decoration">underline</xsl:attribute>                  
						</xsl:otherwise>               
					</xsl:choose>            
				</xsl:otherwise>         
			</xsl:choose>
			<xsl:attribute name="vertical-align">
				<xsl:choose>
					<xsl:when test="name(ancestor::sup2)">
						<xsl:choose>
							<xsl:when test="name(ancestor::sub)">baseline</xsl:when>
							<xsl:otherwise>super</xsl:otherwise>
						</xsl:choose>
					</xsl:when>
					<xsl:when test="name(ancestor::sub2)">
						<xsl:choose>
							<xsl:when test="name(ancestor::sup)">baseline</xsl:when>
							<xsl:otherwise>sub</xsl:otherwise>
						</xsl:choose>
					</xsl:when>
					<xsl:otherwise>
						<xsl:choose>
							<xsl:when test="name(ancestor::sup)">super</xsl:when>
							<xsl:when test="name(ancestor::sub)">sub</xsl:when>
							<xsl:otherwise>baseline</xsl:otherwise>
						</xsl:choose>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:attribute>
			<xsl:apply-templates></xsl:apply-templates>      
		</fo:inline>
	</xsl:template><xsl:template match="o">
		<xsl:param name="renderer"></xsl:param>
		<fo:inline>
			<!-- Note: FOP does not support all '@style' values for underline -->
			<xsl:choose>            
				<xsl:when test="$renderer='FOP'">               
					<xsl:attribute name="text-decoration">overline</xsl:attribute>            
				</xsl:when>            
				<xsl:otherwise>               
					<xsl:choose>                  
						<xsl:when test="@style='double'">                     
							<xsl:attribute name="text-decoration">overline</xsl:attribute>                     
							<xsl:attribute name="border-top-style">solid</xsl:attribute>                     
							<xsl:attribute name="border-top-width">0.1mm</xsl:attribute>                  
						</xsl:when>                  
						<xsl:when test="@style='dash'">                     
							<xsl:attribute name="border-top-style">dashed</xsl:attribute>                     
							<xsl:attribute name="border-top-width">0.3mm</xsl:attribute>                  
						</xsl:when>                  
						<xsl:when test="@style='dots'">                     
							<xsl:attribute name="border-top-style">dotted</xsl:attribute>                     
							<xsl:attribute name="border-top-width">0.3mm</xsl:attribute>                  
						</xsl:when>                  
						<xsl:otherwise>                     
							<xsl:attribute name="text-decoration">overline</xsl:attribute>                  
						</xsl:otherwise>               
					</xsl:choose>            
				</xsl:otherwise>         
			</xsl:choose>
			<xsl:attribute name="vertical-align">
				<xsl:choose>
					<xsl:when test="name(ancestor::sup2)">
						<xsl:choose>
							<xsl:when test="name(ancestor::sub)">baseline</xsl:when>
							<xsl:otherwise>super</xsl:otherwise>
						</xsl:choose>
					</xsl:when>
					<xsl:when test="name(ancestor::sub2)">
						<xsl:choose>
							<xsl:when test="name(ancestor::sup)">baseline</xsl:when>
							<xsl:otherwise>sub</xsl:otherwise>
						</xsl:choose>
					</xsl:when>
					<xsl:otherwise>
						<xsl:choose>
							<xsl:when test="name(ancestor::sup)">super</xsl:when>
							<xsl:when test="name(ancestor::sub)">sub</xsl:when>
							<xsl:otherwise>baseline</xsl:otherwise>
						</xsl:choose>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:attribute>
			<xsl:apply-templates></xsl:apply-templates>      
		</fo:inline>   
	</xsl:template><xsl:template match="ul/li">      
		<fo:list-item>         
			<fo:list-item-label end-indent="label-end()">            
				<fo:block>               
					<xsl:choose>                  
						<xsl:when test="parent::ul[1]/@list-style='bullet'">                     
							<fo:inline>•</fo:inline>                  
						</xsl:when>                  
						<xsl:when test="parent::ul[1]/@list-style='dash'">                     
							<fo:inline>–</fo:inline>                  
						</xsl:when>                  
						<xsl:when test="parent::ul[1]/@list-style='none'">                     
							<fo:inline>
								<xsl:text> 
								</xsl:text>
							</fo:inline>                  
						</xsl:when>                  
						<xsl:otherwise>                     
							<xsl:text>•</xsl:text>                  
						</xsl:otherwise>               
					</xsl:choose>            
				</fo:block>         
			</fo:list-item-label>         
			<fo:list-item-body start-indent="body-start()">            
				<fo:block >
					<xsl:apply-templates></xsl:apply-templates>
					<!-- 21.09.2018: Modified so that a whitespace (i.e &#160;) will be added ONLY WHEN the text content is empty. --> 
					 <xsl:variable name="text">
						 <xsl:value-of select="./text()"></xsl:value-of>
					 </xsl:variable>
					<xsl:if test="$text = ''">
						<xsl:text> </xsl:text>
					</xsl:if>
				​</fo:block>
			</fo:list-item-body>      
		</fo:list-item>   
	</xsl:template><xsl:template name="enforcelinefeed">
		<fo:block text-align="left" height="17pt">
			<xsl:call-template name="enforcewhitespace"></xsl:call-template>
		</fo:block>
	</xsl:template><xsl:template name="enforcewhitespace">
		<xsl:text> </xsl:text> 
	</xsl:template>   
	<xsl:template match="doc-page">
	  <fo:block>
	   <fo:external-graphic>
			<xsl:if test="@type='pdf'">
				<xsl:attribute name="content-type">pdf</xsl:attribute>
			</xsl:if>
		<!-- NOTE: XEP will not load files in same directory if 'file:///' is prepended,
				   but FOP requires this  -->
			  <xsl:attribute name="src">
				 <xsl:choose>
					<xsl:when test="$baseDir != '' and not(contains(@file,'file:///'))">
						<xsl:value-of select="concat('file:///', $baseDir, @file)"></xsl:value-of>
					</xsl:when> 
					<!-- file is properly addressed -->
					<xsl:when test="contains(@file,'file')">
					   <xsl:value-of select="@file"></xsl:value-of>
					</xsl:when>
					<!-- create proper URI -->
					<xsl:otherwise>
						<xsl:value-of select="concat('file:///',translate(@file,'\','/'))"></xsl:value-of>
					</xsl:otherwise>
				 </xsl:choose>
				 <xsl:if test="@ppf">
					 <xsl:if test="@ppl">
						 <xsl:if test="@pp">
							<xsl:text>|</xsl:text>
							<xsl:value-of select="@ppf"></xsl:value-of>
							<xsl:text>;</xsl:text>
							<xsl:value-of select="@ppl"></xsl:value-of>
							<xsl:text>;</xsl:text>
							<xsl:value-of select="@pp"></xsl:value-of>
 	        	         </xsl:if>
        	         </xsl:if>
       	         </xsl:if>
			  </xsl:attribute>
			  <xsl:if test="@he">
				  <xsl:attribute name="content-height">
					 <xsl:choose>
						<xsl:when test="(contains(@he,'NaN'))"> 
							<xsl:value-of select="'scale-to-fit'"></xsl:value-of>
						</xsl:when>
						<xsl:when test="contains(@he,'mm') or contains(@he,'MM')">
						   <xsl:value-of select="@he"></xsl:value-of>
						</xsl:when>
						<xsl:otherwise>
						   <xsl:value-of select="@he"></xsl:value-of>mm</xsl:otherwise>
					 </xsl:choose>
				  </xsl:attribute>
			  </xsl:if>
			  <xsl:if test="@wi">
				  <xsl:attribute name="content-width">
					 <xsl:choose>
						<xsl:when test="(contains(@wi,'NaN'))"> 
							<xsl:value-of select="'scale-to-fit'"></xsl:value-of>
						</xsl:when>
						<xsl:when test="contains(@wi,'mm') or contains(@wi,'MM')">
						   <xsl:value-of select="@wi"></xsl:value-of>
						</xsl:when>
						<xsl:otherwise>
						   <xsl:value-of select="@wi"></xsl:value-of>mm</xsl:otherwise>
					 </xsl:choose>
				  </xsl:attribute>
			  </xsl:if>
		   </fo:external-graphic>
	  </fo:block>
   </xsl:template>   
	<xsl:template match="figure">
		<!-- 
***************************************************************************
* TABLE FOR DISPLAYING IMAGES:                                            *
* Since the image is scaled to the available block width (see note above),*
* the widths below will allow the height of max-sized images to fit into  *
* the containing block                                                    *
* NOTE:  the images will not scale correctly and will create extra pages  *
*        if there is no border-style attribute on each table cell, and if *
*        the border-style is set to 'none'.  Also note that FOP ver.      *
*        0.20_0_3 does not properly implement the border-style='hidden'   *
*        attribute, so it has been worked around by setting border colors * 
*        to 'white' (assuming that images will be black and white and page*
*        backgrounds will be white)                                       *
***************************************************************************
-->
		<!--Detect rule change of figure.-->
		<xsl:variable name="figure-label-text">
			<xsl:call-template name="figure-labels">
				<xsl:with-param name="labelTexts" select="@figure-labels" />
			</xsl:call-template>
		</xsl:variable>
		<fo:block>
			<xsl:attribute name="id">
				<xsl:choose>
					<xsl:when test="@id">
						<xsl:value-of select="@id"></xsl:value-of>
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="generate-id(.)"></xsl:value-of>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:attribute>
			<fo:table table-layout="fixed" keep-together.within-page="always">
				<!--vertical line for rule change (if rule changes are detected)--> 
				<xsl:if test="$figure-label-text != ''">
					<xsl:attribute name="border-collapse">separate</xsl:attribute>
					<xsl:attribute name="border-spacing">0px 1px</xsl:attribute>
				</xsl:if>
				<fo:table-column column-width="{$figure_content_column_width}mm"></fo:table-column>         
				<xsl:if test="$lang != 'ar' and not( contains( $fop_version, '0.2') ) and ( $fop_version != '') ">
					<fo:table-column column-width="{$rule_change_column_width}mm"></fo:table-column>         
				</xsl:if>
				<fo:table-body>
					<fo:table-row keep-with-next="always">         
						<fo:table-cell color="black">    
							<fo:block>
								<xsl:choose>
									<xsl:when test="$lang='ar'">
										<xsl:attribute name="text-align">right</xsl:attribute>
									</xsl:when>
									<xsl:when test="$lang='ja'">
											<xsl:attribute name="font-family"><xsl:value-of select="$serif_font"></xsl:value-of></xsl:attribute>
											<xsl:attribute name="font-weight">bold</xsl:attribute>
											<xsl:attribute name="font-size">12pt</xsl:attribute>
											<xsl:attribute name="text-align">left</xsl:attribute>
									</xsl:when>
									<xsl:otherwise>
										<xsl:attribute name="text-align">left</xsl:attribute>
									</xsl:otherwise>
								</xsl:choose>     
								<xsl:text>[</xsl:text>
								<xsl:call-template name="figure_ChoiceText"/>
								<xsl:value-of select="@num"></xsl:value-of>
								<xsl:text>]</xsl:text>
							</fo:block>
						</fo:table-cell>
						<xsl:if test="$lang != 'ar' and not( contains( $fop_version, '0.2') ) and ( $fop_version != '') ">
							<fo:table-cell number-rows-spanned="2">
								<!--vertical line for rule change (if rule changes are detected)--> 
								<xsl:if test="$figure-label-text != ''">
									<xsl:attribute name="border-left">solid 1.5pt black</xsl:attribute>
								</xsl:if>
								<!--put detected rule texts at the right margin-->
								<fo:block xsl:use-attribute-sets="rule_change">
									<xsl:copy-of select="$figure-label-text"/>
								</fo:block>
							</fo:table-cell>
						</xsl:if>
					</fo:table-row>            
					<fo:table-row keep-with-previous="always">               
						<fo:table-cell display-align="center" border-style="solid" border-width="0mm" border-color="white" vertical-align="middle">
							<fo:block>
								<!-- table cell that holds image (see notes above) -->
								<xsl:apply-templates></xsl:apply-templates>               
							</fo:block>
						</fo:table-cell>            
					</fo:table-row>         
				</fo:table-body>      
			</fo:table>   
		</fo:block>
	</xsl:template><xsl:template match="img"> 
		<xsl:call-template name="img_rendering"></xsl:call-template>
	</xsl:template>
	<xsl:template match="figure//img">
		<xsl:variable name="figure-label-text">
			<xsl:call-template name="figure-labels">
				<xsl:with-param name="labelTexts" select="ancestor::figure[1]/@figure-labels" />
			</xsl:call-template>
		</xsl:variable>
		<xsl:call-template name="img_rendering">
			<xsl:with-param name="max_width">
				<xsl:choose>
					<xsl:when test="$figure-label-text = ''">170</xsl:when>
					<!-- change max size when rule changes are detected-->
					<xsl:otherwise>160</xsl:otherwise>
				</xsl:choose>
			</xsl:with-param>
		</xsl:call-template>
	</xsl:template>
	<xsl:template match="claim-text//img">
		<xsl:call-template name="img_rendering">
			<xsl:with-param name="max_width">
				<xsl:value-of select="number($claim_content_column_width)"></xsl:value-of>
			</xsl:with-param>
		</xsl:call-template>
	</xsl:template><xsl:template match="p//img">
		<xsl:call-template name="img_rendering">
			<xsl:with-param name="max_width" select="number($p_content_column_width)"></xsl:with-param>
		</xsl:call-template>
	</xsl:template><xsl:template name="img_rendering">
		<xsl:param name="max_height" select="255"></xsl:param>
		<xsl:param name="max_width" select="170"></xsl:param>
		<!-- Calucate actual width and heigh in case they may overflow.
			According to PCT Annex f, images should be either A4 or Letter size, however the recommended maximum size is 255mm by 170mm.
			If the is greater than that, the size should be scaled in order to have enough margins.
			Also, img in paragraph or claim should be scaled based on their content width.
		-->
		<!-- 1. get an original size from attributes.
		        If it fails, below variables are NaN. -->
		<xsl:variable name="origWidthTemp" select="number(translate(@wi,'mM',''))"></xsl:variable>
		<xsl:variable name="origHeightTemp" select="number(translate(@he,'mM',''))"></xsl:variable>
		<xsl:variable name="origWidth">
			<xsl:choose>
				<xsl:when test="(not (contains( $fop_version, '1.1')) or not (contains( $fop_version, '0.2')) or not($fop_version = '' )) 
					and ($origWidthTemp = '0')">
					<xsl:value-of select="''"></xsl:value-of>
				</xsl:when>
				<xsl:otherwise><xsl:value-of select="$origWidthTemp"></xsl:value-of></xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		
		<xsl:variable name="origHeight">
			<xsl:choose>
				<xsl:when test=" (not (contains( $fop_version, '1.1')) or not (contains( $fop_version, '0.2')) or not($fop_version = '' )) 
					and ($origHeightTemp = '0')">
					<xsl:value-of select="''"></xsl:value-of>
				</xsl:when>
				<xsl:otherwise><xsl:value-of select="$origHeightTemp"></xsl:value-of></xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<!-- 2. limit height by max_height -->
		<xsl:variable name="resizedHeight_byMax">
			<xsl:choose>
				<xsl:when test="not(@he)">-1</xsl:when>
				<xsl:when test="$origHeight &lt;= $max_height">-1</xsl:when>
				<xsl:otherwise><xsl:value-of select="$max_height"></xsl:value-of></xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<!-- 3. scale width based on resizedHeight_byMax -->
		<xsl:variable name="resizedWidth_byHeight">
			<xsl:choose>
				<xsl:when test="not(@wi)">-1</xsl:when>
				<xsl:when test="$resizedHeight_byMax = '-1'">-1</xsl:when>
				<xsl:when test="string($origHeight) = 'NaN'">-1</xsl:when>
				<xsl:when test="string($origWidth) = 'NaN'">-1</xsl:when>
				<xsl:when test="$origHeight &lt;= number($resizedHeight_byMax)">-1</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="floor($origWidth * number($resizedHeight_byMax) div $origHeight)"></xsl:value-of>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<!-- 4. limit resizedWidth_byHeight based on max_width -->
		<xsl:variable name="resizedWidth">
			<xsl:choose>
				<xsl:when test="$resizedWidth_byHeight = '-1'">
					<xsl:choose>
						<xsl:when test="$origWidth &lt;= $max_width ">-1</xsl:when>
						<xsl:otherwise><xsl:value-of select="$max_width"></xsl:value-of></xsl:otherwise>
					</xsl:choose>
				</xsl:when>
				<xsl:otherwise>
					<xsl:choose>
						<xsl:when test="number($resizedWidth_byHeight) &lt;= $max_width ">
							<xsl:value-of select="$resizedWidth_byHeight"></xsl:value-of>
						</xsl:when>
						<xsl:otherwise><xsl:value-of select="$max_width"></xsl:value-of></xsl:otherwise>
					</xsl:choose>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<!-- 5. resize resizedHeight_byMax base on resizedWidth. -->
		<xsl:variable name="resizedHeight">
			<xsl:choose>
				<xsl:when test="$resizedHeight_byMax = '-1'">
					<xsl:choose>
						<xsl:when test="$resizedWidth = '-1' ">-1</xsl:when>
						<xsl:when test="string($origHeight) = 'NaN'">-1</xsl:when>
						<xsl:when test="string($origWidth) = 'NaN'">-1</xsl:when>
						<xsl:otherwise>
							<xsl:value-of select="floor($origHeight * number($resizedWidth) div $origWidth)"></xsl:value-of>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:when>
				<xsl:otherwise>
					<xsl:choose>
						<xsl:when test="number($resizedWidth_byHeight) &lt;= $max_width ">
							<xsl:value-of select="$resizedHeight_byMax"></xsl:value-of>
						</xsl:when>
						<xsl:when test="string($origHeight) = 'NaN'">-1</xsl:when>
						<xsl:when test="string($origWidth) = 'NaN'">-1</xsl:when>
						<xsl:otherwise>
							<xsl:value-of select="floor($origHeight * number($resizedWidth) div $origWidth)"></xsl:value-of>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<!-- NOTE: FOP should create breaks with <fo:block/>, but does not.  Placing contents inside of block -->
		<xsl:choose>
			<xsl:when test="@inline='yes' and ($resizedWidth &lt; ($p_content_column_width div 2)) and (@wi &lt; ($p_content_column_width div 2))">
				<fo:external-graphic vertical-align="text-top">
					<!-- NOTE: XEP will not load files in same directory if 'file:///' is prepended -->
					<xsl:attribute name="src">   
						<xsl:choose>
							<xsl:when test="$baseDir != '' and not(contains(@file,'file:///'))"> <!-- added for stylesheets with FOP1.1 -->
								<xsl:value-of select="concat('file:///', $baseDir, @file)"></xsl:value-of>
							</xsl:when>
							<xsl:when test="contains(@file,'file')"> 
								<xsl:value-of select="@file"></xsl:value-of>  
							</xsl:when>
							<xsl:when test="contains(@file,'/') or contains(@file,'\') or contains(@file,':')"> 
								<xsl:value-of select="concat('file:///',@file)"></xsl:value-of>  
							</xsl:when>  
							<xsl:otherwise> 
								<xsl:value-of select="@file"></xsl:value-of>  
							</xsl:otherwise>   
						</xsl:choose>
					</xsl:attribute>
					<!-- height will scale to available width -->
					<xsl:if test="@he">
						<xsl:attribute name="content-height">   
							<xsl:choose>  
								<xsl:when test="($resizedHeight!='-1') and (contains($resizedHeight,'NaN'))"> 
									<xsl:value-of select="'scale-to-fit'"></xsl:value-of>
								</xsl:when>	
								<xsl:when test="$resizedHeight!='-1'">
									<xsl:value-of select="$resizedHeight"></xsl:value-of>mm
								</xsl:when>
								<xsl:when test="contains(@he,'mm') or contains(@he,'MM')"> 
									<xsl:value-of select="@he"></xsl:value-of>  
								</xsl:when>  
								<xsl:otherwise> 
									<xsl:value-of select="@he"></xsl:value-of>mm
								</xsl:otherwise>   
							</xsl:choose>
						</xsl:attribute>
					</xsl:if>
					<xsl:if test="@wi">
						<xsl:attribute name="content-width">   
							<xsl:choose>
								<xsl:when test="($resizedWidth!='-1') and (contains($resizedWidth,'NaN'))"> 
									<xsl:value-of select="'scale-to-fit'"></xsl:value-of>
								</xsl:when> 								
								<xsl:when test="$resizedWidth!='-1'">
									<xsl:value-of select="$resizedWidth"></xsl:value-of>mm
								</xsl:when>  
								<xsl:when test="contains(@wi,'mm') or contains(@wi,'MM')"> 
									<xsl:value-of select="@wi"></xsl:value-of>  
								</xsl:when>  
								<xsl:otherwise>
									<xsl:value-of select="@wi"></xsl:value-of>mm
								</xsl:otherwise>   
							</xsl:choose>
						</xsl:attribute>
					</xsl:if>
					<xsl:if test="@id">
						<xsl:attribute name="id">
							<xsl:value-of select="@id"></xsl:value-of>
						</xsl:attribute>
					</xsl:if>       
				</fo:external-graphic>
				<xsl:value-of select="'&#x200B;'"/>
			</xsl:when>
			<xsl:otherwise>
				<fo:block>
					<fo:external-graphic>
						<!-- NOTE: XEP will not load files in same directory if 'file:///' is prepended -->
						<xsl:attribute name="src">   
							<xsl:choose>
								<xsl:when test="$baseDir != '' and not(contains(@file,'file:///'))"> <!-- added for stylesheets with FOP1.1 -->
									<xsl:value-of select="concat('file:///', $baseDir, @file)"></xsl:value-of>
								</xsl:when> 
								<xsl:when test="contains(@file,'file')"> 
									<xsl:value-of select="@file"></xsl:value-of>  
								</xsl:when>
								<xsl:when test="contains(@file,'/') or contains(@file,'\') or contains(@file,':')"> 
									<xsl:value-of select="concat('file:///',@file)"></xsl:value-of>  
								</xsl:when>  
								<xsl:otherwise> 
									<xsl:value-of select="@file"></xsl:value-of>  
								</xsl:otherwise>   
							</xsl:choose>
						</xsl:attribute>
						<!-- height will scale to available width -->
						<xsl:if test="@he">
							<xsl:attribute name="content-height">   
								<xsl:choose>  
									<xsl:when test="($resizedHeight!='-1') and (contains($resizedHeight,'NaN'))"> 
										<xsl:value-of select="'scale-to-fit'"></xsl:value-of>
									</xsl:when>
									<xsl:when test="$resizedHeight!='-1'">
										<xsl:value-of select="$resizedHeight"></xsl:value-of>mm
									</xsl:when>
									<xsl:when test="contains(@he,'mm') or contains(@he,'MM')"> 
										<xsl:value-of select="@he"></xsl:value-of>  
									</xsl:when>  
									<xsl:otherwise> 
										<xsl:value-of select="@he"></xsl:value-of>mm</xsl:otherwise>   
								</xsl:choose>
							</xsl:attribute>
						</xsl:if>
						<xsl:if test="@wi">
							<xsl:attribute name="content-width">   
								<xsl:choose>  
									<xsl:when test="($resizedWidth!='-1') and (contains($resizedWidth,'NaN'))"> 
										<xsl:value-of select="'scale-to-fit'"></xsl:value-of>
									</xsl:when>
									<xsl:when test="$resizedWidth!='-1'">
										<xsl:value-of select="$resizedWidth"></xsl:value-of>mm
									</xsl:when>  
									<xsl:when test="contains(@wi,'mm') or contains(@wi,'MM')"> 
										<xsl:value-of select="@wi"></xsl:value-of>  
									</xsl:when>  
									<xsl:otherwise>
										<xsl:value-of select="@wi"></xsl:value-of>mm</xsl:otherwise>   
								</xsl:choose>
							</xsl:attribute>
						</xsl:if>
						<xsl:if test="@id">
							<xsl:attribute name="id">
								<xsl:value-of select="@id"></xsl:value-of>
							</xsl:attribute>
						</xsl:if>       
					</fo:external-graphic>
				</fo:block>
			</xsl:otherwise>
		</xsl:choose>		
	</xsl:template>   
	<xsl:template match="location">
      <xsl:for-each select=".">
         <xsl:if test=".//pp">
            <xsl:call-template name="p_ChoiceText"></xsl:call-template>
            <xsl:choose>
               <xsl:when test=".//ppf">
                  <xsl:value-of select="normalize-space(.//ppf)"></xsl:value-of>
                  <xsl:if test=".//ppl">
                     <xsl:call-template name="to_ChoiceText"></xsl:call-template>
                     <xsl:value-of select="normalize-space(.//ppl)"></xsl:value-of>
                     <xsl:choose>
                        <xsl:when test=".//pp/following-sibling::*">
                           <xsl:text>, </xsl:text>							
                        </xsl:when>
                        <xsl:otherwise>
                           <xsl:call-template name="format_period">
                              <xsl:with-param name="string" select="normalize-space(.//ppl)"></xsl:with-param>
                           </xsl:call-template>
                        </xsl:otherwise>
                     </xsl:choose>
                  </xsl:if>
               </xsl:when>
               <xsl:otherwise>
                  <xsl:value-of select="normalize-space(.//pp)"></xsl:value-of>
                  <xsl:call-template name="format_period">
                     <xsl:with-param name="string" select="normalize-space(.//pp)"></xsl:with-param>
                  </xsl:call-template>
               </xsl:otherwise>
            </xsl:choose>
            <xsl:text> </xsl:text>
         </xsl:if>
         <xsl:if test=".//column">
            <xsl:call-template name="col_ChoiceText"></xsl:call-template>
            <xsl:choose>
               <xsl:when test=".//colf">
                  <xsl:value-of select="normalize-space(.//colf)"></xsl:value-of>
                  <xsl:if test=".//coll">
                     <xsl:call-template name="to_ChoiceText"></xsl:call-template>
                     <xsl:value-of select="normalize-space(.//coll)"></xsl:value-of>
                     <xsl:choose>
                        <xsl:when test=".//column/following-sibling::*">
                           <xsl:text>, </xsl:text>							
                        </xsl:when>
                        <xsl:otherwise>
                           <xsl:call-template name="format_period">
                              <xsl:with-param name="string" select="normalize-space(.//coll)"></xsl:with-param>
                           </xsl:call-template>
                        </xsl:otherwise>
                     </xsl:choose>
                  </xsl:if>
               </xsl:when>
               <xsl:otherwise>
                  <xsl:value-of select="normalize-space(.//column)"></xsl:value-of>
                  <xsl:call-template name="format_period">
                     <xsl:with-param name="string" select="normalize-space(.//column)"></xsl:with-param>
                  </xsl:call-template>
               </xsl:otherwise>
            </xsl:choose>
            <xsl:text> </xsl:text>
         </xsl:if>
         <xsl:if test=".//para">
            <xsl:call-template name="para_ChoiceText"></xsl:call-template>
            <xsl:choose>
               <xsl:when test=".//paraf">
                  <xsl:value-of select="normalize-space(.//paraf)"></xsl:value-of>
                  <xsl:if test=".//paral">
                     <xsl:call-template name="to_ChoiceText"></xsl:call-template>
                     <xsl:value-of select="normalize-space(.//paral)"></xsl:value-of>
                     <xsl:choose>
                        <xsl:when test=".//para/following-sibling::*">
                           <xsl:text>, </xsl:text>							
                        </xsl:when>
                        <xsl:otherwise>
                           <xsl:call-template name="format_period">
                              <xsl:with-param name="string" select="normalize-space(.//paral)"></xsl:with-param>
                           </xsl:call-template>
                        </xsl:otherwise>
                     </xsl:choose>
                  </xsl:if>
               </xsl:when>
               <xsl:otherwise>
                  <xsl:value-of select="normalize-space(.//para)"></xsl:value-of>
                  <xsl:call-template name="format_period">
                     <xsl:with-param name="string" select="normalize-space(.//para)"></xsl:with-param>
                  </xsl:call-template>
               </xsl:otherwise>
            </xsl:choose>
            <xsl:text> </xsl:text>
         </xsl:if>
         <xsl:if test=".//line">
            <xsl:call-template name="line_ChoiceText"></xsl:call-template>
            <xsl:choose>
               <xsl:when test=".//linef">
                  <xsl:value-of select="normalize-space(.//linef)"></xsl:value-of>
                  <xsl:if test=".//linel">
                     <xsl:call-template name="to_ChoiceText"></xsl:call-template>
                     <xsl:value-of select="normalize-space(.//linel)"></xsl:value-of>
                     <xsl:choose>
                        <xsl:when test=".//line/following-sibling::*">
                           <xsl:text>, </xsl:text>							
                        </xsl:when>
                        <xsl:otherwise>
                           <xsl:call-template name="format_period">
                              <xsl:with-param name="string" select="normalize-space(.//linel)"></xsl:with-param>
                           </xsl:call-template>
                        </xsl:otherwise>
                     </xsl:choose>
                  </xsl:if>
               </xsl:when>
               <xsl:otherwise>
                  <xsl:value-of select="normalize-space(.//line)"></xsl:value-of>
                  <xsl:call-template name="format_period">
                     <xsl:with-param name="string" select="normalize-space(.//line)"></xsl:with-param>
                  </xsl:call-template>
               </xsl:otherwise>
            </xsl:choose>
            <xsl:text> </xsl:text>
         </xsl:if>
      </xsl:for-each>
   </xsl:template>   
	<xsl:template match="online">
		<!-- param to pass the date to format_date template (formatting_functions.xsl) -->
		      
		<xsl:param name="date" select="normalize-space(./pubdate)"></xsl:param>      
		<xsl:choose>         
			<xsl:when test="./text">
				<!-- no sub-elements -->
				            
				<xsl:value-of select="."></xsl:value-of>         
			</xsl:when>         
			<xsl:otherwise>
				<!-- online sub-elements -->
				            
				<xsl:apply-templates select="author"></xsl:apply-templates>            
				<xsl:text>  
				</xsl:text>            
				<xsl:if test="./subname">
					<xsl:call-template name="format_full_name"></xsl:call-template>            
				</xsl:if>            
				<xsl:if test="./online-title">               
					<xsl:variable name="nTitle" select="normalize-space(./online-title)"></xsl:variable>               
					<xsl:variable name="nLen" select="string-length($nTitle)"></xsl:variable>               
					<xsl:choose>                  
						<xsl:when test="substring($nTitle,$nLen)='.'">                     
							<xsl:call-template name="rtrim">                        
								<xsl:with-param name="string" select="$nTitle"></xsl:with-param>                     
							</xsl:call-template>                  
						</xsl:when>                  
						<xsl:otherwise>                     
							<xsl:value-of select="$nTitle"></xsl:value-of>                  
						</xsl:otherwise>               
					</xsl:choose>               
					<xsl:choose>                  
						<xsl:when test="ancestor::nplcit[1]/@medium">                     
							<xsl:text> [</xsl:text>                     
							<xsl:value-of select="normalize-space(ancestor::nplcit[1]/@medium)"></xsl:value-of>                     
							<xsl:text>].  </xsl:text>                  
						</xsl:when>                  
						<xsl:otherwise>                     
							<xsl:call-template name="online_ChoiceText"></xsl:call-template>                  
						</xsl:otherwise>               
					</xsl:choose>            
				</xsl:if>            
				<xsl:if test="./subname">               
					<xsl:apply-templates select="subname"></xsl:apply-templates>            
				</xsl:if>
				<!-- test for comma -->
				            
				<xsl:choose>
					<!-- book | serial -->
					               
					<xsl:when test=".//book-title">                  
						<fo:inline font-style="italic">                     
							<xsl:value-of select=".//book-title"></xsl:value-of>                     
							<xsl:call-template name="format_period">                        
								<xsl:with-param name="string" select="normalize-space(.//book-title)"></xsl:with-param>                     
							</xsl:call-template>                     
							<xsl:text>  
							</xsl:text>                  
						</fo:inline>               
					</xsl:when>               
					<xsl:otherwise>
						<!-- serial -->
						                  
						<fo:inline font-style="italic">                     
							<xsl:value-of select="normalize-space(.//sertitle)"></xsl:value-of>                  
						</fo:inline>                  
						<xsl:text>  
						</xsl:text> 
               
					</xsl:otherwise>            
				</xsl:choose>
				<!-- end book-title | sertitle -->
				            
				<xsl:if test=".//vid">               
					<xsl:call-template name="vid_ChoiceText"></xsl:call-template>               
					<xsl:value-of select=".//vid"></xsl:value-of>               
					<xsl:call-template name="format_comma">                  
						<xsl:with-param name="string" select="normalize-space(.//vid)"></xsl:with-param>               
					</xsl:call-template>            
				</xsl:if>            
				<xsl:if test=".//ino">               
					<xsl:call-template name="ino_ChoiceText"></xsl:call-template>               
					<xsl:value-of select=".//ino"></xsl:value-of>               
					<xsl:choose>
						<!-- if location elements present, write comma -->
						                  
						<xsl:when test=".//location">                     
							<xsl:call-template name="format_comma">                        
								<xsl:with-param name="string" select="normalize-space(.//ino)"></xsl:with-param>                     
							</xsl:call-template>                  
						</xsl:when>                  
						<xsl:otherwise>
							<!-- end with period -->
							                     
							<xsl:call-template name="format_period">                        
								<xsl:with-param name="string" select="normalize-space(.//ino)"></xsl:with-param>                     
							</xsl:call-template>                  
						</xsl:otherwise>               
					</xsl:choose>            
				</xsl:if>            
				<xsl:choose>               
					<xsl:when test="./pubdate/sdate | ./pubdate/edate">                  
						<xsl:call-template name="format_date">  
                     
							<xsl:with-param name="date" select="normalize-space(./pubdate/sdate)"></xsl:with-param>                     
							<xsl:with-param name="text" select="1"></xsl:with-param>                     
							<xsl:with-param name="show_date" select="1"></xsl:with-param>                     
							<xsl:with-param name="lang" select="$lang"></xsl:with-param>                  
						</xsl:call-template>                  
						<xsl:if test="./pubdate/edate">                     
							<xsl:call-template name="revised_ChoiceText"></xsl:call-template>                     
							<xsl:call-template name="format_date">  
                        
								<xsl:with-param name="date" select="normalize-space(./pubdate/edate)"></xsl:with-param>                        
								<xsl:with-param name="text" select="1"></xsl:with-param>                        
								<xsl:with-param name="show_date" select="1"></xsl:with-param>                        
								<xsl:with-param name="lang" select="$lang"></xsl:with-param>                     
							</xsl:call-template>                     
							<xsl:text>. </xsl:text>                  
						</xsl:if>               
					</xsl:when>               
					<xsl:when test=" ./pubdate/text()">                  
						<xsl:call-template name="format_date">  
                     
							<xsl:with-param name="date" select="normalize-space(./pubdate)"></xsl:with-param>                     
							<xsl:with-param name="text" select="1"></xsl:with-param>                     
							<xsl:with-param name="show_date" select="1"></xsl:with-param>                     
							<xsl:with-param name="lang" select="$lang"></xsl:with-param>                  
						</xsl:call-template>                  
						<xsl:text>. </xsl:text>               
					</xsl:when>            
				</xsl:choose>            
				<xsl:if test="./edition">               
					<xsl:value-of select="./edition"></xsl:value-of>               
					<xsl:call-template name="format_comma">                  
						<xsl:with-param name="string" select="normalize-space(./edition)"></xsl:with-param>               
					</xsl:call-template>            
				</xsl:if>            
				<xsl:if test="./imprint">               
					<xsl:choose>                  
						<xsl:when test=".//address/text">                     
							<xsl:value-of select="normalize-space(.//imprint/address/text)"></xsl:value-of>                  
						</xsl:when>                  
						<xsl:otherwise>                     
							<xsl:if test=".//address/city">                        
								<xsl:value-of select=".//address/city"></xsl:value-of>
								<!-- if followed by <state>, display comma then state -->
								                        
								<xsl:if test=".//following-sibling::state">                           
									<xsl:call-template name="format_comma">                              
										<xsl:with-param name="string" select="normalize-space(.//address/city)"></xsl:with-param>                           
									</xsl:call-template>                        
								</xsl:if>                     
							</xsl:if>                     
							<xsl:if test=".//address/state">                        
								<xsl:value-of select=".//address/state"></xsl:value-of>                     
							</xsl:if>                  
						</xsl:otherwise>               
					</xsl:choose>            
				</xsl:if>            
				<xsl:if test="./imprint/name">               
					<xsl:if test="./imprint/name/preceding-sibling::address">                  
						<xsl:text>: </xsl:text>               
					</xsl:if>               
					<xsl:value-of select="normalize-space(./imprint/name)"></xsl:value-of>            
				</xsl:if>            
				<xsl:if test="./imprint/pubdate">               
					<xsl:text> 
					</xsl:text>               
					<xsl:if test=".//pubdate/child::text()">                  
						<xsl:call-template name="format_date">  
                     
							<xsl:with-param name="date" select="normalize-space(.//pubdate)"></xsl:with-param>                     
							<xsl:with-param name="text" select="1"></xsl:with-param>                     
							<xsl:with-param name="lang" select="$lang"></xsl:with-param>                  
						</xsl:call-template>               
					</xsl:if>            
				</xsl:if>            
				<xsl:if test="datecit">               
					<xsl:call-template name="datecit_ChoiceText"></xsl:call-template>               
					<xsl:call-template name="format_date">  
                  
						<xsl:with-param name="date" select="normalize-space(./datecit/date)"></xsl:with-param>                  
						<xsl:with-param name="lang" select="$lang"></xsl:with-param>               
					</xsl:call-template>               
					<xsl:text>]. </xsl:text>            
				</xsl:if>            
				<xsl:apply-templates select="location"></xsl:apply-templates>            
				<xsl:if test="notes">               
					<xsl:value-of select="notes"></xsl:value-of>               
					<xsl:call-template name="format_period">                  
						<xsl:with-param name="string" select="normalize-space(notes)"></xsl:with-param>               
					</xsl:call-template>            
				</xsl:if>            
				<xsl:call-template name="retrievedFrom_ChoiceText"></xsl:call-template>            
				<xsl:text>&lt;</xsl:text>            
				<xsl:value-of select="./avail"></xsl:value-of>            
				<xsl:text>&gt;</xsl:text>            
				<xsl:call-template name="format_period">               
					<xsl:with-param name="string" select="normalize-space(./avail)"></xsl:with-param>            
				</xsl:call-template>            
				<xsl:if test="./issn">               
					<xsl:call-template name="issn_ChoiceText"></xsl:call-template>               
					<xsl:value-of select="normalize-space(./issn)"></xsl:value-of>               
					<xsl:call-template name="format_period">                  
						<xsl:with-param name="string" select="normalize-space(./issn)"></xsl:with-param>               
					</xsl:call-template>            
				</xsl:if>            
				<xsl:if test="./isbn">               
					<xsl:call-template name="isbn_ChoiceText"></xsl:call-template>               
					<xsl:value-of select="normalize-space(./isbn)"></xsl:value-of>               
					<xsl:call-template name="format_period">                  
						<xsl:with-param name="string" select="normalize-space(./isbn)"></xsl:with-param>               
					</xsl:call-template>            
				</xsl:if>         
			</xsl:otherwise>
			<!-- end article subelements (not <text>) -->
			      
		</xsl:choose>   
	</xsl:template>   
	<xsl:template match="patcit">      
		<fo:block>         
			<xsl:attribute name="id">            
				<xsl:value-of select="@id"></xsl:value-of>         
			</xsl:attribute>
			<xsl:choose>
				<xsl:when test="$lang='ar'">
					<xsl:text>مستند</xsl:text>
					<xsl:value-of select="@num"></xsl:value-of>
					<xsl:text>：</xsl:text>
				</xsl:when>
				<xsl:when test="$lang='ja'">
					<xsl:text>特許文献</xsl:text>
					<xsl:value-of select="@num"></xsl:value-of>
					<xsl:text>：</xsl:text>
				</xsl:when>
				<xsl:when test="$lang='zh'">
					<xsl:text>专利文献</xsl:text>
					<xsl:value-of select="@num"></xsl:value-of>
					<xsl:text>: </xsl:text>
				</xsl:when>
				<xsl:when test="$lang='ko'">
					<xsl:text>특허 문헌</xsl:text>
					<xsl:value-of select="@num"></xsl:value-of>
					<xsl:text>: </xsl:text> 
				</xsl:when>
				<xsl:when test="$lang='ru'">
					<xsl:text>Патентная литература </xsl:text>
					<xsl:value-of select="@num"></xsl:value-of>
					<xsl:text>: </xsl:text> 
				</xsl:when>
				<xsl:when test="$lang='it'">
					<xsl:text>PTL </xsl:text>
					<xsl:value-of select="@num"></xsl:value-of>
					<xsl:text>: </xsl:text> 
				</xsl:when>
				<xsl:when test="$lang='en'">
					<xsl:choose>
						<xsl:when test="$dtd-version &gt;= 1.6">
							<xsl:text>PTL </xsl:text>
						</xsl:when>
						<xsl:otherwise>
							<xsl:text>Patent Citation </xsl:text>
						</xsl:otherwise>
					</xsl:choose>
					<xsl:value-of select="@num"></xsl:value-of>
					<xsl:text>: </xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>patcit</xsl:text>
					<xsl:value-of select="@num"></xsl:value-of>
					<xsl:text>:</xsl:text>
				</xsl:otherwise>
			</xsl:choose>         
			<xsl:apply-templates></xsl:apply-templates>         
			<xsl:if test="@url">            
				<xsl:text> 
				</xsl:text>            
				<fo:inline color="blue">        		(<fo:basic-link external-destination="{@url}">                  
						<xsl:value-of select="@url"></xsl:value-of>               
					</fo:basic-link>).
				</fo:inline>         
			</xsl:if>      
		</fo:block>   
	</xsl:template><xsl:template match="document-id">      
		<fo:inline>         
			<xsl:value-of select="country"></xsl:value-of>         
			<xsl:text> 
			</xsl:text>         
			<xsl:value-of select="doc-number"></xsl:value-of>         
			<xsl:text> 
			</xsl:text>         
			<xsl:value-of select="kind"></xsl:value-of>         
			<xsl:text> 
			</xsl:text>         
			<xsl:if test="name"> 
				<xsl:choose>
					<xsl:when test="starts-with(name,'(')">   
						<xsl:value-of select="translate(normalize-space(name),'abcdefghijklmnopqrstuvwxyzÃƒÂ ÃƒÂ¡ÃƒÂ¢ÃƒÂ£ÃƒÂ¤ÃƒÂ¥ÃƒÂ¦ÃƒÂ§ÃƒÂ¨ÃƒÂ©ÃƒÂªÃƒÂ«ÃƒÂ¬ÃƒÂ­ÃƒÂ®ÃƒÂ¯ÃƒÂ°ÃƒÂ±ÃƒÂ²ÃƒÂ³ÃƒÂ´ÃƒÂµÃƒÂ¶ÃƒÂ¸ÃƒÂ¹ÃƒÂºÃƒÂ»ÃƒÂ¼ÃƒÂ½ÃƒÂ¾Ã�Â°Ã�Â±Ã�Â²Ã�Â³Ã�Â´Ã�ÂµÃ�Â¶Ã�Â·Ã�Â¸Ã�Â¹Ã�ÂºÃ�Â»Ã�Â¼Ã�Â½Ã�Â¾Ã�Â¿Ã‘â‚¬Ã‘ï¿½Ã‘â€šÃ‘Æ’Ã‘â€žÃ‘â€¦Ã‘â€ Ã‘â€¡Ã‘Ë†Ã‘â€°Ã‘Å Ã‘â€¹Ã‘Å’Ã‘ï¿½Ã‘Å½Ã‘ï¿½','ABCDEFGHIJKLMNOPQRSTUVWXYZÃƒâ‚¬Ãƒï¿½Ãƒâ€šÃƒÆ’Ãƒâ€žÃƒâ€¦Ãƒâ€ Ãƒâ€¡ÃƒË†Ãƒâ€°ÃƒÅ Ãƒâ€¹ÃƒÅ’Ãƒï¿½ÃƒÅ½Ãƒï¿½Ãƒï¿½Ãƒâ€˜Ãƒâ€™Ãƒâ€œÃƒâ€�Ãƒâ€¢Ãƒâ€“ÃƒËœÃƒâ„¢ÃƒÅ¡Ãƒâ€ºÃƒÅ“Ãƒï¿½ÃƒÅ¾Ã�ï¿½Ã�â€˜Ã�â€™Ã�â€œÃ�â€�Ã�â€¢Ã�â€“Ã�â€”Ã�ËœÃ�â„¢Ã�Å¡Ã�â€ºÃ�Å“Ã�ï¿½Ã�Å¾Ã�Å¸Ã�Â Ã�Â¡Ã�Â¢Ã�Â£Ã�Â¤Ã�Â¥Ã�Â¦Ã�Â§Ã�Â¨Ã�Â©Ã�ÂªÃ�Â«Ã�Â¬Ã�Â­Ã�Â®Ã�Â¯')"></xsl:value-of>
					</xsl:when>
					<xsl:otherwise>   
						<xsl:text>(</xsl:text>   
						<xsl:value-of select="translate(normalize-space(name),'abcdefghijklmnopqrstuvwxyzÃƒÂ ÃƒÂ¡ÃƒÂ¢ÃƒÂ£ÃƒÂ¤ÃƒÂ¥ÃƒÂ¦ÃƒÂ§ÃƒÂ¨ÃƒÂ©ÃƒÂªÃƒÂ«ÃƒÂ¬ÃƒÂ­ÃƒÂ®ÃƒÂ¯ÃƒÂ°ÃƒÂ±ÃƒÂ²ÃƒÂ³ÃƒÂ´ÃƒÂµÃƒÂ¶ÃƒÂ¸ÃƒÂ¹ÃƒÂºÃƒÂ»ÃƒÂ¼ÃƒÂ½ÃƒÂ¾Ã�Â°Ã�Â±Ã�Â²Ã�Â³Ã�Â´Ã�ÂµÃ�Â¶Ã�Â·Ã�Â¸Ã�Â¹Ã�ÂºÃ�Â»Ã�Â¼Ã�Â½Ã�Â¾Ã�Â¿Ã‘â‚¬Ã‘ï¿½Ã‘â€šÃ‘Æ’Ã‘â€žÃ‘â€¦Ã‘â€ Ã‘â€¡Ã‘Ë†Ã‘â€°Ã‘Å Ã‘â€¹Ã‘Å’Ã‘ï¿½Ã‘Å½Ã‘ï¿½','ABCDEFGHIJKLMNOPQRSTUVWXYZÃƒâ‚¬Ãƒï¿½Ãƒâ€šÃƒÆ’Ãƒâ€žÃƒâ€¦Ãƒâ€ Ãƒâ€¡ÃƒË†Ãƒâ€°ÃƒÅ Ãƒâ€¹ÃƒÅ’Ãƒï¿½ÃƒÅ½Ãƒï¿½Ãƒï¿½Ãƒâ€˜Ãƒâ€™Ãƒâ€œÃƒâ€�Ãƒâ€¢Ãƒâ€“ÃƒËœÃƒâ„¢ÃƒÅ¡Ãƒâ€ºÃƒÅ“Ãƒï¿½ÃƒÅ¾Ã�ï¿½Ã�â€˜Ã�â€™Ã�â€œÃ�â€�Ã�â€¢Ã�â€“Ã�â€”Ã�ËœÃ�â„¢Ã�Å¡Ã�â€ºÃ�Å“Ã�ï¿½Ã�Å¾Ã�Å¸Ã�Â Ã�Â¡Ã�Â¢Ã�Â£Ã�Â¤Ã�Â¥Ã�Â¦Ã�Â§Ã�Â¨Ã�Â©Ã�ÂªÃ�Â«Ã�Â¬Ã�Â­Ã�Â®Ã�Â¯')"></xsl:value-of>   
						<xsl:text>).</xsl:text>
					</xsl:otherwise> 
				</xsl:choose> 
			</xsl:if>         
			<xsl:text> 
			</xsl:text>         
			<xsl:call-template name="format_date">  
            
				<xsl:with-param name="date" select="normalize-space(.//date)"></xsl:with-param>         
			</xsl:call-template>         
			<xsl:call-template name="format_period">            
				<xsl:with-param name="string" select="normalize-space(.//date)"></xsl:with-param>         
			</xsl:call-template>         
			<xsl:text> 
			</xsl:text>      
		</fo:inline>   
	</xsl:template><xsl:template match="rel-passage">      
		<xsl:for-each select="./*">         
			<xsl:choose>            
				<xsl:when test="substring(normalize-space(.),string-length(normalize-space(.)))='.'">               
					<xsl:value-of select="."></xsl:value-of>            
				</xsl:when>            
				<xsl:otherwise>               
					<xsl:value-of select="."></xsl:value-of>               
					<xsl:text>. </xsl:text>            
				</xsl:otherwise>         
			</xsl:choose>      
		</xsl:for-each>   
	</xsl:template>   
	<xsl:template match="serial">
        <fo:inline font-style="italic">
            <xsl:value-of select="normalize-space(.//sertitle)"></xsl:value-of>
            <xsl:choose>
				<!-- if there's following info, format with a comma -->
				<xsl:when test=".//ino | .//vid ">
					<xsl:call-template name="format_comma">
						<xsl:with-param name="string" select="normalize-space(.//sertitle)"></xsl:with-param>
					</xsl:call-template>
				</xsl:when>
					<!-- otherwise, use a period -->
				<xsl:otherwise>
					<xsl:call-template name="format_comma">
						<xsl:with-param name="string" select="normalize-space(.//sertitle)"></xsl:with-param>
					</xsl:call-template>
				</xsl:otherwise>
            </xsl:choose>
            <xsl:text> </xsl:text>
            <xsl:value-of select="alttitle"></xsl:value-of>
        </fo:inline>
        <xsl:text>  </xsl:text> 
        <xsl:call-template name="format_full_name"></xsl:call-template>
        <xsl:text>  </xsl:text> 
        <xsl:value-of select="issue"></xsl:value-of>
        <xsl:text>  </xsl:text> 
        <xsl:value-of select="imprint"></xsl:value-of>
        <xsl:text>  </xsl:text> 
        <xsl:value-of select="pubdate"></xsl:value-of>
        <xsl:text>  </xsl:text> 
        <xsl:value-of select="descrip"></xsl:value-of>
        <xsl:text>  </xsl:text> 
        <xsl:value-of select="notes"></xsl:value-of>
   </xsl:template>   
	<xsl:template match="table-external-doc">
		<xsl:apply-templates></xsl:apply-templates>
	</xsl:template><xsl:template match="tables">      
		<xsl:choose>
			<xsl:when test="@num != ''">
				<fo:table table-layout="fixed" keep-together.within-page="auto">
					<fo:table-column></fo:table-column>
					<fo:table-body>
						<fo:table-row>
							<fo:table-cell>
								<fo:block id="{@id}">
									<xsl:choose>
										<xsl:when test="$lang='ar'">
											<xsl:text>جدول </xsl:text>
											<xsl:value-of select="@num"></xsl:value-of>
										</xsl:when>
										<xsl:when test="$lang='ja'">
											<xsl:text>[表</xsl:text>
											<xsl:value-of select="@num"></xsl:value-of>
											<xsl:text>]</xsl:text>
										</xsl:when>
										<xsl:when test="$lang='fr'">
											<xsl:text>[Tableaux</xsl:text>
											<xsl:value-of select="@num"></xsl:value-of>
											<xsl:text>]</xsl:text>
										</xsl:when>
										<xsl:when test="$lang='de'">
											<xsl:text>[Tabellen</xsl:text>
											<xsl:value-of select="@num"></xsl:value-of>
											<xsl:text>]</xsl:text>
										</xsl:when>
										<xsl:when test="$lang='zh'">
											<xsl:text>[表</xsl:text>
											<xsl:value-of select="@num"></xsl:value-of>
											<xsl:text>]</xsl:text>
										</xsl:when>
										<xsl:when test="$lang='ko'">
											<xsl:text>[표</xsl:text>
											<xsl:value-of select="@num"></xsl:value-of>
											<xsl:text>]</xsl:text>
										</xsl:when>
										<xsl:when test="$lang='ru'">
											<xsl:text>[Таблица </xsl:text>
											<xsl:value-of select="@num"></xsl:value-of>
											<xsl:text>]</xsl:text>
										</xsl:when>
										<xsl:when test="$lang='it'">
											<xsl:text>[Tavola </xsl:text>
											<xsl:value-of select="@num"></xsl:value-of>
											<xsl:text>]</xsl:text>
										</xsl:when>
										<xsl:otherwise>
											<xsl:text>[Table </xsl:text>
											<xsl:value-of select="@num"></xsl:value-of>
											<xsl:text>]</xsl:text>
										</xsl:otherwise>
									</xsl:choose>
								</fo:block>
							</fo:table-cell>
						</fo:table-row>
						<fo:table-row>
							<fo:table-cell>
								<fo:block>
									<xsl:apply-templates></xsl:apply-templates>
								</fo:block>
							</fo:table-cell>
						</fo:table-row>
					</fo:table-body>
				</fo:table>
			</xsl:when>
			<xsl:otherwise>
				<xsl:apply-templates></xsl:apply-templates>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template><xsl:template match="table">      
		<xsl:apply-templates select="./title"></xsl:apply-templates>
		<xsl:apply-templates select="./tgroup"></xsl:apply-templates>
	</xsl:template><xsl:template match="title">   
		<fo:block>   
			<xsl:apply-templates></xsl:apply-templates>   
		</fo:block>      
	</xsl:template><xsl:template name="colsep">
		<xsl:if test="following-sibling::entry or parent::row/preceding-sibling::row/entry[position() = position()]/@morerows">
			<xsl:variable name="rowPos" select="position()"></xsl:variable>
			<!-- if entry has a colsep, overrides all prev. declarations -->
			<xsl:choose>
				<xsl:when test="ancestor::tables/@num = '' and ancestor::table/@frame = 'none'">
					<xsl:attribute name="border"></xsl:attribute>
				</xsl:when>
				<xsl:when test="@colsep &gt; 0                                                                  or (not(@colsep)                     and not(@namest)                   and not(preceding-sibling::entry/@nameend)                   and not(following-sibling::entry/@nameend)                and ancestor::tgroup[1]/child::colspec[position()=$rowPos][@colsep &gt; 0])                or (not(@colsep)                                  and not(ancestor::tgroup[1]/@colsep)                            and (ancestor::table[1][@colsep &gt; 0]                               or not(ancestor::table[1]/@colsep)))                 or (not(@colsep)                                   and ancestor::tgroup[1][@colsep &gt; 0])"> 
					<xsl:attribute name="border-right">solid black 0.5pt</xsl:attribute>           
				</xsl:when>
				<!-- a preceding row had declared a colsep, but that row was vertically spanned -->
				<xsl:when test="parent::row/preceding-sibling::row/entry[position() = position()]/@morerows">
					<xsl:attribute name="border-right">solid black 0.5pt</xsl:attribute>   
				</xsl:when>
				<!-- span somewhere in current row -->
				<xsl:when test="parent::row/child::entry/@nameend">
					<xsl:variable name="end">
						<xsl:value-of select="@nameend"></xsl:value-of>
					</xsl:variable>
					<!-- if this entry is the end of span and declared with a colspec/@colsep -->
					<xsl:if test="ancestor::tgroup[1]/child::colspec[@colname=$end][@colsep &gt; '0']                           or not(@nameend)                              and ancestor::tgroup[1]/child::colspec[position()=$rowPos][@colsep &gt; '0']                             and not(preceding-sibling::entry/@nameend)">
						<xsl:attribute name="border-right">solid black 0.5pt</xsl:attribute>           
					</xsl:if>
				</xsl:when>
			</xsl:choose>
		</xsl:if>
	</xsl:template><xsl:template name="rowsep">
		<!-- dont apply borders on last row of table; allow for thead, tbody -->
		<xsl:if test="parent::row/parent::*/following-sibling::*/child::row or parent::row/following-sibling::row">
			<xsl:variable name="rowPos" select="position()"></xsl:variable>
			<!-- if entry has a rowsep, overrides all prev. declarations -->
			<xsl:choose>
				<xsl:when test="ancestor::tables/@num = '' and ancestor::table/@frame = 'none'">
					<xsl:attribute name="border"></xsl:attribute>
				</xsl:when>
				<xsl:when test="@rowsep &gt; 0                           or not(@rowsep='0') and parent::row[@rowsep &gt; 0]                            or ancestor::tgroup[1]/colspec[position() = $rowPos][@rowsep &gt; 0]                               and not(preceding-sibling::entry/@nameend)                              or not(@rowsep)                                        and not(ancestor::tgroup[1]/@rowsep)                       and (ancestor::table[1][@rowsep &gt; 0]                                   or not(ancestor::table[1]/@rowsep))                     or (not(@rowsep)                                       and ancestor::tgroup[1][@rowsep &gt; 0])">
					<xsl:attribute name="border-bottom">solid black 0.5pt</xsl:attribute>      
				</xsl:when>
				<!-- span somewhere in current row -->
				<xsl:when test="parent::row/child::entry/@nameend">
					<!-- 				
					Get current entry position
					get total # of entrys in row
					get number-cols-spanned (calc.span)
					If (position() + $number-columns-spanned) = parent::tgroup[1]/colspec[position() + $number-columns-spanned]/@rowsep
					then show border-bottom					-->
					<xsl:variable name="cols" select="count(ancestor::tgroup[1]/colspec)"></xsl:variable>
					<xsl:variable name="entries" select="count(parent::row/entry)"></xsl:variable>
					<!-- if there is a span somewhere in this row, figure out which columns are spanned
				     and apply rowseps in correct locations -->
					<xsl:variable name="spanned">
						<xsl:call-template name="calc.span">
							<xsl:with-param name="namest">
								<xsl:value-of select="parent::row/entry/@namest"></xsl:value-of>
							</xsl:with-param>
							<xsl:with-param name="nameend">
								<xsl:value-of select="parent::row/entry/@nameend"></xsl:value-of>
							</xsl:with-param>
						</xsl:call-template>
					</xsl:variable>    
					<xsl:variable name="col">
						<xsl:value-of select="$rowPos + ($spanned -1)"></xsl:value-of>
					</xsl:variable>
					<xsl:if test="not(@nameend)                              and ancestor::tgroup[1]/child::colspec[position() = $col][@rowsep &gt; '0']">
						<xsl:variable name="pos">
							<xsl:value-of select="$rowPos + ($spanned - 1)"></xsl:value-of>
						</xsl:variable>
						<xsl:if test="ancestor::tgroup[1]/colspec[position() = $pos][@rowsep &gt; 0]">
							<xsl:attribute name="border-bottom">solid black 0.5pt</xsl:attribute>      
						</xsl:if>
					</xsl:if>
				</xsl:when>
			</xsl:choose>
		</xsl:if>
	</xsl:template><xsl:template match="tgroup">   
		<xsl:for-each select=".">  
			<xsl:variable name="colCount">
				<xsl:value-of select="count(./colspec)"></xsl:value-of>
			</xsl:variable>
			<xsl:variable name="table_width">
				<xsl:choose>
					<xsl:when test="./colspec[contains(@colwidth,'*')]">
						<xsl:for-each select="./colspec">
							<xsl:if test="contains(@colwidth,'*')">
								<xsl:value-of select="($page_width - 62) div $colCount"></xsl:value-of>mm<xsl:if test="not(position()=last())">+</xsl:if>
							</xsl:if>
						</xsl:for-each>
					</xsl:when>
					<xsl:otherwise>
						<xsl:for-each select="./colspec">
							<xsl:call-template name="calc.column.width">
								<xsl:with-param name="colwidth" select="@colwidth"></xsl:with-param>
							</xsl:call-template>
							<xsl:if test="following-sibling::colspec"> + </xsl:if>
						</xsl:for-each>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:variable>
			<fo:table table-layout="fixed" space-before="1.5mm" space-after="1.5mm" width="{$table_width}" keep-together.within-page="1">
				<xsl:choose>
					<xsl:when test="parent::table[1]/@frame='sides'">
						<xsl:attribute name="border-right">solid black 0.5pt</xsl:attribute>
						<xsl:attribute name="border-left">solid black 0.5pt</xsl:attribute> 
					</xsl:when>
					<xsl:when test="parent::table[1]/@frame='sides'">
						<xsl:attribute name="border-right">solid black 0.5pt</xsl:attribute>
						<xsl:attribute name="border-left">solid black 0.5pt</xsl:attribute> 
					</xsl:when>
					<xsl:when test="parent::table[1]/@frame='top'">            
						<xsl:attribute name="border-top">solid black 0.5pt</xsl:attribute>         
					</xsl:when>         
					<xsl:when test="parent::table[1]/@frame='bottom'">            
						<xsl:attribute name="border-bottom">solid black 0.5pt</xsl:attribute>         
					</xsl:when>         
					<xsl:when test="parent::table[1]/@frame='topbot'">            
						<xsl:attribute name="border-top">solid black 0.5pt</xsl:attribute>            
						<xsl:attribute name="border-bottom">solid black 0.5pt</xsl:attribute>         
					</xsl:when>   
					<xsl:when test="parent::table[1]/@frame='all'">            
						<xsl:attribute name="border">solid black 0.5pt</xsl:attribute>         
					</xsl:when>         
					<xsl:when test="parent::table[1]/@frame='none'"></xsl:when>            
					<xsl:when test="not(parent::table[1]/@frame)">
						<!-- 'all' is default.  See http://oasis-open.org/specs/tm9901.html -->
						<xsl:attribute name="border">solid black 0.5pt</xsl:attribute>         
					</xsl:when>
				</xsl:choose>
				<xsl:choose>
					<xsl:when test="./colspec">
						<!-- if there's <colspec> elements, -->
						<xsl:apply-templates></xsl:apply-templates> 
						<!-- apply that template -->
					</xsl:when>
					<xsl:otherwise> 
						<!-- if no <colspec>, create them  -->
						
						<!-- avail space = page-width - margins (27,20) - number column of para (15) -->
						<xsl:variable name="avail_space" select="$page_width - 62"></xsl:variable> 
						<xsl:for-each select=".//row">
							<!-- sort <row>s by number of <entry>s -->
							<xsl:sort select="count(./entry)" order="descending"></xsl:sort>
							<!-- the first row will have the most <entry>s -->
							<xsl:if test="position() = 1"> 						   
								<xsl:variable name="col_count" select="count(./entry)"></xsl:variable>   
								<xsl:for-each select="entry">  
									<xsl:element name="fo:table-column"> 
										<xsl:attribute name="column-number">
											<xsl:value-of select="position()"></xsl:value-of> 
										</xsl:attribute> 
										<xsl:attribute name="column-width">
											<xsl:value-of select="round(($avail_space - 10) div $col_count )"></xsl:value-of>mm</xsl:attribute>  
									</xsl:element>   
								</xsl:for-each>
							</xsl:if> 
						</xsl:for-each> 
						<xsl:apply-templates></xsl:apply-templates>
					</xsl:otherwise> 
				</xsl:choose>  
			</fo:table> 
		</xsl:for-each>   
	</xsl:template><xsl:template match="thead">
		<fo:table-header>
			<xsl:apply-templates></xsl:apply-templates>
		</fo:table-header>
	</xsl:template><xsl:template match="colspec">
		<fo:table-column>
			<!-- test for/use @colnum -->
			<xsl:choose>            
				<xsl:when test="@colnum">               
					<xsl:attribute name="column-number">                  
						<xsl:value-of select="@colnum"></xsl:value-of>               
					</xsl:attribute>            
				</xsl:when>            
				<xsl:otherwise>               
					<xsl:attribute name="column-number">                  
						<xsl:number count="colspec"></xsl:number>               
					</xsl:attribute>            
				</xsl:otherwise>         
			</xsl:choose>       
			<xsl:attribute name="column-width">
				<xsl:variable name="ccw_value">
					<xsl:call-template name="calc.column.width">               
						<xsl:with-param name="colwidth">              
							<xsl:choose>
								<xsl:when test="@colwidth">
									<xsl:choose>
										<xsl:when test="number(@colwidth) = string(@colwidth)">
											<xsl:variable name="total_width">
												<xsl:call-template name="calculate-width-sum">
													<xsl:with-param name="nodes" select="../colspec"/>
												</xsl:call-template>
											</xsl:variable>
											<xsl:variable name="max_table_width">
												<xsl:choose>
													<xsl:when test="ancestor::claim-text">
														<xsl:value-of select="$claim_content_column_width - 2"/>
													</xsl:when>
													<xsl:when test="ancestor::p">
														<xsl:value-of select="$p_content_column_width - 2"/>
													</xsl:when>
													<xsl:otherwise>
														<xsl:value-of select="$without_margin_page_width - 2"/>
													</xsl:otherwise>
												</xsl:choose>
											</xsl:variable>
											<xsl:choose>
												<xsl:when test="number($total_width) > number($max_table_width)">
													<xsl:value-of select="number(@colwidth) * number($max_table_width) div number($total_width)"></xsl:value-of>
												</xsl:when>
												<xsl:otherwise>
													<xsl:value-of select="number(@colwidth)"></xsl:value-of>
												</xsl:otherwise>
											</xsl:choose>
										</xsl:when>
										<xsl:otherwise>
											<xsl:value-of select="@colwidth"></xsl:value-of>
										</xsl:otherwise>
									</xsl:choose>
								</xsl:when>
								<xsl:otherwise>*</xsl:otherwise>
							</xsl:choose>
						</xsl:with-param>            
					</xsl:call-template>
				</xsl:variable>
				<xsl:variable name="ccw_gs_value">
					<xsl:call-template name="get_size">
						<xsl:with-param name="size_in" select="$ccw_value" />
					</xsl:call-template>
				</xsl:variable>
				<xsl:variable name="max_table_width">
					<xsl:choose>
						<xsl:when test="ancestor::claim-text">
							<xsl:value-of select="$claim_content_column_width - 2"/>mm
						</xsl:when>
						<xsl:when test="ancestor::p">
							<xsl:value-of select="$p_content_column_width - 2"/>mm
						</xsl:when>
						<xsl:otherwise>
							<xsl:value-of select="$without_margin_page_width - 2"/>mm
						</xsl:otherwise>
					</xsl:choose>
				</xsl:variable>
				<xsl:variable name="gs_max_table_width">
					<xsl:call-template name="get_size">
						<xsl:with-param name="size_in" select="$max_table_width"/>
					</xsl:call-template>
				</xsl:variable>
				<xsl:choose>
					<xsl:when test="not( contains( $fop_version, '0.2') ) and ( $fop_version != '' ) 
						and ( number($ccw_gs_value) &gt; number($gs_max_table_width) )">
						<xsl:value-of select="$max_table_width"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="$ccw_value"></xsl:value-of>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:attribute>      
		</fo:table-column>   
	</xsl:template><xsl:template match="tbody">      
		<fo:table-body>  
			<xsl:apply-templates></xsl:apply-templates>  	  
		</fo:table-body>   
	</xsl:template><xsl:template match="row">      
		<fo:table-row>         
			<!-- use select="*" to select only element (not whitespace) nodes; 
			     used in colsep, rowsep templates with position() -->
			<xsl:apply-templates select="*"></xsl:apply-templates>      
		</fo:table-row>   
	</xsl:template><xsl:template match="entry">      
		<fo:table-cell padding="2pt" text-indent="0mm">    
			<!-- create colsep/rowsep -->
			<xsl:call-template name="colsep"></xsl:call-template>
			<xsl:call-template name="rowsep"></xsl:call-template>   			        
			<xsl:if test="@valign">            
				<xsl:choose>               
					<xsl:when test="@valign='middle'">                  
						<xsl:attribute name="display-align">center</xsl:attribute>               
					</xsl:when>               
					<xsl:when test="@valign='top'">                  
						<xsl:attribute name="display-align">before</xsl:attribute>                       
					</xsl:when>               
					<xsl:when test="@valign='bottom'">                  
						<xsl:attribute name="display-align">after</xsl:attribute>               
					</xsl:when>               
					<xsl:otherwise>                  
						<xsl:attribute name="display-align">                     
							<xsl:value-of select="@valign"></xsl:value-of>                  
						</xsl:attribute>               
					</xsl:otherwise>            
				</xsl:choose>         
			</xsl:if>         
			<xsl:if test="@align">            
				<xsl:attribute name="text-align">               
					<xsl:value-of select="@align"></xsl:value-of>            
				</xsl:attribute>         
			</xsl:if>
			<!-- create vertical spans, if attributes present -->
			        
			<xsl:if test="@morerows">          
				<xsl:attribute name="number-rows-spanned">            
					<xsl:value-of select="@morerows+1"></xsl:value-of>          
				</xsl:attribute>        
			</xsl:if>
			<!-- create horizontal spans, if attributes are present -->
			         
			<xsl:if test="@namest">
				<!-- ensure that colnames have been declared -->
				<xsl:if test="ancestor::tgroup[1]/child::colspec">               
					<xsl:variable name="number-columns-spanned">
						<xsl:call-template name="calc.span">                  
							<xsl:with-param name="namest">                     
								<xsl:value-of select="@namest"></xsl:value-of>                  
							</xsl:with-param>                  
							<xsl:with-param name="nameend">                     
								<xsl:value-of select="@nameend"></xsl:value-of>                  
							</xsl:with-param>               
						</xsl:call-template>
					</xsl:variable>
					<xsl:attribute name="number-columns-spanned">
						<xsl:value-of select="$number-columns-spanned"></xsl:value-of>
					</xsl:attribute>
				</xsl:if>     
			</xsl:if>         
			<fo:block>         
				<xsl:apply-templates></xsl:apply-templates>
			</fo:block>    
		</fo:table-cell>   
	</xsl:template><xsl:template name="calc.span">      
		<xsl:param name="namest"></xsl:param>  
		<!-- incoming @namest  -->
		<xsl:param name="nameend"></xsl:param> 
		<!-- incoming @nameend -->
		
		<!-- get the positions of the column with the colname that matches @namest, @nameend -->
		<xsl:param name="start"> 
			<xsl:for-each select="ancestor::tgroup[1]/colspec">
				<xsl:if test="@colname = $namest">   
					<xsl:value-of select="position()"></xsl:value-of>
				</xsl:if> 
			</xsl:for-each>  
		</xsl:param>  
		<xsl:param name="end"> 
			<xsl:for-each select="ancestor::tgroup[1]/colspec">
				<xsl:if test="@colname = $nameend">   
					<xsl:value-of select="position()"></xsl:value-of>
				</xsl:if> 
			</xsl:for-each>  
		</xsl:param>  
		<xsl:value-of select="number($end) - number($start) + 1"></xsl:value-of>  
	</xsl:template><xsl:template name="calc.column.width">
		<!-- **
     * <p>Calculate an XSL FO table column-width specification from a
     * full relative table column-width specification.</p>
     *
     * <p>Table column-widths are in the following basic
     * forms:</p>
     *
     * <ul>
     * <li><b>99.99units</b>, a fixed length-specifier.</li>
     * <li><b>99.99</b>, a fixed length-specifier without any units.</li>
     * <li><b>99.99*</b>, a relative length-specifier.</li>
     * <li><b>99.99*+99.99units</b>, a combination of both.</li>
     * </ul>
     *
     * <p>The units are points (pt), picas (pi), centimeters (cm),
     * millimeters (mm), and inches (in). These are the same units as XSL,
     * except that XSL abbreviates picas "pc" instead of "pi". If a length
     * specifier has no units, the default unit (pt) is assumed.   
     * NOTE: the default mentioned above has been changed to mm.
     </p>
     *********************************************************************
     *
     * <p>Relative length-specifiers are represented in XSL with the
     * proportional-column-width() function.</p>
     *
     * <p>Here are some examples:</p>
     *
     * <ul>
     * <li>"36pt" becomes "36pt"</li>
     * <li>"3pi" becomes "3pc"</li>
     * <li>"36" becomes "36pt"</li>
     * <li>"3*" becomes "proportional-column-width(3)"</li>
     * <li>"3*+2pi" becomes "proportional-column-width(3)+2pc"</li>
     * <li>"1*+2" becomes "proportional-column-width(1)+2pt"</li>
     * </ul>
     *
     * @param colwidth The column width specification.
     *
     * @returns The XSL column width specification.
     * -->
		      
		<xsl:param name="colwidth">1*</xsl:param>  
		<!-- Ok, the colwidth could have any one of the following forms: -->
		  
		<!--        1*       = proportional width -->
		  
		<!--     1unit       = 1.0 units wide -->
		  
		<!--         1       = 1pt wide -->
		  
		<!--  1*+1unit       = proportional width + some fixed width -->
		  
		<!--      1*+1       = proportional width + some fixed width -->
		  
		<!-- If it has a proportional width, translate it to XSL -->
		      
		<xsl:if test="contains($colwidth, '*')">         
			<xsl:text>proportional-column-width(</xsl:text>         
		         
			<xsl:choose>        	 
				<!-- JD: if value is only '*', replace with '1' to prevent FOP error.
         			         this should have the same meaning.  See p. 125 of XSL Rec. -->
				         
				<xsl:when test="$colwidth='*'">1</xsl:when>         
				<xsl:otherwise>         
					<xsl:value-of select="substring-before($colwidth, '*')"></xsl:value-of>        		 
				</xsl:otherwise>         
			</xsl:choose>
			<xsl:text>)</xsl:text>      
		</xsl:if>  
		<xsl:choose>
			<xsl:when test="contains($colwidth, '%')"><xsl:value-of select="($page_width - 62) * (translate($colwidth,'%','') div 100)"></xsl:value-of>mm</xsl:when>
			<xsl:otherwise>
				<!-- Now get the non-proportional part of the specification -->
					  
				<xsl:variable name="width-units">         
					<xsl:choose>            
						<xsl:when test="contains($colwidth, '*')">               
							<xsl:value-of select="normalize-space(substring-after($colwidth, '*'))"></xsl:value-of>            
						</xsl:when>            
						<xsl:otherwise>               
							<xsl:value-of select="normalize-space($colwidth)"></xsl:value-of>            
						</xsl:otherwise>         
					</xsl:choose>      
				</xsl:variable>  
				<!-- Now the width-units could have any one of the following forms: -->
				  
				<!--                 = <empty string> -->
				  
				<!--     1unit       = 1.0 units wide -->
				  
				<!--         1       = 1pt wide -->
				  
				<!-- with an optional leading sign -->
				  
				<!-- Get the width part by blanking out the units part and discarding -->
				  
				<!-- white space. -->
					  
				<xsl:variable name="width" select="normalize-space(translate($width-units,                                          '+-0123456789.abcdefghijklmnopqrstuvwxyz',                                          '+-0123456789.'))"></xsl:variable>  
				<!-- Get the units part by blanking out the width part and discarding -->
				  
				<!-- white space. -->
					  
				<xsl:variable name="units" select="normalize-space(translate($width-units,                                          'abcdefghijklmnopqrstuvwxyz+-0123456789.',                                          'abcdefghijklmnopqrstuvwxyz'))"></xsl:variable>  
				<!-- Output the width -->
					  
				<xsl:value-of select="$width"></xsl:value-of>  
				<!-- Output the units, translated appropriately -->
					  
				<xsl:choose>         
					<xsl:when test="$units = 'pi'">pc</xsl:when>         
					<xsl:when test="$units = '' and $width != ''">mm</xsl:when> 
					<!-- was originally 'pt' -->
							 
					<xsl:otherwise>            
						<xsl:value-of select="$units"></xsl:value-of>         
					</xsl:otherwise>      
				</xsl:choose>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template> 
   
	<xsl:template name="attachedDoc_ChoiceText">
      <xsl:choose>
         <xsl:when test="$lang='en'">
            <xsl:text> (scanned image attached) </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='es'">
            <xsl:text>(documento adjunto)</xsl:text>
         </xsl:when>
         <xsl:when test="$lang='fr'">
            <xsl:text> (image scannée jointe) </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='de'">
            <xsl:text> (abgetastetes Bild) </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ru'">
            <xsl:text> (скнированное изображение прилагается) </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ja'">
            <xsl:text> (スキャンイメージを添付) </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='zh'">
            <xsl:text> (附有扫描图像) </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ko'">
            <xsl:text> 스캔이미지 첨부</xsl:text>
         </xsl:when>
         <xsl:when test="$lang='pt'">
            <xsl:text> (imagem digitalizada em anexo) </xsl:text>
         </xsl:when>
         <xsl:otherwise>
            <xsl:text> (scanned image attached) </xsl:text>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>   
	<xsl:template name="description_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> Description </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> Descripción </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text> Description </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text> Beschreibung </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text> Описание </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 明　細　書 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 说明书 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text> 발명의 설명 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Descrição </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ar'">
				<xsl:text> الوصف </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text> Descrizione </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> Description </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template><xsl:template name="claim_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> Claims </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> Reivindicaciones </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text> Revendications </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text> Ansprüche </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text> Формула </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 請求の範囲 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 权利要求书 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text> 청구범위 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Reivindicações </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ar'">
				<xsl:text> عناصر الحماية </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text> Rivendicazioni </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> Claims </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template><xsl:template name="claimHeading_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text>Claim </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> Reivindicación </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text>Revendication </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text>Anspruch </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text>Пункт </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text>請求項</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text></xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text>청구항 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Reivindicação </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ar'">
				<xsl:text> عنصر </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text>Rivendicazione </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text>Claim </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template><xsl:template name="drawing_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> Drawings </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> Dibujos </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text> Dessins </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text> Zeichnungen </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text> Чертежи </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 図　　　面 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 附图 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text> 도면 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Desenhos </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ar'">
				<xsl:text> الرسومات </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text> Disegni </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> Drawings </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template><xsl:template name="abstract_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> Abstract </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> Resumen </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text> Abrégé </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text> Zusammenfassung </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text> Реферат </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 要　約　書 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 摘要 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text> 요약서 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Resumo </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ar'">
				<xsl:text> الملخص </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text> Riassunto </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> Abstract </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template><xsl:template name="abstProblem_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> Problem: </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> El Problema: </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text> Problème : </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text> Aufgabe </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text> Проблема </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 課題 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 问题 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text> 문제점: </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Problema : </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ar'">
				<xsl:text> مشكلة: </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text> Problema: </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> Problem: </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template><xsl:template name="abstSolution_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> Solution: </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> La Solución: </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text> Solution : </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text> Lösung </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text> Решение </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 解決手段 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 解决方案 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text> 해결책: </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Solução : </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ar'">
				<xsl:text> حل: </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text> Soluzione: </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> Solution: </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template><xsl:template name="techField_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> Technical Field </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> Sector técnico </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text> Domaine technique </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text> Gebiet der Technik </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text> Техническая область </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 技術分野 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 技术领域 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text> 기술분야 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Domínio Técnico </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ar'">
				<xsl:text> المجال التقني </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text> Campo tecnico </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> Technical Field </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template><xsl:template name="backgroundArt_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> Background Art </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> Técnica anterior </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text> Technique antérieure </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text> Stand der Technik </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text> Предшествующий уровень техники </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 背景技術 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 背景技术 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text> 배경기술 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Técnica Anterior </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ar'">
				<xsl:text> خلفية الاختراع </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text> Stato dell'arte </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> Background Art </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template><xsl:template name="descDrawings_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> Brief Description of Drawings </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> Descripción breve de las figuras </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text> Brève description des dessins </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text> Kurze Beschreibung der Zeichnungen </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text> Краткое описание чертежей </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 図面の簡単な説明 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 对附图的简要说明</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text> 도면의 간단한 설명 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Breve Descrição das Figuras </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ar'">
				<xsl:text> وصف مختصر للرسومات </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text> Breve descrizione dei disegni </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> Brief Description of Drawings </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template><xsl:template name="disclosure_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> Disclosure of Invention </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> Divulgación de la invención</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text> Exposé de l'invention </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text> Offenbarung der Erfindung </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text> Раскрытие изобретения </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 発明の開示 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 对发明的公开</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text> 발명의 내용 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Divulgação da Invenção </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ar'">
				<xsl:text> الكشف عن الاختراع </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text> Divulgazione dellinvenzione </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> Disclosure of Invention </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template><xsl:template name="techProblem_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> Technical Problem </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> Problema técnico </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text> Problème technique </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text> Technische Aufgabe </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text> Техническая задача </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 発明が解決しようとする課題 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 技术问题 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text> 기술적 과제 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Problema Técnico </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ar'">
				<xsl:text> مشكل تقني </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text> Problema tecnico </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> Technical Problem </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template><xsl:template name="techSolution_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> Solution to Problem </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> Solución a problema </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text> Solution technique </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text> Technische Lösung </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text> Решение задачи </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 課題を解決するための手段 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 问题的解决方案 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text>과제 해결 수단</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Solução do Problema </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ar'">
				<xsl:text> حل تقني </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text> Soluzione al problema </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> Solution to Problem </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template><xsl:template name="techSolutionOld_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> Technical Solution </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> Solución técnica </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text> Solution technique </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text> Technische Lösung </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text> Техническое решение </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 課題を解決するための手段 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 技术解决方案 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text>과제 해결 수단</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Solução Técnica </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> Technical Solution </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template><xsl:template name="advanEffects_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> Advantageous Effects of Invention </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> Efectos ventajosos de la invención </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text>  Avantages apportés </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text> Vorteilhafte Wirkungen der Erfindung </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text> Положительные эффекты от изобретения </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 発明の効果 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 发明的有益效果 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text> 발명의 효과 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Efeitos Vantajosos da Invenção </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ar'">
				<xsl:text> آثار مفيدة للاختراع </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text> Effetto vantagioso dellinvenzione </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> Advantageous Effects of Invention </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template><xsl:template name="advanEffectsOld_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> Advantageous Effects </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> Efectos ventajosos </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text> Effets avantageux </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text> Vorteilhafte Wirkungen </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text> Преимущества </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 発明の効果 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 有益效果 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text> 유리한 효과 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Efeitos Vantajosos </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> Advantageous Effects </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template><xsl:template name="bestMode_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> Best Mode for Carrying out the Invention </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> Mejor manera de realizar la invención </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text> Meilleur mode de réalisation de l'invention </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text> Weg zur Ausführung der Erfindung </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text> Лучший вариант осуществления изобретения </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 発明を実施するための最良の形態 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 实施该发明的最佳实施例 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text> 발명의 실시를 위한 최선의 형태 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Melhor Modo de Realizar a Invenção </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ar'">
				<xsl:text> أفضل طريقة لتنفيذ الاختراع </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text> Il modo migliore per realizzare linvenzione </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> Best Mode for Carrying out the Invention </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template><xsl:template name="mode_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> Mode for the Invention </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> Modo de realizar la invención </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text> Mode(s) de réalisation de l'invention </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text> Weg(e) zur Ausführung der Erfindung </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text> Вариант изобретения </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 実施例 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 发明实施例 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text> 발명의 실시를 위한 형태 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Modo de Realizar a Invenção </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ar'">
				<xsl:text> نمط الاختراع </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text> Il modo di realizzare linvenzione </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> Mode for the Invention </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template><xsl:template name="industrialApp_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> Industrial Applicability </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> Aplicabilidad industrial </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text> Application industrielle </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text> Gewerbliche Anwendbarkeit </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text> Промышленная применимость </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 産業上の利用可能性 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 工业实用性 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text> 산업상 이용가능성 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Aplicação Industrial </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ar'">
				<xsl:text> التطبيق الصناعي  </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text> Applicabilità industriale </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> Industrial Applicability </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template><xsl:template name="sequence_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> Sequence Listing Free Text </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> Texto libre de lista de secuencias </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text> Texte libre du listage de séquences </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text> Sequenzprotokoll als Freitext </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text> Свободный текст перечня последовательностей </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 配列表フリーテキスト </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 序列表自由内容 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text> 서열목록 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Texto Livre de Listagem de Sequências </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ar'">
				<xsl:text> نص حر للكشف التسلسلي </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text> Lista di sequenze a testo libero </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> Sequence Listing Free Text </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template><xsl:template name="sequenceOld_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> Sequence Listing </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> Lista de secuencias </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text> Listage des séquences </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text> Sequenzprotokoll </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text> Перечень последовательностей </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 配列表フリーテキスト </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 序列表 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text> 서열목록 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Listagem de Sequências </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> Sequence Listing </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template><xsl:template name="summaryOfInvention_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> Summary of Invention </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> Resumen de la invención</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text> Résumé de l'invention </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text> Zusammenfassung der Erfindung </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text> Краткое изложение изобретения </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 発明の概要 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 发明概述 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text>발명의 요약 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Resumo da Invenção </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ar'">
				<xsl:text> ملخص الاختراع </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text> Riassunto dell’invenzione </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> Summary of Invention </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template><xsl:template name="descriptionOfEmbodiments_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> Description of Embodiments </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> Descripción de alguna forma de realizar la invención</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text> Description des modes de réalisation </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text> Beschreibung der Ausführungsformen </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text> Описание вариантов осуществления </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 発明を実施するための形態 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 实施例的说明 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text> 발명실시예의 상세한 설명 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Descrição dos Modos de Realização </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ar'">
				<xsl:text> الوصف التفصيلي </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text> Descrizione della forma di realizzazione dell'invenzione </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> Description of Embodiments </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template><xsl:template name="embodimentsExample_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> Example </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> Ejemplo </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text> Exemple </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text> Beispiel </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text> Пример </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 実施例 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 实施例 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text>실시예 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Exemplo </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ar'">
				<xsl:text> مثال  </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text> Ezempio </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> Example </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template><xsl:template name="embodimentsExampleS_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> Examples </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> Ejemplos </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text> Exemples </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text> Beispiele </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text> Примеры </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 実施例 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 实施例 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text> 실시예들 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Exemplos </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ar'">
				<xsl:text> أمثلة </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text> Ezempi </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> Examples </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template><xsl:template name="referenceSignsList_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> Reference Signs List </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> Lista de signos de referencia </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text> Liste des signes de référence </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text> Liste der Bezugszeichen </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text> Перечень ссылочных обозначений </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 符号の説明 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 附图标记清单 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text> 도면 부호 목록 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Lista de Indicações de Referência </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ar'">
				<xsl:text> قائمة مرجع العلامات </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text> Lista dei segni di referimento </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> Reference Signs List </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template><xsl:template name="referenceToDepositedBiologicalMaterial_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> Reference to Deposited Biological Material </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> Referencia a material biológico depositado </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text> Référence à du matériel biologique déposé </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text> Bezugnahme auf hinterlegtes biologisches Material </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text> Ссылка на депонированный биологический материал </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 受託番号 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 关于生物材料保藏的说明 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text> 기탁된 생물학적 물질 번호 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Referência a Depósito de Material Biológico </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ar'">
				<xsl:text> إشارة إلى المواد البيولوجية المودعة </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text> Referimento a materiale biolgico depositato </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> Reference to Deposited Biological Material </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template><xsl:template name="citationList_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> Citation List </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> Lista de citas </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text> Liste des documents cités </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text> Liste der angegebenen Unterlagen </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text> Список ссылок </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 先行技術文献 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 引用文件清单 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text> 선행기술 문헌목록 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Lista das Citações </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ar'">
				<xsl:text> قائمة النصوص المستشهد بها </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text> Elenco delle citazioni </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> Citation List </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template><xsl:template name="patentLiterature_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> Patent Literature </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> Bibliografía de las patentes</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text> Documents brevets </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text> Patentliteratur </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text> Патентная литература </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 特許文献 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 专利文献 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text> 특허 문헌 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Literatura sobre Patentes </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ar'">
				<xsl:text> مستندات براءات الاختراع </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text> Letteratura brevettuale </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> Patent Literature </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template><xsl:template name="nonPatentLiterature_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> Non Patent Literature </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> Bibliografía distinta de la de patentes</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text> Littérature non-brevet </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text> Nichtpatentliteratur </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text> Непатентная литература </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 非特許文献 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 非专利文献 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text> 비특허 문헌 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Literatura não Ligada a Patentes </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ar'">
				<xsl:text> مستندات خلاف براءات الاختراع </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text> Letteratura non brevettuale </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> Non Patent Literature </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template><xsl:template name="titleOfInvention_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> Title of Invention: </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> Título de la invención: </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text> Titre de l'invention : </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text> Bezeichnung der Erfindung: </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text> Название изобретения: </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 発明の名称 : </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 发明名称: </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text> 발명의 명칭: </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Título da Invenção: </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ar'">
				<xsl:text>اسم الاختراع:</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text> Titolo dell'invenzione: </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> Title of Invention: </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>   
	<xsl:template name="vid_ChoiceText">
      <xsl:choose>
         <xsl:when test="$lang='en'">
            <xsl:text> vol. </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='es'">
            <xsl:text> </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='fr'">
            <xsl:text> vol </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='de'">
            <xsl:text> Band </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ru'">
            <xsl:text> том </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ja'">
            <xsl:text> vol </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='zh'">
            <xsl:text> vol. </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ko'">
            <xsl:text> vol. </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='pt'">
            <xsl:text> vol. </xsl:text>
         </xsl:when>
      </xsl:choose>
   </xsl:template><xsl:template name="isbn_ChoiceText">
      <xsl:choose>
         <xsl:when test="$lang='en'">
            <xsl:text> ISBN </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='es'">
            <xsl:text> </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='fr'">
            <xsl:text> ISBN </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='de'">
            <xsl:text> ISBN </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ru'">
            <xsl:text> ISBN </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ja'">
            <xsl:text> ISBN </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='zh'">
            <xsl:text> ISBN </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ko'">
            <xsl:text> ISBN </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='pt'">
            <xsl:text> ISBN </xsl:text>
         </xsl:when>
      </xsl:choose>
   </xsl:template><xsl:template name="issn_ChoiceText">
      <xsl:choose>
         <xsl:when test="$lang='en'">
            <xsl:text> ISSN </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='es'">
            <xsl:text> </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='fr'">
            <xsl:text> ISSN </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='de'">
            <xsl:text> ISSN </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ru'">
            <xsl:text> ISSN </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ja'">
            <xsl:text> ISSN </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='zh'">
            <xsl:text> ISSN </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ko'">
            <xsl:text> ISSN </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='pt'">
            <xsl:text> ISSN </xsl:text>
         </xsl:when>
      </xsl:choose>
   </xsl:template><xsl:template name="revised_ChoiceText">
      <xsl:choose>
         <xsl:when test="$lang='en'">
            <xsl:text>, Revised </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='es'">
            <xsl:text>, Revisado </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='fr'">
            <xsl:text>, Révisé </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='de'">
            <xsl:text>, Revidiert </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ru'">
            <xsl:text>, Исправлено </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ja'">
            <xsl:text>, 訂正日 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='zh'">
            <xsl:text>, 修订日 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ko'">
            <xsl:text> , 정정일자 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='pt'">
            <xsl:text> ,Revista </xsl:text>
         </xsl:when>
      </xsl:choose>
   </xsl:template><xsl:template name="ino_ChoiceText">
      <xsl:choose>
         <xsl:when test="$lang='en'">
            <xsl:text> no. </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='es'">
            <xsl:text> </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='fr'">
            <xsl:text> no </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='de'">
            <xsl:text> Nr. </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ru'">
            <xsl:text> № </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ja'">
            <xsl:text> no. </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='zh'">
            <xsl:text> no. </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ko'">
            <xsl:text> no. </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='pt'">
            <xsl:text> No </xsl:text>
         </xsl:when>
      </xsl:choose>
   </xsl:template><xsl:template name="and_ChoiceText">
      <xsl:choose>
         <xsl:when test="$lang='en'">
            <xsl:text> and </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='es'">
            <xsl:text> y </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='fr'">
            <xsl:text> et </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='de'">
            <xsl:text> und </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ru'">
            <xsl:text> и </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ja'">
            <xsl:text> 及び </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='zh'">
            <xsl:text> 及 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ko'">
            <xsl:text> 및 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='pt'">
            <xsl:text> e </xsl:text>
         </xsl:when>
      </xsl:choose>
   </xsl:template><xsl:template name="confsponsor_ChoiceText">
      <xsl:choose>
         <xsl:when test="$lang='en'">
            <xsl:text> Sponsored by </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='es'">
            <xsl:text> Patrocinado por </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='fr'">
            <xsl:text> Commandité par </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='de'">
            <xsl:text> Gefördert bei </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ru'">
            <xsl:text> Спонсор: </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ja'">
            <xsl:text> 協賛者 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='zh'">
            <xsl:text> 赞助者 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ko'">
            <xsl:text> 협찬사 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='pt'">
            <xsl:text> Patrocinado por </xsl:text>
         </xsl:when>
      </xsl:choose>
   </xsl:template><xsl:template name="p_ChoiceText">
      <xsl:choose>
         <xsl:when test="$lang='en'">
            <xsl:text> p. </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='es'">
            <xsl:text> </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='fr'">
            <xsl:text> p. </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='de'">
            <xsl:text> S. </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ru'">
            <xsl:text> стр. </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ja'">
            <xsl:text> 頁 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='zh'">
            <xsl:text> 页码 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ko'">
            <xsl:text> 페이지 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='pt'">
            <xsl:text> p. </xsl:text>
         </xsl:when>
      </xsl:choose>
   </xsl:template><xsl:template name="to_ChoiceText">
      <xsl:choose>
         <xsl:when test="$lang='en'">
            <xsl:text> to </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='es'">
            <xsl:text> a </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='fr'">
            <xsl:text> à. </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='de'">
            <xsl:text> bis </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ru'">
            <xsl:text> со </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ja'">
            <xsl:text> から </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='zh'">
            <xsl:text> 至 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ko'">
            <xsl:text> 부터 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='pt'">
            <xsl:text> a </xsl:text>
         </xsl:when>
      </xsl:choose>
   </xsl:template><xsl:template name="para_ChoiceText">
      <xsl:choose>
         <xsl:when test="$lang='en'">
            <xsl:text> para. </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='es'">
            <xsl:text> </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='fr'">
            <xsl:text> para. </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='de'">
            <xsl:text> Abs. </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ru'">
            <xsl:text> параграф </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ja'">
            <xsl:text> 段落 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='zh'">
            <xsl:text> 段落 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ko'">
            <xsl:text> 단락 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='pt'">
            <xsl:text> par. </xsl:text>
         </xsl:when>
      </xsl:choose>
   </xsl:template><xsl:template name="col_ChoiceText">
      <xsl:choose>
         <xsl:when test="$lang='en'">
            <xsl:text> col. </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='es'">
            <xsl:text> </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='fr'">
            <xsl:text> col. </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='de'">
            <xsl:text> Spalte </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ru'">
            <xsl:text> столбец </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ja'">
            <xsl:text> 列 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='zh'">
            <xsl:text> 列 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ko'">
            <xsl:text> 열 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='pt'">
            <xsl:text> col. </xsl:text>
         </xsl:when>
      </xsl:choose>
   </xsl:template><xsl:template name="line_ChoiceText">
      <xsl:choose>
         <xsl:when test="$lang='en'">
            <xsl:text> line </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='es'">
            <xsl:text> </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='fr'">
            <xsl:text> ligne </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='de'">
            <xsl:text> Zeile </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ru'">
            <xsl:text> строка </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ja'">
            <xsl:text> 行 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='zh'">
            <xsl:text> 行 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ko'">
            <xsl:text> 행 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='pt'">
            <xsl:text> linha </xsl:text>
         </xsl:when>
      </xsl:choose>
   </xsl:template><xsl:template name="online_ChoiceText">
      <xsl:choose>
         <xsl:when test="$lang='en'">
            <xsl:text> [online].  </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='es'">
            <xsl:text> [online].  </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='fr'">
            <xsl:text> [en ligne]. </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='de'">
            <xsl:text> [online]. </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ru'">
            <xsl:text> [online]. </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ja'">
            <xsl:text> [オンライン]. </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='zh'">
            <xsl:text> [在线]. </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ko'">
            <xsl:text> [온라인] </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='pt'">
            <xsl:text> On-Line </xsl:text>
         </xsl:when>
      </xsl:choose>
   </xsl:template><xsl:template name="datecit_ChoiceText">
      <xsl:choose>
         <xsl:when test="$lang='en'">
            <xsl:text>  [retrieved on </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='es'">
            <xsl:text> [recuperado en </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='fr'">
            <xsl:text> [retrouvé sur </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='de'">
            <xsl:text> [abgerufen am </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ru'">
            <xsl:text> </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ja'">
            <xsl:text> [検索日 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='zh'">
            <xsl:text> [获取日 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ko'">
            <xsl:text> [검색일자 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='pt'">
            <xsl:text> [recuperadas em </xsl:text>
         </xsl:when>
      </xsl:choose>
   </xsl:template><xsl:template name="retrievedFrom_ChoiceText">
      <xsl:choose>
         <xsl:when test="$lang='en'">
            <xsl:text>Retrieved from: </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='es'">
            <xsl:text> </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='fr'">
            <xsl:text> Retrouvé de : </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='de'">
            <xsl:text> Abgerufen von </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ru'">
            <xsl:text> </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ja'">
            <xsl:text> 検索場所 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='zh'">
            <xsl:text> 获取处 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ko'">
            <xsl:text> 검색장소 : </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='pt'">
            <xsl:text> Recuperadas de : </xsl:text>
         </xsl:when>
      </xsl:choose>
   </xsl:template><xsl:template name="math_ChoiceText">
   <!-- TODO: note that this will have to be changed when rendering tool is
              integrated with Custard -->
      <xsl:choose>
         <xsl:when test="$lang='en'">
            <xsl:text> [coded mathematical formula included] </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='es'">
            <xsl:text> </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='fr'">
            <xsl:text> [formule mathématique codée incluse] </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='de'">
            <xsl:text> [die codierte matematische Formel ist] </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ru'">
            <xsl:text> [кодированная математическая формула включена] </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ja'">
            <xsl:text> [コード形式の数式を含む] </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='zh'">
            <xsl:text> [包含被编码的数学公式] </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ko'">
            <xsl:text> [코드 형식의 수학식을 포함한다] </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='pt'">
            <xsl:text> [fórmula matemática codificada incluída] </xsl:text>
         </xsl:when>
		  <xsl:when test="$lang='ar'">
            <xsl:text>صيغة رياضية مشفرة شملت</xsl:text>
         </xsl:when>
		<xsl:when test="$lang='it'">
            <xsl:text> [formula matematica codificata inclusa] </xsl:text>
         </xsl:when>
      </xsl:choose>
   </xsl:template><xsl:template name="file_ChoiceText">
      <xsl:choose>
         <xsl:when test="$lang='en'">
            <xsl:text> file:   </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='es'">
            <xsl:text> </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='fr'">
            <xsl:text> fichier :  </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='de'">
            <xsl:text> datei: </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ru'">
            <xsl:text> райл: </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ja'">
            <xsl:text> ファイル: </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='zh'">
            <xsl:text> 文件: </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ko'">
            <xsl:text> 파일 : </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='pt'">
            <xsl:text> dossier : </xsl:text>
         </xsl:when>
      </xsl:choose>
   </xsl:template>   
	<xsl:template name="jan_ChoiceText">
      <xsl:param name="lang"></xsl:param>
      <xsl:choose>
         <xsl:when test="$lang='en'">
            <xsl:text> January </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='es'">
            <xsl:text> Enero </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='fr'">
            <xsl:text> janvier </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='de'">
            <xsl:text> Januar</xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ru'">
            <xsl:text> Январь </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ja'">
            <xsl:text> 1 月 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='zh'">
            <xsl:text> 1月  </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ko'">
            <xsl:text> 1월 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='pt'">
            <xsl:text>Janeiro </xsl:text>
         </xsl:when>
      </xsl:choose>
   </xsl:template><xsl:template name="feb_ChoiceText">
      <xsl:param name="lang"></xsl:param>
      <xsl:choose>
         <xsl:when test="$lang='en'">
            <xsl:text> February </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='es'">
            <xsl:text> Febrero </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='fr'">
            <xsl:text> février </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='de'">
            <xsl:text> Februar </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ru'">
            <xsl:text> Февраль </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ja'">
            <xsl:text> 2 月 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='zh'">
            <xsl:text> 2月 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ko'">
            <xsl:text> 2월 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='pt'">
            <xsl:text> Fevereiro</xsl:text>
         </xsl:when>
      </xsl:choose>
   </xsl:template><xsl:template name="mar_ChoiceText">
      <xsl:param name="lang"></xsl:param>
      <xsl:choose>
         <xsl:when test="$lang='en'">
            <xsl:text> March </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='es'">
            <xsl:text> Marzo </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='fr'">
            <xsl:text> mars </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='de'">
            <xsl:text> März </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ru'">
            <xsl:text> Марг </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ja'">
            <xsl:text> 3 月 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='zh'">
            <xsl:text> 3月 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ko'">
            <xsl:text> 3월 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='pt'">
            <xsl:text>Março </xsl:text>
         </xsl:when>
      </xsl:choose>
   </xsl:template><xsl:template name="apr_ChoiceText">
      <xsl:param name="lang"></xsl:param>
      <xsl:choose>
         <xsl:when test="$lang='en'">
            <xsl:text> April </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='es'">
            <xsl:text> Abril </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='fr'">
            <xsl:text> avril </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='de'">
            <xsl:text> April</xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ru'">
            <xsl:text> Апрель </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ja'">
            <xsl:text> 4 月 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='zh'">
            <xsl:text> 4月 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ko'">
            <xsl:text> 4월 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='pt'">
            <xsl:text>Abril </xsl:text>
         </xsl:when>
      </xsl:choose>
   </xsl:template><xsl:template name="may_ChoiceText">
      <xsl:param name="lang"></xsl:param>
      <xsl:choose>
         <xsl:when test="$lang='en'">
            <xsl:text> May </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='es'">
            <xsl:text> Mayo </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='fr'">
            <xsl:text> mai </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='de'">
            <xsl:text> Mai</xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ru'">
            <xsl:text> Май </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ja'">
            <xsl:text> 5 月 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='zh'">
            <xsl:text> 5月 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ko'">
            <xsl:text> 5월 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='pt'">
            <xsl:text>Maio </xsl:text>
         </xsl:when>
      </xsl:choose>
   </xsl:template><xsl:template name="jun_ChoiceText">
      <xsl:param name="lang"></xsl:param>
      <xsl:choose>
         <xsl:when test="$lang='en'">
            <xsl:text> June </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='es'">
            <xsl:text> Junio </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='fr'">
            <xsl:text> juin </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='de'">
            <xsl:text> Juni</xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ru'">
            <xsl:text> Июнь </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ja'">
            <xsl:text> 6 月 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='zh'">
            <xsl:text> 6月 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ko'">
            <xsl:text> 6월 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='pt'">
            <xsl:text>Junho </xsl:text>
         </xsl:when>
      </xsl:choose>
   </xsl:template><xsl:template name="jul_ChoiceText">
      <xsl:param name="lang"></xsl:param>
      <xsl:choose>
         <xsl:when test="$lang='en'">
            <xsl:text> July </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='es'">
            <xsl:text> Julio </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='fr'">
            <xsl:text> juillet </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='de'">
            <xsl:text> Juli</xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ru'">
            <xsl:text> Июль </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ja'">
            <xsl:text> 7 月 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='zh'">
            <xsl:text> 7月 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ko'">
            <xsl:text> 7월 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='pt'">
            <xsl:text>Julho </xsl:text>
         </xsl:when>
      </xsl:choose>
   </xsl:template><xsl:template name="aug_ChoiceText">
      <xsl:param name="lang"></xsl:param>
      <xsl:choose>
         <xsl:when test="$lang='en'">
            <xsl:text> August </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='es'">
            <xsl:text> Agosto </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='fr'">
            <xsl:text> août </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='de'">
            <xsl:text> August </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ru'">
            <xsl:text> Август </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ja'">
            <xsl:text> 8 月 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='zh'">
            <xsl:text> 8月 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ko'">
            <xsl:text> 8월 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='pt'">
            <xsl:text>Agosto </xsl:text>
         </xsl:when>
      </xsl:choose>
   </xsl:template><xsl:template name="sep_ChoiceText">
      <xsl:param name="lang"></xsl:param>
      <xsl:choose>
         <xsl:when test="$lang='en'">
            <xsl:text> September </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='es'">
            <xsl:text> Septiembre </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='fr'">
            <xsl:text> septembre </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='de'">
            <xsl:text> September </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ru'">
            <xsl:text> Сентябрь </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ja'">
            <xsl:text> 9 月 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='zh'">
            <xsl:text> 9月 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ko'">
            <xsl:text> 9월 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='pt'">
            <xsl:text>Setembro </xsl:text>
         </xsl:when>
      </xsl:choose>
   </xsl:template><xsl:template name="oct_ChoiceText">
      <xsl:param name="lang"></xsl:param>
      <xsl:choose>
         <xsl:when test="$lang='en'">
            <xsl:text> October </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='es'">
            <xsl:text> Octubre </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='fr'">
            <xsl:text> octobre </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='de'">
            <xsl:text> Oktober </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ru'">
            <xsl:text> Октябрь </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ja'">
            <xsl:text> 10 月 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='zh'">
            <xsl:text> 10月 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ko'">
            <xsl:text> 10월 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='pt'">
            <xsl:text>Outubro </xsl:text>
         </xsl:when>
      </xsl:choose>
   </xsl:template><xsl:template name="nov_ChoiceText">
      <xsl:param name="lang"></xsl:param>
      <xsl:choose>
         <xsl:when test="$lang='en'">
            <xsl:text> November </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='es'">
            <xsl:text> Noviembre </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='fr'">
            <xsl:text> novembre </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='de'">
            <xsl:text> November </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ru'">
            <xsl:text> Ноябрь </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ja'">
            <xsl:text> 11 月 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='zh'">
            <xsl:text> 11月 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ko'">
            <xsl:text> 11월 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='pt'">
            <xsl:text>Novembro </xsl:text>
         </xsl:when>
      </xsl:choose>
   </xsl:template><xsl:template name="dec_ChoiceText">
      <xsl:param name="lang"></xsl:param>
      <xsl:choose>
         <xsl:when test="$lang='en'">
            <xsl:text> December </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='es'">
            <xsl:text> Diciembre </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='fr'">
            <xsl:text> décembre </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='de'">
            <xsl:text> Dezember </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ru'">
            <xsl:text> Декабрь </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ja'">
            <xsl:text> 12 月 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='zh'">
            <xsl:text> 12月 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='ko'">
            <xsl:text> 12월 </xsl:text>
         </xsl:when>
         <xsl:when test="$lang='pt'">
            <xsl:text>Dezembro </xsl:text>
         </xsl:when>
      </xsl:choose>
   </xsl:template>   
   <xsl:template name="state19_1_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> Statement under Article 19(1) </xsl:text>
			</xsl:when>
			 <xsl:when test="$lang='es'">
           		 <xsl:text> Declaración según el Artículo 19(1) </xsl:text>
	         </xsl:when>
	          <xsl:when test="$lang='fr'">
	            <xsl:text> Déclaration selon l'article 19(1) </xsl:text>
	         </xsl:when>
	         <xsl:when test="$lang='de'">
	            <xsl:text> Erklärung gemäß Artikel 19(1) </xsl:text>
	         </xsl:when>
	         <xsl:when test="$lang='ru'">
	            <xsl:text> Объяснение в соответствии со статьей 19 (1) </xsl:text>
	         </xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 条約第19条（1）に基づく説明書  </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 条约第19条第（1）款的声明  </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text> 조약 제19조(1) 규정의 설명서 </xsl:text>
			</xsl:when>
			 <xsl:when test="$lang='pt'">
	            <xsl:text> Declaração conforme o Artigo 19(1) </xsl:text>
	         </xsl:when>
	         <xsl:when test="$lang='ar'">
	            <xsl:text> (إعلان وفق المادة  19 (1 </xsl:text>
	         </xsl:when>
			 <xsl:when test="$lang='it'">
	            <xsl:text> Dichiarazione ai sensi dell'articolo 19(1) </xsl:text>
	         </xsl:when>
			 <xsl:otherwise>
				<xsl:text> Statement under Article 19(1) </xsl:text>
			 </xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="amended_claims_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> Amended Claims (Article 19) </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> Reivindicaciones Modificadas (Artículo 19) </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text> Revendications modifiées (Article 19)  </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text> Geänderte Ansprüche (Artikel 19) </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
	            <xsl:text> Измененные претензии (статья 19)  </xsl:text>
	        </xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 補正された請求の範囲（条約第19条） </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 经修改的权利要求 (条约第19条) </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text> 청구범위 보정서 (조약 제19조) </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text> Reivindicações Modificadas (Artigo19) </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ar'">
				<xsl:text> مطالب مـعدلة (المادة  19) </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text> Rivendicazioni modificate (articolo 19) </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> Amended Claims </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	
	<xsl:template name="rec_ib_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:text> received by the International Bureau on </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='es'">
				<xsl:text> recibido por la Oficina Internacional el </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text> reçues par le Bureau International le </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text> beim Internationalen Büro eingegangen am </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
	            <xsl:text> Получено Международным бюро по </xsl:text>
	        </xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text> 国際事務局受理 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text> 国际局收到日: </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text> 국제사무국 접수일:  </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text> recebidas pela Secretaria Internacional no dia </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ar'">
				<xsl:text>استلمت في المكتب الدولي في </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text> ricevute dall'Ufficio Internazionale </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> received by the International Bureau on </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="figure_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='ar'">
				<xsl:text> رسم </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='en'">
				<xsl:text>Fig. </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
	            <xsl:text>фиг. </xsl:text>
	        </xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text>図</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text>图</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text>도</xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text>Fig. </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="rule_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='ar'">
            	<xsl:text>القاعدة</xsl:text>
         	</xsl:when>
			<xsl:when test="$lang='es'">
            	<xsl:text>Regla</xsl:text>
         	</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text>règle</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text>Regel</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text>правилом</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text>規則</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text>细则</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text>규칙</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Regra</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text>Regola</xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text>Rule</xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="rule91_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='es'">
            	<xsl:text>Rectificado según la Regla 91, </xsl:text>
         	</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text>Rectifié selon la règle 91, </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text>Berichtigt gemäß Regel 91, </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text>Исправлен в соответствии с правилом 91, </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text>規則91に基づく訂正 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text>根据细则91更正</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text>규칙 제91조에 의한 정정</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Retificado conforme a Regra 91, </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text>Rectified under Rule 91, </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="rule9_2_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='es'">
            	<xsl:text>Corregido según la Regla 9.2, </xsl:text>
         	</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text>Corrigé selon la règle 9.2, </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text>Berichtigt gemäß Regel 9.2, </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text>Исправлен в соответствии с правилом 9.2, </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text>規則9.2に基づく補充 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text>根据细则9.2改正 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text>규칙 제9.2조에 의한 보정 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Corregido conforme a Regra 9.2, </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text>Corrected under Rule 9.2, </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	
	<xsl:template name="rule26_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='es'">
            	<xsl:text>Corregido según la Regla 26, </xsl:text>
         	</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text>Corrigé selon la règle 26, </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text>Berichtigt gemäß Regel 26, </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text>Исправлен в соответствии с правилом 26, </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text>規則26に基づく補充 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text>根据细则26改正 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text>규칙 제26조에 의한 보정 </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Corregido conforme a Regra 26, </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text>Corrected under Rule 26, </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

    <xsl:template name="rule20_5_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='es'">
            	<xsl:text></xsl:text>
         	</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text></xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text></xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text></xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text></xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text></xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text></xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text></xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text></xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

 <xsl:template name="rule20_5bis_D_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='es'">
            	<xsl:text>Presentado por error (Regla 20.5bis)</xsl:text>
         	</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text>Indûment déposé (Règle 20.5bis)</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text>Fälschlicherweise eingereicht (Regel 20.5bis)</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text>Подан по ошибке (правилом 20.5bis)</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text>誤った提出（規則20.5の2）</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text>错误提交（细则20.5之二）</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text>잘못 제출됨 （규칙 20.5의2）</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Erroneamente apresentado (Regra 20.5bis)</xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text>Erroneously filed (Rule 20.5bis)</xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
		
	<xsl:template name="rule20_6_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='es'">
            	<xsl:text>Incorporación por Referencia (Regla 20.6), </xsl:text>
         	</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text>Incorpore(e) par Renvoi (Règle 20.6), </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text>Einbezogen durch Verweis (Regel 20.6), </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text>Исправлен в соответствии с правилом 20.6, </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text>引用による補充（規則20.6）</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text>援引加入（细则20.6）</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text>인용에 의한 보완 （규칙 제20.6조）</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Incorporado por Referência (Regra 20.6), </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text>Incorporated by Reference (Rule 20.6), </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="rule37_2_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='es'">
            	<xsl:text>Title established by the ISA under Rule 37.2</xsl:text>
         	</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text>Titre établi par l'ISA selon la règle 37.2</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text>Bezeichnung der Erfindung erstellt durch ISA gemäß Regel 37.2</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text>Установлен ISA в соответствии с правилом 37.2</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text>規則37.2に基づきISAが決定した発明の名称</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text>根据细则37.2由ISA制定的发明名称</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text>규칙 제37.2조에 의해 ISA가 부여한 발명의 명칭</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Título estabelecido pela ISA conforme a Regra 37.2</xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text>Title established by the ISA under Rule 37.2</xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	
	<xsl:template name="rule48_2_L_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='es'">
            	<xsl:text>Materia omitida de la publicación en virtud de la Regla 48.2.l), </xsl:text>
         	</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text>Élément exclu de la publication en vertu de la règle 48.2.l), </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text>Von der Veröffentlichung nach Regel 48.2(l) ausgeschlossene Inhalte, </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text>Материал, исключенный из публикации в соответствии с Правилом 48.2(l), </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text>規則48.2（l）に基づき公開の対象から省略された情報</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text>内容根据细则48.2（l）不予公布</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text>규칙 48.2（l）에 따라 국제공개에서 정보가 생략됨</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Matéria omitida da publicação de acordo com a Regra 48.2.l), </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text>Matter omitted from publication under Rule 48.2(l), </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="patcit_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:choose>
					<xsl:when test="$dtd-version &gt;= 1.6">
            			<xsl:text>PTL </xsl:text>
         			</xsl:when>
         			<xsl:otherwise>
         				<xsl:text>Patent Citation </xsl:text>
         			</xsl:otherwise>
				</xsl:choose>
         	</xsl:when>
			<xsl:when test="$lang='es'">
            	<xsl:text>patcit </xsl:text>
         	</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text>patcit </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text>patcit </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text>patcit </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>patcit </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text>特許文献</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text>专利文献</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text>특허 문헌</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text>patcit</xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text>patcit </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="nplcit_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='en'">
				<xsl:choose>
					<xsl:when test="$dtd-version &gt;= 1.6">
            			<xsl:text>NPL </xsl:text>
         			</xsl:when>
         			<xsl:otherwise>
         				<xsl:text>nplcit </xsl:text>
         			</xsl:otherwise>
				</xsl:choose>
         	</xsl:when>
			<xsl:when test="$lang='es'">
            	<xsl:text>nplcit </xsl:text>
         	</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text>nplcit </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text>nplcit </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text>nplcit </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>nplcit </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text>非特許文献</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text>非专利文献</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text>비특허 문헌</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text>nplcit</xsl:text>
			</xsl:when>
			<xsl:otherwise>
            	<xsl:text>nplcit </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="figref_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='es'">
            	<xsl:text>fig. </xsl:text>
         	</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text>fig. </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text>fig. </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text>fig. </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Инжир. </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text>図</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text>图</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text>도</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text>Fig. </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text>fig. </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="tables_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='es'">
            	<xsl:text>Table </xsl:text>
         	</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text>Tableaux</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text>Tabellen</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text>Таблица </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Table </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text>表</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text>表</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text>표</xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text>Table </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="maths_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='es'">
            	<xsl:text>Math. </xsl:text>
         	</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text>Math.</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text>Math.</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text>Математика. </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Math. </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text>数</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text>数</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text>수식</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text>Math.</xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text>Math. </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="chemistry_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='es'">
            	<xsl:text>Chem. </xsl:text>
         	</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text>Chem.</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text>Chem.</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text>Химическая формула  </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Chem. </xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text>化</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text>化</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text>화학식</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='it'">
				<xsl:text>Chem.</xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text>Chem. </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="day_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='ja'">
				<xsl:text>日</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text>日</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text>일</xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text>.</xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="month_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='ja'">
				<xsl:text>月</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text>月</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text>월</xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text>.</xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="year_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='ja'">
				<xsl:text>年</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text>年</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ko'">
				<xsl:text>년</xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text></xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="page_ChoiceText">
		<xsl:choose>
			<xsl:when test="$lang='es'">
            	<xsl:text>Página</xsl:text>
         	</xsl:when>
			<xsl:when test="$lang='fr'">
				<xsl:text>Page</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ru'">
				<xsl:text>страница</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='pt'">
				<xsl:text>Página</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='de'">
				<xsl:text>Seite</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='ja'">
				<xsl:text>頁</xsl:text>
			</xsl:when>
			<xsl:when test="$lang='zh'">
				<xsl:text>页</xsl:text>
			</xsl:when>			
			<xsl:when test="$lang='ko'">
				<xsl:text>페이지</xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text>Page</xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!--  Tests, these values must MATCH EXACTLY the XML EDITOR CONFIG -->
	<xsl:template name="rule91_ChoiceTest">
		<xsl:if test="contains(.,'規則91')
						or contains(.,'Rule 91')
						or contains(.,'규칙 제91')
						or contains(.,'细则91')
						or contains(.,'Regel 91')
						or contains(.,'Regla 91')
						or contains(.,'règle 91')
						or contains(.,'Regra 91')
						or contains(.,'правилом 91')
						">
						<xsl:text>&#xA0;</xsl:text>
						<sup>(R91)</sup>
	    </xsl:if>
	</xsl:template>

	<xsl:template name="rule37_2_ChoiceTest">
		<xsl:if test="contains(.,'規則37.2')
						or contains(.,'Rule 37.2')
						or contains(.,'규칙 제37.2')
						or contains(.,'根据细则37.2')
						or contains(.,'Regel 37.2')
						or contains(.,'Regla 37.2')
						or contains(.,'règle 37.2')
						or contains(.,'Regra 37.2')
						or contains(.,'правилом 37.2')
						">
						<xsl:text>&#xA0;</xsl:text>
						<sup>(R37.2)</sup>
		</xsl:if>
	</xsl:template>

	<xsl:template name="rule26_ChoiceTest">
		<xsl:if test="contains(.,'規則26')
						or contains(.,'Rule 26')
						or contains(.,'규칙 제26')
						or contains(.,'细则26')
						or contains(.,'Regel 26')
						or contains(.,'Regla 26')
						or contains(.,'Regra 26')
						or contains(.,'règle 26')
						or contains(.,'правилом 26')
						">
						<xsl:text>&#xA0;</xsl:text>
						<sup>(R26)</sup>
		</xsl:if>
	</xsl:template>

	<xsl:template name="rule48_2_L_ChoiceTest">
		<xsl:choose>
			<xsl:when test="contains(.,'規則48.2（l）')
						or contains(.,'Rule 48.2(l)')
						or contains(.,'규칙 48.2（l）에')
						or contains(.,'细则48.2（l）')
						or contains(.,'Regel 48.2(l)')
						or contains(.,'Правилом 48.2(l)')">
						<xsl:text>&#xA0;</xsl:text>
						<sup>(R48.2(l))</sup>
			</xsl:when>
			<xsl:when test="contains(.,'Regla 48.2.l)')
						or contains(.,'Regra 48.2.l)')
						or contains(.,'règle 48.2.l)')">
						<xsl:text>&#xA0;</xsl:text>
						<sup>(R48.2.l))</sup>
			
			</xsl:when>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="rule20_6_ChoiceTest">
		<xsl:if test="contains(.,'規則20.6')
						or contains(.,'Rule 20.6')
						or contains(.,'규칙 제20.6')
						or contains(.,'细则20.6')
						or contains(.,'Regel 20.6')
						or contains(.,'Regla 20.6')
						or contains(.,'Règle 20.6')
						or contains(.,'Regra 20.6')
						or contains(.,'правилом 20.6')
						">
						<xsl:text>&#xA0;</xsl:text>
						<sup>(R20.6)</sup>
		</xsl:if>
	</xsl:template>
	
	<xsl:template name="rule20_5_Bis_D_ChoiceTest">
		<xsl:variable name="rule20_5bis_D_text">
			<xsl:call-template name="rule20_5bis_D_ChoiceText"></xsl:call-template>
		</xsl:variable>
		<xsl:if test="contains(., $rule20_5bis_D_text)">
						<xsl:text>&#xA0;</xsl:text>
						<sup>(R20.5bis(d))</sup>
		</xsl:if>
	</xsl:template>
	
	<xsl:template name="containsRule20_5_Bis_D">
		<xsl:variable name="rule20_5bis_D_text">
			<xsl:call-template name="rule20_5bis_D_ChoiceText"></xsl:call-template>
		</xsl:variable>
		<xsl:if test="contains(.,$rule20_5bis_D_text)">
						<xsl:value-of select="true"/>
		</xsl:if>
	</xsl:template>
	
  <!-- Note: NO rule for 20.5 will be inserted in the test. and therefore no conflit with 20.5Bis -->
	<xsl:template name="rule20_5_Bis_C_ChoiceTest">
		<xsl:if test="contains(.,'規則20.5')
						or contains(.,'Rule 20.5')
						or contains(.,'규칙 제20.5')
						or contains(.,'细则20.5')
						or contains(.,'Regel 20.5')
						or contains(.,'Regla 20.5')
						or contains(.,'règle 20.5')
						or contains(.,'Regra 20.5')
						or contains(.,'правилом 20.5')
						">
						<xsl:text>&#xA0;</xsl:text>
						<!-- sup>(R20.5)</sup -->
						<sup></sup>
		</xsl:if>
	</xsl:template>
	
	<xsl:template name="rule9_2_ChoiceTest">
		<xsl:if test="contains(.,'規則9.2')
						or contains(.,'Rule 9.2')
						or contains(.,'규칙 제9.2')
						or contains(.,'细则9.2')
						or contains(.,'Regel 9.2')
						or contains(.,'Regla 9.2')
						or contains(.,'règle 9.2')
						or contains(.,'Regra 9.2')
						or contains(.,'правилом 9.2')
						">
						<xsl:text>&#xA0;</xsl:text>
						<sup>(R9.2)</sup>
		</xsl:if>
	</xsl:template>
		
	<xsl:template name="amended_claims_ChoiceTest">
			<xsl:if
				test="contains(.,'[補正後]') or contains(.,'[削除]') or contains(.,'[追加]')
				 	or contains(.,'[Amended]') or contains(.,'[Cancelled]') or contains(.,'[Added]')
				 	or contains(.,'[보정]') or contains(.,'[취소]') or contains(.,'[삭제]') or contains(.,'[추가]')
				 	or contains(.,'[已修改]') or contains(.,'[已删除]') or contains(.,'[新增加]')
				 	or contains(.,'Geändert') or contains(.,'Gestrichen') or contains(.,'Hinzugefügt')
				 	or contains(.,'Modificada') or contains(.,'Cancelada') or contains(.,'Añadida')
				 	or contains(.,'Modifiées') or contains(.,'Annulées') or contains(.,'Ajoutées')
				 	or contains(.,'Modificada') or contains(.,'Cancelada') or contains(.,'Adicionada')
				 	or contains(.,'Измененные')
				 	">
					<xsl:text>&#xA0;</xsl:text>
				 	<sup>*</sup></xsl:if>
	</xsl:template>	
   <xsl:template name="get_size">
      <xsl:param name="size_in"></xsl:param>
    <!-- NOTE: assumes screen resolution of 96 DPI (small icons) -->
        <!-- strip any units from attributes for mathematical operations to follow -->
      <xsl:variable name="unit" select="normalize-space(translate($size_in,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',''))"></xsl:variable>
      <xsl:variable name="nSize" select="translate($size_in,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"></xsl:variable>
      <xsl:variable name="size_out">
         <xsl:choose>
            <!-- if measured in milimeters -->
            <xsl:when test="contains($nSize,'MM')">
               <xsl:value-of select="round(number($unit) div 25.4 * 96)"></xsl:value-of>
            </xsl:when>
            <!-- if measured in centimeters -->
            <xsl:when test="contains($nSize,'CM')">
               <xsl:value-of select="round(number($unit) div 2.54 * 96)"></xsl:value-of>
            </xsl:when>
            <!-- if measured in inches -->
            <xsl:when test="contains($nSize,'IN')">
               <xsl:value-of select="round(number($unit) * 96)"></xsl:value-of>
            </xsl:when>
            <!-- if measured in pixels; NOTE: assumes 300 dpi scan -->
            <xsl:when test="contains($nSize,'PX')">
               <xsl:value-of select="round(number($unit) div 300 * 96)"></xsl:value-of>
            </xsl:when>
            <!-- use mm as default -->
            <xsl:otherwise>
               <xsl:value-of select="round(number($unit) div 25.4 * 96)"></xsl:value-of>
            </xsl:otherwise>
         </xsl:choose>
      </xsl:variable>
      <xsl:value-of select="$size_out"></xsl:value-of>
   </xsl:template>   
	<xsl:template name="format_date">
      <xsl:param name="lang"></xsl:param>
      <xsl:param name="date"></xsl:param>
      <xsl:param name="text"></xsl:param>
      <xsl:param name="year_only"></xsl:param>
      <xsl:param name="show_date"></xsl:param>
      <xsl:param name="add_comma"></xsl:param>
      <xsl:param name="yearStart"></xsl:param>
      <xsl:param name="monthStart"></xsl:param>
      <xsl:param name="dayStart"></xsl:param>
      <xsl:param name="nDate">
         <xsl:value-of select="normalize-space(translate($date,'/\.,-',''))"></xsl:value-of>
      </xsl:param>
      <xsl:param name="y">
		<xsl:choose>
			<xsl:when test="$yearStart=''">
				<xsl:value-of select="substring($nDate, 1,4)"></xsl:value-of>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="substring($nDate, $yearStart,4)"></xsl:value-of>
			</xsl:otherwise>
		</xsl:choose>
      </xsl:param>
      <xsl:param name="m">
		<xsl:choose>
			<xsl:when test="$monthStart=''">
				<xsl:value-of select="substring($nDate, 5,2)"></xsl:value-of>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="substring($nDate, $monthStart,2)"></xsl:value-of>
			</xsl:otherwise>
		</xsl:choose>
      </xsl:param>
      <xsl:param name="d">
		<xsl:choose>
			<xsl:when test="$dayStart=''">
				<xsl:value-of select="substring($nDate, 7,2)"></xsl:value-of>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="substring($nDate, $dayStart,2)"></xsl:value-of>
			</xsl:otherwise>
		</xsl:choose>
      </xsl:param>
	  <xsl:param name="date_render_mode" select="DMY"></xsl:param>
      <xsl:choose>        
         <xsl:when test="$year_only='1'">
            <xsl:value-of select="$y"></xsl:value-of>
         </xsl:when>
         <xsl:when test="$text != '1'">
            <xsl:value-of select="$y"></xsl:value-of>-<xsl:value-of select="$m"></xsl:value-of>-<xsl:value-of select="$d"></xsl:value-of>
         </xsl:when>
		 <xsl:when test="$date_render_mode = 'YMD'">
			<xsl:value-of select="$y"/>
			<xsl:if test="$y!=''">
				<xsl:call-template name="year_ChoiceText"/>
			</xsl:if>
			<xsl:value-of select="$m"/>
			<xsl:if test="$m!=''">
				<xsl:call-template name="month_ChoiceText"/>
			</xsl:if>
			<xsl:if test="$show_date='1'">
				<xsl:choose>
					<xsl:when test="starts-with($d, '0')">
						<xsl:value-of select="substring($d, 2)"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="$d"/>
					</xsl:otherwise>
				</xsl:choose>
				<xsl:if test="$d!=''">
					<xsl:call-template name="day_ChoiceText"/>
				</xsl:if>
			</xsl:if>
		 </xsl:when>
         <xsl:otherwise>
            <xsl:if test="$show_date='1'">
               <xsl:text> </xsl:text>
               <xsl:value-of select="$d"></xsl:value-of>
               <xsl:text> </xsl:text>
            </xsl:if>
            <xsl:choose>
               <xsl:when test="$m='01'">
                  <xsl:call-template name="jan_ChoiceText">
                     <xsl:with-param name="lang" select="$lang"></xsl:with-param>
                  </xsl:call-template>
               </xsl:when>
               <xsl:when test="$m='02'">
                  <xsl:call-template name="feb_ChoiceText">
                     <xsl:with-param name="lang" select="$lang"></xsl:with-param>
                  </xsl:call-template>
               </xsl:when>
               <xsl:when test="$m='03'">
                  <xsl:call-template name="mar_ChoiceText">
                     <xsl:with-param name="lang" select="$lang"></xsl:with-param>
                  </xsl:call-template>
               </xsl:when>
               <xsl:when test="$m='04'">
                  <xsl:call-template name="apr_ChoiceText">
                     <xsl:with-param name="lang" select="$lang"></xsl:with-param>
                  </xsl:call-template>
               </xsl:when>
               <xsl:when test="$m='05'">
                  <xsl:call-template name="may_ChoiceText">
                     <xsl:with-param name="lang" select="$lang"></xsl:with-param>
                  </xsl:call-template>
               </xsl:when>
               <xsl:when test="$m = '06'">
                  <xsl:call-template name="jun_ChoiceText">
                     <xsl:with-param name="lang" select="$lang"></xsl:with-param>
                  </xsl:call-template>
               </xsl:when>
               <xsl:when test="$m='07'">
                  <xsl:call-template name="jul_ChoiceText">
                     <xsl:with-param name="lang" select="$lang"></xsl:with-param>
                  </xsl:call-template>
               </xsl:when>
               <xsl:when test="$m='08'">
                  <xsl:call-template name="aug_ChoiceText">
                     <xsl:with-param name="lang" select="$lang"></xsl:with-param>
                  </xsl:call-template>
               </xsl:when>
               <xsl:when test="$m='09'">
                  <xsl:call-template name="sep_ChoiceText">
                     <xsl:with-param name="lang" select="$lang"></xsl:with-param>
                  </xsl:call-template>
               </xsl:when>
               <xsl:when test="$m='10'">
                  <xsl:call-template name="oct_ChoiceText">
                     <xsl:with-param name="lang" select="$lang"></xsl:with-param>
                  </xsl:call-template>
               </xsl:when>
               <xsl:when test="$m='11'">
                  <xsl:call-template name="nov_ChoiceText">
                     <xsl:with-param name="lang" select="$lang"></xsl:with-param>
                  </xsl:call-template>
               </xsl:when>
               <xsl:when test="$m='12'">
                  <xsl:call-template name="dec_ChoiceText">
                     <xsl:with-param name="lang" select="$lang"></xsl:with-param>
                  </xsl:call-template>
               </xsl:when>
                    <!-- trap error (e.g., 1-digit month) -->
               <xsl:otherwise>
                  <xsl:value-of select="$m"></xsl:value-of> 
                  <xsl:value-of select="$d"></xsl:value-of>
               </xsl:otherwise>
            </xsl:choose>
            <xsl:value-of select="$y"></xsl:value-of>
            <xsl:if test="$add_comma='1'">
               <xsl:text>, </xsl:text>
            </xsl:if>
         </xsl:otherwise>
      </xsl:choose>
	</xsl:template>
	<xsl:template name="uppercaser">      
		<xsl:param name="string"></xsl:param>      
		<xsl:value-of select="translate(normalize-space($string),                                      'abcdefghijklmnopqrstuvwxyzàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþабвгдежзийклмнопрстуфхцчшщъыьэюяčďľĺňŕřšůťž',  'ABCDEFGHIJKLMNOPQRSTUVWXYZÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯČĎĽĹŇŔŘŠŮŤŽ')"></xsl:value-of>
	</xsl:template>   
	<xsl:template name="format_period">
      <xsl:param name="string"></xsl:param>
      <xsl:param name="len" select="string-length($string)"></xsl:param>
      <xsl:choose>
         <xsl:when test="substring($string,$len)='.'"></xsl:when><!-- do nothing -->
         <xsl:otherwise>
            <xsl:text>.  </xsl:text><!-- add period -->
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>   
	<xsl:template name="format_comma">
      <xsl:param name="string"></xsl:param>
      <xsl:param name="len" select="string-length($string)"></xsl:param>
      <xsl:choose>
         <xsl:when test="substring($string,$len)=','">
            <xsl:text> </xsl:text>
         </xsl:when>
        <!-- do nothing -->
         <xsl:otherwise>                     
            <xsl:text>, </xsl:text><!-- add comma -->
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>   
	<xsl:template name="rtrim">
      <xsl:param name="string"></xsl:param>
      <xsl:param name="len" select="string-length($string)"></xsl:param>
      <xsl:param name="cut" select="number($len)-1"></xsl:param>
      <xsl:value-of select="substring($string,1,$cut)"></xsl:value-of>      
   </xsl:template>   
	<xsl:template name="format_full_name">
<!-- param for testing substrings -->       
      <xsl:param name="fName" select="normalize-space(.//first-name)"></xsl:param>
      <xsl:param name="lName" select="normalize-space(.//last-name)"></xsl:param>
      <xsl:param name="mName" select="normalize-space(.//middle-name)"></xsl:param>
      <xsl:param name="nName" select="normalize-space(./name)"></xsl:param>
      <xsl:param name="fLen" select="string-length($fName)"></xsl:param>
      <xsl:param name="lLen" select="string-length($lName)"></xsl:param>
      <xsl:param name="mLen" select="string-length($mName)"></xsl:param>
      <xsl:param name="nLen" select="string-length($nName)"></xsl:param>
      <xsl:choose>
        <!-- name text() -->
         <xsl:when test="./name">
            <xsl:choose>
               <xsl:when test="substring($nName,$nLen)='.'">
                  <xsl:value-of select="$nName"></xsl:value-of>
               </xsl:when>
               <xsl:otherwise>
                  <xsl:value-of select="$nName"></xsl:value-of>
                  <xsl:text>. </xsl:text>
               </xsl:otherwise>
            </xsl:choose>
         </xsl:when>
        <!-- name subelements used -->
         <xsl:otherwise>
            <xsl:call-template name="uppercaser">
               <xsl:with-param name="string" select="$lName"></xsl:with-param>
            </xsl:call-template>
            <xsl:choose>
                <!-- place a comma after author's last name, unless one is present; 
                     format last name in UPPERCASE  -->  
               <xsl:when test="substring($lName,$lLen)=','"> 
                  <xsl:text> </xsl:text>
               </xsl:when>
               <xsl:otherwise>
                  <xsl:text>, </xsl:text>
               </xsl:otherwise>
            </xsl:choose>
        <!-- place a period after author's first name, unless that contains
             a period (e.g., an initial: 'J.B. Greene') -->
            <xsl:choose>
                <!-- if first-name ends in period -->
               <xsl:when test="substring($fName,$fLen)='.'">
                    <!-- if there is a middle name, display that before any period -->
                  <xsl:choose>
                     <xsl:when test="./middle-name">
                        <xsl:choose>
                                <!-- if middle name ends in a period -->
                           <xsl:when test="substring($mName,$mLen)='.'">
                                    <!-- add fName -->
                              <xsl:call-template name="rtrim">
                                 <xsl:with-param name="string" select="$fName"></xsl:with-param>
                              </xsl:call-template>
                              <xsl:text> </xsl:text>
                                    <!--xsl:value-of select="$mName"/-->
                           </xsl:when>
                                <!-- middle name does NOT end in period; remove period from fName, inert mName -->
                           <xsl:otherwise>
                              <xsl:call-template name="rtrim">
                                 <xsl:with-param name="string" select="$fName"></xsl:with-param>
                              </xsl:call-template>
                              <xsl:text> </xsl:text> 
                                    <!--xsl:value-of select="$mName"/-->
                                    <!-- more than one author -->
                              <xsl:choose>
                                 <xsl:when test="following-sibling::author">
                                    <xsl:call-template name="and_ChoiceText"></xsl:call-template>
                                 </xsl:when>
                                 <xsl:otherwise>
                                    <xsl:if test="not(./role)">
                                       <xsl:text>. </xsl:text>
                                    </xsl:if>
                                 </xsl:otherwise>
                              </xsl:choose>
                           </xsl:otherwise>
                        </xsl:choose>
                     </xsl:when>
                        <!-- no middle name -->
                     <xsl:otherwise>
                        <xsl:choose>
                           <xsl:when test="./role">
                              <xsl:choose>
                                 <xsl:when test="substring($fName,$fLen)='.'">
                                    <xsl:call-template name="rtrim">
                                       <xsl:with-param name="string" select="$fName"></xsl:with-param>
                                    </xsl:call-template>
                                    <xsl:text> (</xsl:text> 
                                    <xsl:value-of select="./role"></xsl:value-of>
                                    <xsl:text>). </xsl:text>
                                 </xsl:when>
                                 <xsl:otherwise>
                                    <xsl:value-of select="$fName"></xsl:value-of>
                                    <xsl:text> (</xsl:text> 
                                    <xsl:value-of select="./role"></xsl:value-of>
                                    <xsl:text>). </xsl:text>
                                 </xsl:otherwise>
                              </xsl:choose>
                           </xsl:when>
                           <xsl:otherwise>
                              <xsl:text> </xsl:text> 
                              <xsl:value-of select="$fName"></xsl:value-of>
                           </xsl:otherwise>
                        </xsl:choose>
                     </xsl:otherwise>
                  </xsl:choose>
                  <xsl:text>  </xsl:text>
               </xsl:when>
                <!-- no period ending first name -->
               <xsl:otherwise>
                  <xsl:value-of select="$fName"></xsl:value-of>
                        <!-- if there is a middle name, display that before any period -->
                  <xsl:if test="./middle-name">
                     <xsl:choose>
                        <xsl:when test="substring($mName,$mLen)='.'">
                           <xsl:text> </xsl:text> 
                           <xsl:call-template name="rtrim">
                              <xsl:with-param name="string" select="$mName"></xsl:with-param>
                           </xsl:call-template>
                        </xsl:when>
                        <xsl:otherwise>
                           <xsl:text> </xsl:text> 
                           <xsl:value-of select="$mName"></xsl:value-of>
                        </xsl:otherwise>
                     </xsl:choose>
                  </xsl:if>
                  <xsl:if test="./role">
                     <xsl:choose>
                        <xsl:when test="substring($fName,$fLen)='.'">
                           <xsl:call-template name="rtrim">
                              <xsl:with-param name="string" select="$fName"></xsl:with-param>
                           </xsl:call-template>
                           <xsl:text> (</xsl:text> 
                           <xsl:value-of select="normalize-space(./role)"></xsl:value-of>
                           <xsl:text>). </xsl:text>
                        </xsl:when>
                        <xsl:otherwise>
                           <xsl:text> (</xsl:text> 
                           <xsl:value-of select="normalize-space(./role)"></xsl:value-of>
                           <xsl:text>). </xsl:text>
                        </xsl:otherwise>
                     </xsl:choose>
                  </xsl:if>
                        <!-- more than one author -->
                  <xsl:choose>
                     <xsl:when test="following-sibling::author">
                        <xsl:call-template name="and_ChoiceText"></xsl:call-template>
                     </xsl:when>
                     <xsl:otherwise>
                        <xsl:if test="not(./role)">
                           <xsl:text>. </xsl:text>
                        </xsl:if>
                     </xsl:otherwise>
                  </xsl:choose>
               </xsl:otherwise>
            </xsl:choose>
         </xsl:otherwise><!-- name/sub-elements -->
      </xsl:choose>
	</xsl:template>
	<xsl:template name="stringComparison">
		<xsl:param name="text1"></xsl:param>
		<xsl:param name="text2"></xsl:param>
		<xsl:param name="isCaseSensitive"></xsl:param>
		
		<xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyzàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþабвгдежзийклмнопрстуфхцчшщъыьэюяčďľĺňŕřšůťž'"></xsl:variable>
		<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯČĎĽĹŇŔŘŠŮŤŽ'"></xsl:variable>
		<xsl:variable name="text1a" select="normalize-space($text1)"></xsl:variable>
		<xsl:variable name="text2a" select="normalize-space($text2)"></xsl:variable>	
			
		<xsl:variable name="text1b">
			<xsl:choose>
				<xsl:when test="not('true' = $isCaseSensitive)">
					<xsl:value-of select="translate($text1a, $uppercase, $smallcase)"></xsl:value-of>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="$text1a"></xsl:value-of>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		<xsl:variable name="text2b">
			<xsl:choose>
				<xsl:when test="not('true' = $isCaseSensitive)">
					<xsl:value-of select="translate($text2a, $uppercase, $smallcase)"></xsl:value-of>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="$text2a"></xsl:value-of>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		
		<xsl:variable name="result">
			<xsl:choose>
				<xsl:when test="$text1b = $text2b">
					<xsl:value-of select="0"></xsl:value-of>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="1"></xsl:value-of>
				</xsl:otherwise>
			</xsl:choose>			
		</xsl:variable>
		
		<xsl:value-of select="$result"></xsl:value-of>
	</xsl:template>
	
	<xsl:template name="DDMMYYYY">
		<xsl:param name="date"/>
		<xsl:param name="nDate">
			<xsl:value-of select="normalize-space(translate($date,'/\.,-',''))"/>
		</xsl:param>
		<xsl:param name="y" select="substring($nDate, 1,4)"/>
		<xsl:param name="m" select="substring($nDate,5,2)"/>
		<xsl:param name="d" select="substring($nDate,7,2)"/>
		<!-- DD.MM.YYYY -->
		<xsl:if test="$d != ''">
			<xsl:value-of select="$d"/>.</xsl:if>
		<xsl:value-of select="$m"/>.<xsl:value-of select="$y"/>
	</xsl:template>

	<xsl:template name="mkDetectedRule">
		<!-- detect one rule text from target. -->
		<xsl:param name="target"/>
		<xsl:param name="ruleMarkText"/>
		<xsl:param name="ruleName"/>
		<!-- normalize brackets and ignore comma -->
		<xsl:variable name="normalized_target"       select="translate($target,      '（）,','()')"/>
		<xsl:variable name="normalized_ruleMarkText" select="translate($ruleMarkText,'（）,','()')"/>

		<xsl:if test="contains($normalized_target,concat('[',$normalized_ruleMarkText))">
			<xsl:variable name="residual">
				<xsl:value-of select="substring-after($normalized_target,$normalized_ruleMarkText)"/>
			</xsl:variable>
			<xsl:element name="DetectedRule">
				<ruleName><xsl:value-of select="$ruleName"/></ruleName>
				<residal>
					<xsl:if test="not(starts-with($residual,',') or starts-with($residual,' '))">
						<xsl:text> </xsl:text>
					</xsl:if>
					<xsl:value-of select="$residual"/>
				</residal>
			</xsl:element>
		</xsl:if>		
	</xsl:template>
	<xsl:template name="detect_rule_changes">
		<!-- Detect one or more rule changes from target. 
			Please note that this template does NOT detect all rule changes when same rules are applied to target.
		-->
		<xsl:param name="target"/>
		<xsl:param name="isR37_2"/> <!-- We should not display 37.2 in any case! -->
		<xsl:call-template name="mkDetectedRule">
			<xsl:with-param name="target" select="$target"/>
			<xsl:with-param name="ruleMarkText">
				<xsl:call-template name="rule91_ChoiceText" />
			</xsl:with-param>
			<xsl:with-param name="ruleName">
				<xsl:call-template name="rule_ChoiceText" /><xsl:text> 91,</xsl:text>
			</xsl:with-param>
		</xsl:call-template>
		<xsl:call-template name="mkDetectedRule">
			<xsl:with-param name="target" select="$target"/>
			<xsl:with-param name="ruleMarkText">
				<xsl:call-template name="rule26_ChoiceText" />
			</xsl:with-param>
			<xsl:with-param name="ruleName">
				<xsl:call-template name="rule_ChoiceText" /><xsl:text> 26,</xsl:text>
			</xsl:with-param>
		</xsl:call-template>
		<!-- Also support older version Japanese Rule 26 text -->
		<xsl:if test="$lang='ja'">
			<xsl:call-template name="mkDetectedRule">
				<xsl:with-param name="target" select="$target"/>
				<xsl:with-param name="ruleMarkText">
					<xsl:text>規則26に基づく差替え </xsl:text>
				</xsl:with-param>
				<xsl:with-param name="ruleName">
					<xsl:call-template name="rule_ChoiceText" /><xsl:text> 26,</xsl:text>
				</xsl:with-param>
			</xsl:call-template>
		</xsl:if>
		<xsl:call-template name="mkDetectedRule">
			<xsl:with-param name="target" select="$target"/>
			<xsl:with-param name="ruleMarkText">
				<xsl:call-template name="rule48_2_L_ChoiceText" />
			</xsl:with-param>
			<xsl:with-param name="ruleName">
				<xsl:call-template name="rule_ChoiceText" />
				<xsl:choose>
					<xsl:when test="'fr'=$lang or 'es'=$lang or 'pt'=$lang"><xsl:text> 48.2.l),</xsl:text></xsl:when>
					<xsl:otherwise><xsl:text> 48.2(l),</xsl:text></xsl:otherwise>
				</xsl:choose>
			</xsl:with-param>
		</xsl:call-template>
		<xsl:call-template name="mkDetectedRule">
			<xsl:with-param name="target" select="$target"/>
			<xsl:with-param name="ruleMarkText">
				<xsl:call-template name="rule20_6_ChoiceText" />
			</xsl:with-param>
			<xsl:with-param name="ruleName">
				<xsl:call-template name="rule_ChoiceText" /><xsl:text> 20.6,</xsl:text>
			</xsl:with-param>
		</xsl:call-template>
		<xsl:call-template name="mkDetectedRule">
			<xsl:with-param name="target" select="$target"/>
			<xsl:with-param name="ruleMarkText">
				<xsl:call-template name="rule20_5bis_D_ChoiceText" />
			</xsl:with-param>
			<xsl:with-param name="ruleName">
				<xsl:call-template name="rule_ChoiceText" /><xsl:text> 20.5bis(d)</xsl:text>
			</xsl:with-param>
		</xsl:call-template>
		<xsl:call-template name="mkDetectedRule">
			<xsl:with-param name="target" select="$target"/>
			<xsl:with-param name="ruleMarkText">
				<xsl:call-template name="rule9_2_ChoiceText" />
			</xsl:with-param>
			<xsl:with-param name="ruleName">
				<xsl:call-template name="rule_ChoiceText" /><xsl:text> 9.2,</xsl:text>
			</xsl:with-param>
		</xsl:call-template>
		<xsl:if test="$isR37_2='yes'">
			<xsl:call-template name="mkDetectedRule">
				<xsl:with-param name="target" select="$target"/>
				<xsl:with-param name="ruleMarkText">
					<xsl:call-template name="rule37_2_ChoiceText" />
				</xsl:with-param>
				<xsl:with-param name="ruleName">
					<xsl:call-template name="rule_ChoiceText" /><xsl:text> 37.2,</xsl:text>
				</xsl:with-param>
			</xsl:call-template>
			<!-- Also support older version Japanese Rule 37.2 text -->
			<xsl:call-template name="mkDetectedRule">
				<xsl:with-param name="target" select="$target"/>
				<xsl:with-param name="ruleMarkText">
					<xsl:text>規則37.2に基づく発明の名称</xsl:text>
				</xsl:with-param>
				<xsl:with-param name="ruleName">
					<xsl:call-template name="rule_ChoiceText" /><xsl:text> 37.2,</xsl:text>
				</xsl:with-param>
			</xsl:call-template>
		</xsl:if>
	</xsl:template>

	<xsl:template name="get_rule_text_residal">
		<!-- remove all rule texts from target-->
		<xsl:param name="target"/>
		<xsl:variable name="detected_rules">
			<xsl:call-template name="detect_rule_changes">
				<xsl:with-param name="target" select="$target"/>
				<xsl:with-param name="isR37_2">yes</xsl:with-param>
			</xsl:call-template>
		</xsl:variable>
		<xsl:choose>
			<xsl:when test="$detected_rules=''">
				<xsl:value-of select="$target"/>
			</xsl:when>
			<xsl:when test="$target=''"></xsl:when>
			<xsl:otherwise>
				<xsl:call-template name="get_rule_text_residal">
					<xsl:with-param name="target" select="substring-after($target,']')"></xsl:with-param>
				</xsl:call-template>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="extract_rule_text">
		<!-- extract all rule texts from target -->
		<xsl:param name="target"></xsl:param>
		<xsl:param name="rule_change_text">
			<xsl:value-of select="substring-after(substring-before($target,']'),'[')"/>
		</xsl:param>
		<xsl:param name="residal_text">
			<xsl:value-of select="substring-after($target,']')"/>
		</xsl:param>
		<xsl:variable name="detected_rules">
			<xsl:call-template name="detect_rule_changes">
				<xsl:with-param name="target" select="concat('[',$rule_change_text)"/>
				<xsl:with-param name="isR37_2">yes</xsl:with-param>
			</xsl:call-template>
		</xsl:variable>
		<xsl:choose>
			<xsl:when test="$detected_rules !=''">
				<xsl:if test="not( contains( $detected_rules , ' 37.2,' ) )" >
					<fo:block><xsl:value-of select="$detected_rules"/></fo:block>
				</xsl:if>
				<xsl:call-template name="extract_rule_text">
					<xsl:with-param name="target" select="$residal_text"/>
				</xsl:call-template>
			</xsl:when>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="figure-labels">
		<!-- Detect all rule-changes from figure-label attribute-->
		<xsl:param name="labelTexts" />
		<xsl:if test="$labelTexts">
			<fo:block>
				<xsl:call-template name="figure-label">
					<xsl:with-param name="labelText" select="substring-before($labelTexts, ';')" />
				</xsl:call-template>
			</fo:block>
			<xsl:if
				test="string-length(substring-after($labelTexts, ';')) &#x3E; 0">
				<xsl:call-template name="figure-labels">
					<xsl:with-param name="labelTexts"
						select="substring-after($labelTexts, ';')" />
				</xsl:call-template>
			</xsl:if>
		</xsl:if>
	</xsl:template>

	<xsl:template name="figure-label">
		<!-- Detect one rule change from figure-label attribute -->
		<xsl:param name="labelText" />
		<xsl:if test="contains($labelText, 'Rule 91')">
			<xsl:call-template name="rule_ChoiceText" /><xsl:text> 91, </xsl:text><xsl:value-of select="substring($labelText,1,10)" />
		</xsl:if>
		<xsl:if test="contains($labelText, 'Rule 26')">
			<xsl:call-template name="rule_ChoiceText" /><xsl:text> 26, </xsl:text><xsl:value-of select="substring($labelText,1,10)" />
		</xsl:if>
		<xsl:if test="contains($labelText, 'Rule 48.2(l)')">
			<xsl:call-template name="rule_ChoiceText" />
			<xsl:choose>
					<xsl:when test="'fr'=$lang or 'es'=$lang or 'pt'=$lang"><xsl:text> 48.2.l), </xsl:text></xsl:when>
					<xsl:otherwise><xsl:text> 48.2(l), </xsl:text></xsl:otherwise>
			</xsl:choose>
			<xsl:value-of select="substring($labelText,1,10)" />		
		</xsl:if>
		<xsl:if test="contains($labelText, 'Rule 20.6')">
			<xsl:call-template name="rule_ChoiceText" /><xsl:text> 20.6, </xsl:text><xsl:value-of select="substring($labelText,1,10)" />
		</xsl:if>
		<xsl:if test="contains($labelText, 'Rule 20.5bis(d)')">
			<xsl:call-template name="rule_ChoiceText" /><xsl:text> 20.5bis(d)</xsl:text><!-- only text but no date for this rule -->
		</xsl:if>
		<!-- The rule 20.5 appears in drawing part in HTML, Pubcopy, PDF, which is no need because of the rule20.5(C). -->
		<xsl:if test="contains($labelText, 'Rule 9.2')">
			<xsl:call-template name="rule_ChoiceText" /><xsl:text> 9.2, </xsl:text><xsl:value-of select="substring($labelText,1,10)" />
		</xsl:if>
	</xsl:template>

	<!-- calculate the sum of all the columns of a table -->
	<xsl:template name="calculate-width-sum">
		<xsl:param name="nodes" select="/root/colspec"/>
		<xsl:param name="sum" select="0"/>
		<xsl:choose>
			<xsl:when test="count($nodes) = 0">
				<xsl:value-of select="$sum"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:variable name="current-width" select="number($nodes[1]/@colwidth)"/>
				<xsl:variable name="new-sum" select="$sum + $current-width"/>
				<xsl:call-template name="calculate-width-sum">
					<xsl:with-param name="nodes" select="$nodes[position() > 1]"/>
					<xsl:with-param name="sum" select="$new-sum"/>
				</xsl:call-template>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>	
</xsl:stylesheet>