<?xml version="1.0" encoding="UTF-8"?>
<!--Erstellt und generiert von Altova StyleVision Enterprise Edition 2015 rel. 3 (x64) - nähere Informationen siehe http://www.altova.com/de/stylevision-->
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:altova="http://www.altova.com" xmlns:altova-xfi="http://www.altova.com/xslt-extensions/xbrl" xmlns:altovaext="http://www.altova.com/xslt-extensions" xmlns:array="http://www.w3.org/2005/xpath-functions/array" xmlns:clitype="clitype" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:invoice="http://www.forum-datenaustausch.ch/invoice" xmlns:iso4217="http://www.xbrl.org/2003/iso4217" xmlns:ix="http://www.xbrl.org/2008/inlineXBRL" xmlns:java="java" xmlns:link="http://www.xbrl.org/2003/linkbase" xmlns:map="http://www.w3.org/2005/xpath-functions/map" xmlns:math="http://www.w3.org/2005/xpath-functions/math" xmlns:sps="http://www.altova.com/StyleVision/user-xpath-functions" xmlns:xbrldi="http://xbrl.org/2006/xbrldi" xmlns:xbrli="http://www.xbrl.org/2003/instance" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" xmlns:xff="http://www.xbrl.org/2010/function/formula" xmlns:xfi="http://www.xbrl.org/2008/function/instance" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" exclude-result-prefixes="#all">
	<xsl:output method="text" encoding="ISO-8859-1"/>
	<xsl:param name="altova:bGeneratingFromPxf" select="false()"/>
	<xsl:param name="SV_OutputFormat" select="'RTF'"/>
	<xsl:param name="SV_BaseOutputFileName" as="xs:string?">
		<xsl:sequence select="for $i in altovaext:get-base-output-uri(), $j in tokenize( $i, &apos;[/\\]&apos; )[last()] return replace( $j, &apos;\.[^\.\s#%;]*$&apos;, &apos;&apos; )" use-when="function-available(&apos;altovaext:get-base-output-uri&apos;)"/>
	</xsl:param>
	<xsl:param name="SV_GeneratedFileNamePrefix" select="if ( $SV_BaseOutputFileName ) then $SV_BaseOutputFileName else &apos;RechnungsantwortStyleVision&apos;" as="xs:string?"/>
	<xsl:variable name="XML" select="/"/>
	<xsl:decimal-format name="format1" grouping-separator=" " decimal-separator=","/>
	
	<xsl:variable name="altova:bEmbedImages" as="xs:boolean" select="true()"/>
	<xsl:variable name="altova:nPxPerIn" select="96"/>
	<xsl:variable name="altova:bDoFirstSectionBreak" as="xs:boolean" select="true()"/>
	<xsl:variable name="altova:sCssSwitch" as="xs:string" select="''"/>
	<xsl:variable name="altova:DocumentMonolith">
		<altova:Document altova:Url="{if ($SV_BaseOutputFileName) then concat($SV_BaseOutputFileName,'.rtf') else ''}">
			<xsl:variable name="templatetablelevel" select="0"/>
			<altova:DocumentProperties altova:Author="" altova:Keywords="" altova:Subject="" altova:Title=""/>
			<xsl:text>\dntblnsbdb\fs24\f0</xsl:text>
			<altova:DocumentSection altova:PageWidthPt="612" altova:MarginLeftPt="43" altova:MarginRightPt="43" altova:PageHeightPt="792" altova:MarginTopPt="56" altova:MarginBottomPt="56" altova:Columns="1" altova:ColumnGapPt="36" altova:RtfSectionIntro="\sectd"/>
			<xsl:text>\facingp\pgwsxn12240\pghsxn15840\margtsxn-1120\marglsxn860\margbsxn-1120\margrsxn860\headery420\footery420\cols1\colsx720\pgndec\ftnbj\ftnrstcont\ftnnar</xsl:text>
			<xsl:text>{</xsl:text>
			<xsl:text>\headerl </xsl:text>
			<xsl:call-template name="EmptyHeader"/>
			<xsl:text>}</xsl:text>
			<xsl:text>{</xsl:text>
			<xsl:text>\headerr </xsl:text>
			<xsl:call-template name="EmptyHeader"/>
			<xsl:text>}</xsl:text>
			<xsl:text>{</xsl:text>
			<xsl:text>\footerl </xsl:text>
			<xsl:call-template name="EmptyFooter"/>
			<xsl:text>}</xsl:text>
			<xsl:text>{</xsl:text>
			<xsl:text>\footerr </xsl:text>
			<xsl:call-template name="EmptyFooter"/>
			<xsl:text>}</xsl:text>
			<altova:AfterHeadersFooters/>
			<altova:paragraph altova:selector="h1" altova:character-styles="\f1\fs48\b" altova:character-reset-styles="\fs24\f0\b0" altova:paragraph-styles="\sl0\sa0\sl0\sa0" altova:is-div="false">
				<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
					<xsl:text>\u82?\u101?\u99?\u104?\u110?\u117?\u110?\u103?\u115?\u97?\u110?\u116?\u119?\u111?\u114?\u116?</xsl:text>
				</altova:text-block>
			</altova:paragraph>
			<xsl:variable name="altova:CurrContextGrid_0" select="."/>
			<altova:table>
				<xsl:variable name="altova:ColumnData"/>
				<altova:TableGrid>
					<altova:GridCol altova:sWidth="6350" altova:sType="twips"/>
					<altova:GridCol altova:sWidth="0" altova:sType="auto"/>
				</altova:TableGrid>
				<altova:TableStyles altova:nBorderSpacingPt="1.50" altova:sBorderCollapse="separate" altova:nCellPaddingPt="1.50" altova:nLeftMarginPt="0.00">
					<xsl:text>\trbrdrt\brdrnil\trbrdrl\brdrnil\trbrdrb\brdrnil\trbrdrr\brdrnil</xsl:text>
					<altova:TableWidth altova:sWidth="{'100%'}"/>
				</altova:TableStyles>
				<altova:table-row>
					<xsl:element name="altova:TableRowStyles">
						<xsl:text>\trrh0</xsl:text>
					</xsl:element>
					<altova:table-cell altova:paragraph-styles="\sl0">
						<altova:TableCellStyles altova:nColSpan="1">
							<xsl:text>\clvertalt</xsl:text>
						</altova:TableCellStyles>
						<altova:text-block>
							<xsl:text>\u82?\u101?\u99?\u104?\u110?\u117?\u110?\u103?\u101?\u110?\u117?\u109?\u109?\u101?\u114?\u58?\u32?</xsl:text>
						</altova:text-block>
						<xsl:for-each select="$XML">
							<xsl:for-each select="invoice:response">
								<xsl:for-each select="invoice:payload">
									<xsl:for-each select="invoice:invoice">
										<xsl:for-each select="@request_id">
											<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
												<altova:string-to-unicode>
													<xsl:value-of select="string(.)"/>
												</altova:string-to-unicode>
											</altova:text-block>
										</xsl:for-each>
									</xsl:for-each>
								</xsl:for-each>
							</xsl:for-each>
						</xsl:for-each>
						<altova:new-line/>
						<altova:text-block>
							<xsl:text>\u82?\u101?\u99?\u104?\u110?\u117?\u110?\u103?\u115?\u100?\u97?\u116?\u117?\u109?\u58?\u32?</xsl:text>
						</altova:text-block>
						<xsl:for-each select="$XML">
							<xsl:for-each select="invoice:response">
								<xsl:for-each select="invoice:payload">
									<xsl:for-each select="invoice:invoice">
										<xsl:for-each select="@request_date">
											<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
												<altova:string-to-unicode>
													<xsl:value-of select="format-number(number(substring(string(string(.)), 9, 2)), '00', 'format1')"/>
													<xsl:variable name="sText" as="xs:string?">
														<xsl:text>. </xsl:text>
													</xsl:variable>
													<xsl:value-of select="$sText"/>
													<xsl:variable name="sText" as="xs:string?">
														<xsl:call-template name="DateToMonthName">
															<xsl:with-param name="sDate" select="string(string(.))"/>
															<xsl:with-param name="sFormat" select="'long'"/>
														</xsl:call-template>
													</xsl:variable>
													<xsl:value-of select="$sText"/>
													<xsl:variable name="sText" as="xs:string?">
														<xsl:text> </xsl:text>
													</xsl:variable>
													<xsl:value-of select="$sText"/>
													<xsl:value-of select="format-number(number(substring(string(string(string(.))), 1, 4)), '0000', 'format1')"/>
													<xsl:variable name="sText" as="xs:string?">
														<xsl:text>, </xsl:text>
													</xsl:variable>
													<xsl:value-of select="$sText"/>
													<xsl:value-of select="format-number(number(substring(string(string(.)), 12, 2)), '00', 'format1')"/>
													<xsl:variable name="sText" as="xs:string?">
														<xsl:text>:</xsl:text>
													</xsl:variable>
													<xsl:value-of select="$sText"/>
													<xsl:value-of select="format-number(number(substring(string(string(.)), 15, 2)), '00', 'format1')"/>
													<xsl:variable name="sText" as="xs:string?">
														<xsl:text>:</xsl:text>
													</xsl:variable>
													<xsl:value-of select="$sText"/>
													<xsl:choose>
														<xsl:when test="contains(string(string(.)), 'Z')">
															<xsl:value-of select="format-number(number(substring-after(substring-after(substring-before(string(string(.)), 'Z'), ':'), ':')), '00', 'format1')"/>
														</xsl:when>
														<xsl:when test="contains(string(string(.)), '+')">
															<xsl:value-of select="format-number(number(substring-after(substring-after(substring-before(string(string(.)), '+'), ':'), ':')), '00', 'format1')"/>
														</xsl:when>
														<xsl:when test="contains(substring(string(string(.)), 18), '-')">
															<xsl:value-of select="format-number(number(substring-before(substring(string(string(.)), 18), '-')), '00', 'format1')"/>
														</xsl:when>
														<xsl:otherwise>
															<xsl:value-of select="format-number(number(substring(string(string(.)), 18)), '00', 'format1')"/>
														</xsl:otherwise>
													</xsl:choose>
												</altova:string-to-unicode>
											</altova:text-block>
										</xsl:for-each>
									</xsl:for-each>
								</xsl:for-each>
							</xsl:for-each>
						</xsl:for-each>
					</altova:table-cell>
					<altova:table-cell altova:paragraph-styles="\sl0">
						<altova:TableCellStyles altova:nColSpan="1">
							<xsl:text>\clvertalt</xsl:text>
						</altova:TableCellStyles>
						<xsl:if test="exists(invoice:response/invoice:payload/invoice:reminder)">
							<altova:text-block>
								<xsl:text>\u77?\u97?\u104?\u110?\u117?\u110?\u103?\u58?\u32?</xsl:text>
							</altova:text-block>
							<xsl:for-each select="$XML">
								<xsl:for-each select="invoice:response">
									<xsl:for-each select="invoice:payload">
										<xsl:for-each select="invoice:reminder">
											<xsl:for-each select="@request_id">
												<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
													<altova:string-to-unicode>
														<xsl:value-of select="string(.)"/>
													</altova:string-to-unicode>
												</altova:text-block>
											</xsl:for-each>
										</xsl:for-each>
									</xsl:for-each>
								</xsl:for-each>
							</xsl:for-each>
							<altova:new-line/>
							<altova:text-block>
								<xsl:text>\u77?\u97?\u104?\u110?\u100?\u97?\u116?\u117?\u109?\u58?\u32?</xsl:text>
							</altova:text-block>
							<xsl:for-each select="$XML">
								<xsl:for-each select="invoice:response">
									<xsl:for-each select="invoice:payload">
										<xsl:for-each select="invoice:reminder">
											<xsl:for-each select="@request_date">
												<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
													<altova:string-to-unicode>
														<xsl:value-of select="format-number(number(substring(string(string(.)), 9, 2)), '00', 'format1')"/>
														<xsl:variable name="sText" as="xs:string?">
															<xsl:text>. </xsl:text>
														</xsl:variable>
														<xsl:value-of select="$sText"/>
														<xsl:variable name="sText" as="xs:string?">
															<xsl:call-template name="DateToMonthName">
																<xsl:with-param name="sDate" select="string(string(.))"/>
																<xsl:with-param name="sFormat" select="'long'"/>
															</xsl:call-template>
														</xsl:variable>
														<xsl:value-of select="$sText"/>
														<xsl:variable name="sText" as="xs:string?">
															<xsl:text> </xsl:text>
														</xsl:variable>
														<xsl:value-of select="$sText"/>
														<xsl:value-of select="format-number(number(substring(string(string(string(.))), 1, 4)), '0000', 'format1')"/>
														<xsl:variable name="sText" as="xs:string?">
															<xsl:text>, </xsl:text>
														</xsl:variable>
														<xsl:value-of select="$sText"/>
														<xsl:value-of select="format-number(number(substring(string(string(.)), 12, 2)), '00', 'format1')"/>
														<xsl:variable name="sText" as="xs:string?">
															<xsl:text>:</xsl:text>
														</xsl:variable>
														<xsl:value-of select="$sText"/>
														<xsl:value-of select="format-number(number(substring(string(string(.)), 15, 2)), '00', 'format1')"/>
														<xsl:variable name="sText" as="xs:string?">
															<xsl:text>:</xsl:text>
														</xsl:variable>
														<xsl:value-of select="$sText"/>
														<xsl:choose>
															<xsl:when test="contains(string(string(.)), 'Z')">
																<xsl:value-of select="format-number(number(substring-after(substring-after(substring-before(string(string(.)), 'Z'), ':'), ':')), '00', 'format1')"/>
															</xsl:when>
															<xsl:when test="contains(string(string(.)), '+')">
																<xsl:value-of select="format-number(number(substring-after(substring-after(substring-before(string(string(.)), '+'), ':'), ':')), '00', 'format1')"/>
															</xsl:when>
															<xsl:when test="contains(substring(string(string(.)), 18), '-')">
																<xsl:value-of select="format-number(number(substring-before(substring(string(string(.)), 18), '-')), '00', 'format1')"/>
															</xsl:when>
															<xsl:otherwise>
																<xsl:value-of select="format-number(number(substring(string(string(.)), 18)), '00', 'format1')"/>
															</xsl:otherwise>
														</xsl:choose>
													</altova:string-to-unicode>
												</altova:text-block>
											</xsl:for-each>
										</xsl:for-each>
									</xsl:for-each>
								</xsl:for-each>
							</xsl:for-each>
							<altova:new-line/>
							<altova:text-block>
								<xsl:text>\u77?\u97?\u104?\u110?\u115?\u116?\u117?\u102?\u101?\u58?\u32?</xsl:text>
							</altova:text-block>
							<xsl:for-each select="$XML">
								<xsl:for-each select="invoice:response">
									<xsl:for-each select="invoice:payload">
										<xsl:for-each select="invoice:reminder">
											<xsl:for-each select="@reminder_level">
												<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
													<altova:string-to-unicode>
														<xsl:value-of select="string(.)"/>
													</altova:string-to-unicode>
												</altova:text-block>
											</xsl:for-each>
										</xsl:for-each>
									</xsl:for-each>
								</xsl:for-each>
							</xsl:for-each>
						</xsl:if>
						<altova:new-line/>
					</altova:table-cell>
				</altova:table-row>
			</altova:table>
			<xsl:if test="exists( invoice:response/invoice:payload/invoice:body/invoice:pending )">
				<xsl:for-each select="$XML">
					<xsl:for-each select="invoice:response">
						<xsl:for-each select="invoice:payload">
							<xsl:for-each select="invoice:body">
								<xsl:for-each select="invoice:pending">
									<xsl:call-template name="PendingState">
										<xsl:with-param name="templatetablelevel" select="$templatetablelevel + 0"/>
									</xsl:call-template>
								</xsl:for-each>
							</xsl:for-each>
						</xsl:for-each>
					</xsl:for-each>
				</xsl:for-each>
			</xsl:if>
			<xsl:if test="exists( invoice:response/invoice:payload/invoice:body/invoice:accepted )">
				<xsl:for-each select="$XML">
					<xsl:for-each select="invoice:response">
						<xsl:for-each select="invoice:payload">
							<xsl:for-each select="invoice:body">
								<xsl:for-each select="invoice:accepted">
									<xsl:call-template name="AcceptedState">
										<xsl:with-param name="templatetablelevel" select="$templatetablelevel + 0"/>
									</xsl:call-template>
								</xsl:for-each>
							</xsl:for-each>
						</xsl:for-each>
					</xsl:for-each>
				</xsl:for-each>
			</xsl:if>
			<xsl:if test="exists( invoice:response/invoice:payload/invoice:body/invoice:rejected )">
				<xsl:for-each select="$XML">
					<xsl:for-each select="invoice:response">
						<xsl:for-each select="invoice:payload">
							<xsl:for-each select="invoice:body">
								<xsl:for-each select="invoice:rejected">
									<xsl:call-template name="RejectedState">
										<xsl:with-param name="templatetablelevel" select="$templatetablelevel + 0"/>
									</xsl:call-template>
								</xsl:for-each>
							</xsl:for-each>
						</xsl:for-each>
					</xsl:for-each>
				</xsl:for-each>
			</xsl:if>
			<altova:text-block>
				<xsl:text>\u84?\u104?\u101?\u114?\u97?\u112?\u101?\u117?\u116?\u58?\u32?</xsl:text>
			</altova:text-block>
			<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
				<xsl:text>\u71?\u76?\u78?\u32?</xsl:text>
			</altova:text-block>
			<xsl:for-each select="$XML">
				<xsl:for-each select="invoice:response">
					<xsl:for-each select="invoice:payload">
						<xsl:for-each select="invoice:body">
							<xsl:for-each select="invoice:provider">
								<xsl:for-each select="@ean_party">
									<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
										<altova:string-to-unicode>
											<xsl:value-of select="string(.)"/>
										</altova:string-to-unicode>
									</altova:text-block>
								</xsl:for-each>
							</xsl:for-each>
						</xsl:for-each>
					</xsl:for-each>
				</xsl:for-each>
			</xsl:for-each>
			<altova:new-line/>
			<altova:text-block>
				<xsl:text>\u86?\u101?\u114?\u115?\u105?\u99?\u104?\u101?\u114?\u117?\u110?\u103?\u58?\u32?</xsl:text>
			</altova:text-block>
			<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
				<xsl:text>\u71?\u76?\u78?\u32?</xsl:text>
			</altova:text-block>
			<xsl:for-each select="$XML">
				<xsl:for-each select="invoice:response">
					<xsl:for-each select="invoice:payload">
						<xsl:for-each select="invoice:body">
							<xsl:for-each select="invoice:insurance">
								<xsl:for-each select="@ean_party">
									<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
										<altova:string-to-unicode>
											<xsl:value-of select="string(.)"/>
										</altova:string-to-unicode>
									</altova:text-block>
								</xsl:for-each>
							</xsl:for-each>
						</xsl:for-each>
					</xsl:for-each>
				</xsl:for-each>
			</xsl:for-each>
			<altova:paragraph altova:selector="h2" altova:character-styles="\f1\fs36\b" altova:character-reset-styles="\fs24\f0\b0" altova:paragraph-styles="\sl0\sa0\sl0\sa0" altova:is-div="false">
				<altova:text-block>
					<xsl:text>\u80?\u97?\u116?\u105?\u101?\u110?\u116?</xsl:text>
				</altova:text-block>
			</altova:paragraph>
			<xsl:variable name="altova:CurrContextGrid_1" select="."/>
			<altova:table>
				<xsl:variable name="altova:ColumnData"/>
				<altova:TableGrid>
					<altova:GridCol altova:sWidth="5069" altova:sType="twips"/>
					<altova:GridCol altova:sWidth="0" altova:sType="auto"/>
				</altova:TableGrid>
				<altova:TableStyles altova:nBorderSpacingPt="0.00" altova:sBorderCollapse="separate" altova:nCellPaddingPt="0.00" altova:nLeftMarginPt="0.00">
					<xsl:text>\trbrdrt\brdroutset\brdrcf3\brdrw15\trbrdrl\brdroutset\brdrcf3\brdrw15\trbrdrb\brdroutset\brdrcf3\brdrw15\trbrdrr\brdroutset\brdrcf3\brdrw15</xsl:text>
					<altova:Borders>
						<altova:Left altova:nWidthPt="0.75"/>
						<altova:Right altova:nWidthPt="0.75"/>
						<altova:Top altova:nWidthPt="0.75"/>
						<altova:Bottom altova:nWidthPt="0.75"/>
					</altova:Borders>
					<altova:TableWidth altova:sWidth="{'100%'}"/>
				</altova:TableStyles>
				<altova:table-row>
					<xsl:element name="altova:TableRowStyles">
						<xsl:text>\trrh0</xsl:text>
					</xsl:element>
					<altova:table-cell altova:paragraph-styles="\sl0">
						<altova:TableCellStyles altova:nColSpan="1">
							<xsl:text>\clvertalt</xsl:text>
							<altova:Borders>
								<altova:Top>
									<xsl:text>\clbrdrt</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf4</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Top>
								<altova:Bottom>
									<xsl:text>\clbrdrb</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf5</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Bottom>
								<altova:Left>
									<xsl:text>\clbrdrl</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf4</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Left>
								<altova:Right>
									<xsl:text>\clbrdrr</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf5</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Right>
							</altova:Borders>
						</altova:TableCellStyles>
						<xsl:for-each select="$XML">
							<xsl:for-each select="invoice:response">
								<xsl:for-each select="invoice:payload">
									<xsl:for-each select="invoice:body">
										<xsl:for-each select="invoice:patient">
											<xsl:for-each select="invoice:person">
												<xsl:call-template name="Person_Adresse">
													<xsl:with-param name="templatetablelevel" select="$templatetablelevel + 1"/>
												</xsl:call-template>
											</xsl:for-each>
										</xsl:for-each>
									</xsl:for-each>
								</xsl:for-each>
							</xsl:for-each>
						</xsl:for-each>
						<altova:new-line/>
					</altova:table-cell>
					<altova:table-cell altova:paragraph-styles="\sl0">
						<altova:TableCellStyles altova:nColSpan="1">
							<xsl:text>\clvertalt</xsl:text>
							<altova:Borders>
								<altova:Top>
									<xsl:text>\clbrdrt</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf4</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Top>
								<altova:Bottom>
									<xsl:text>\clbrdrb</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf5</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Bottom>
								<altova:Left>
									<xsl:text>\clbrdrl</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf4</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Left>
								<altova:Right>
									<xsl:text>\clbrdrr</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf5</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Right>
							</altova:Borders>
						</altova:TableCellStyles>
						<altova:text-block>
							<xsl:text>\u71?\u101?\u98?\u117?\u114?\u116?\u115?\u116?\u97?\u103?\u58?\u32?</xsl:text>
						</altova:text-block>
						<xsl:for-each select="$XML">
							<xsl:for-each select="invoice:response">
								<xsl:for-each select="invoice:payload">
									<xsl:for-each select="invoice:body">
										<xsl:for-each select="invoice:patient">
											<xsl:for-each select="@birthdate">
												<altova:text-block>
													<altova:string-to-unicode>
														<xsl:value-of select="format-number(number(substring(string(string(.)), 9, 2)), '00', 'format1')"/>
														<xsl:variable name="sText" as="xs:string?">
															<xsl:text>. </xsl:text>
														</xsl:variable>
														<xsl:value-of select="$sText"/>
														<xsl:variable name="sText" as="xs:string?">
															<xsl:call-template name="DateToMonthName">
																<xsl:with-param name="sDate" select="string(string(.))"/>
																<xsl:with-param name="sFormat" select="'long'"/>
															</xsl:call-template>
														</xsl:variable>
														<xsl:value-of select="$sText"/>
														<xsl:variable name="sText" as="xs:string?">
															<xsl:text> </xsl:text>
														</xsl:variable>
														<xsl:value-of select="$sText"/>
														<xsl:value-of select="format-number(number(substring(string(string(string(.))), 1, 4)), '0000', 'format1')"/>
													</altova:string-to-unicode>
												</altova:text-block>
											</xsl:for-each>
										</xsl:for-each>
									</xsl:for-each>
								</xsl:for-each>
							</xsl:for-each>
						</xsl:for-each>
						<altova:new-line/>
						<altova:text-block>
							<xsl:text>\u65?\u72?\u86?\u45?\u78?\u117?\u109?\u109?\u101?\u114?\u58?\u32?</xsl:text>
						</altova:text-block>
						<xsl:for-each select="$XML">
							<xsl:for-each select="invoice:response">
								<xsl:for-each select="invoice:payload">
									<xsl:for-each select="invoice:body">
										<xsl:for-each select="invoice:patient">
											<xsl:for-each select="@ssn">
												<altova:text-block>
													<altova:string-to-unicode>
														<xsl:value-of select="string(.)"/>
													</altova:string-to-unicode>
												</altova:text-block>
											</xsl:for-each>
										</xsl:for-each>
									</xsl:for-each>
								</xsl:for-each>
							</xsl:for-each>
						</xsl:for-each>
					</altova:table-cell>
				</altova:table-row>
			</altova:table>
			<altova:paragraph altova:selector="h2" altova:character-styles="\f1\fs36\b" altova:character-reset-styles="\fs24\f0\b0" altova:paragraph-styles="\sl0\sa0\sl0\sa0" altova:is-div="false">
				<altova:text-block>
					<xsl:text>\u75?\u111?\u110?\u116?\u97?\u107?\u116?</xsl:text>
				</altova:text-block>
			</altova:paragraph>
			<xsl:variable name="altova:CurrContextGrid_2" select="."/>
			<altova:table>
				<xsl:variable name="altova:ColumnData"/>
				<altova:TableGrid>
					<altova:GridCol altova:sWidth="5054" altova:sType="twips"/>
					<altova:GridCol altova:sWidth="5126" altova:sType="twips"/>
					<altova:GridCol altova:sWidth="0" altova:sType="auto"/>
				</altova:TableGrid>
				<altova:TableStyles altova:nBorderSpacingPt="0.00" altova:sBorderCollapse="separate" altova:nCellPaddingPt="0.00" altova:nLeftMarginPt="0.00">
					<xsl:text>\trbrdrt\brdroutset\brdrcf3\brdrw15\trbrdrl\brdroutset\brdrcf3\brdrw15\trbrdrb\brdroutset\brdrcf3\brdrw15\trbrdrr\brdroutset\brdrcf3\brdrw15</xsl:text>
					<altova:Borders>
						<altova:Left altova:nWidthPt="0.75"/>
						<altova:Right altova:nWidthPt="0.75"/>
						<altova:Top altova:nWidthPt="0.75"/>
						<altova:Bottom altova:nWidthPt="0.75"/>
					</altova:Borders>
					<altova:TableWidth altova:sWidth="{'100%'}"/>
				</altova:TableStyles>
				<altova:table-row>
					<xsl:element name="altova:TableRowStyles">
						<xsl:text>\trrh0</xsl:text>
					</xsl:element>
					<altova:table-cell altova:paragraph-styles="\sl0">
						<altova:TableCellStyles altova:nColSpan="1">
							<xsl:text>\clvertalc</xsl:text>
							<altova:Borders>
								<altova:Top>
									<xsl:text>\clbrdrt</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf4</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Top>
								<altova:Bottom>
									<xsl:text>\clbrdrb</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf5</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Bottom>
								<altova:Left>
									<xsl:text>\clbrdrl</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf4</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Left>
								<altova:Right>
									<xsl:text>\clbrdrr</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf5</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Right>
							</altova:Borders>
						</altova:TableCellStyles>
						<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
							<xsl:text>\u70?\u105?\u114?\u109?\u97?</xsl:text>
						</altova:text-block>
					</altova:table-cell>
					<altova:table-cell altova:paragraph-styles="\sl0">
						<altova:TableCellStyles altova:nColSpan="1">
							<xsl:text>\clvertalc</xsl:text>
							<altova:Borders>
								<altova:Top>
									<xsl:text>\clbrdrt</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf4</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Top>
								<altova:Bottom>
									<xsl:text>\clbrdrb</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf5</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Bottom>
								<altova:Left>
									<xsl:text>\clbrdrl</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf4</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Left>
								<altova:Right>
									<xsl:text>\clbrdrr</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf5</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Right>
							</altova:Borders>
						</altova:TableCellStyles>
						<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
							<xsl:text>\u77?\u105?\u116?\u97?\u114?\u98?\u101?\u105?\u116?\u101?\u114?</xsl:text>
						</altova:text-block>
					</altova:table-cell>
					<altova:table-cell altova:paragraph-styles="\sl0">
						<altova:TableCellStyles altova:nColSpan="1">
							<xsl:text>\clvertalc</xsl:text>
							<altova:Borders>
								<altova:Top>
									<xsl:text>\clbrdrt</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf4</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Top>
								<altova:Bottom>
									<xsl:text>\clbrdrb</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf5</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Bottom>
								<altova:Left>
									<xsl:text>\clbrdrl</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf4</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Left>
								<altova:Right>
									<xsl:text>\clbrdrr</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf5</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Right>
							</altova:Borders>
						</altova:TableCellStyles>
						<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
							<xsl:text>\u80?\u101?\u114?\u115?\u111?\u110?</xsl:text>
						</altova:text-block>
					</altova:table-cell>
				</altova:table-row>
				<altova:table-row>
					<xsl:element name="altova:TableRowStyles">
						<xsl:text>\trrh0</xsl:text>
					</xsl:element>
					<altova:table-cell altova:paragraph-styles="\sl0">
						<altova:TableCellStyles altova:nColSpan="1">
							<xsl:text>\clvertalt</xsl:text>
							<altova:Borders>
								<altova:Top>
									<xsl:text>\clbrdrt</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf4</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Top>
								<altova:Bottom>
									<xsl:text>\clbrdrb</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf5</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Bottom>
								<altova:Left>
									<xsl:text>\clbrdrl</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf4</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Left>
								<altova:Right>
									<xsl:text>\clbrdrr</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf5</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Right>
							</altova:Borders>
						</altova:TableCellStyles>
						<altova:text-block>
							<xsl:text>\u71?\u76?\u78?\u58?\u32?</xsl:text>
						</altova:text-block>
						<xsl:for-each select="$XML">
							<xsl:for-each select="invoice:response">
								<xsl:for-each select="invoice:payload">
									<xsl:for-each select="invoice:body">
										<xsl:for-each select="invoice:contact">
											<xsl:for-each select="@ean_party">
												<altova:text-block>
													<altova:string-to-unicode>
														<xsl:value-of select="string(.)"/>
													</altova:string-to-unicode>
												</altova:text-block>
											</xsl:for-each>
										</xsl:for-each>
									</xsl:for-each>
								</xsl:for-each>
							</xsl:for-each>
						</xsl:for-each>
						<xsl:if test="exists(invoice:response/invoice:payload/invoice:body/invoice:contact/invoice:company)">
							<xsl:for-each select="$XML">
								<xsl:for-each select="invoice:response">
									<xsl:for-each select="invoice:payload">
										<xsl:for-each select="invoice:body">
											<xsl:for-each select="invoice:contact">
												<xsl:for-each select="invoice:company">
													<xsl:call-template name="Person_Adresse">
														<xsl:with-param name="templatetablelevel" select="$templatetablelevel + 1"/>
													</xsl:call-template>
												</xsl:for-each>
											</xsl:for-each>
										</xsl:for-each>
									</xsl:for-each>
								</xsl:for-each>
							</xsl:for-each>
						</xsl:if>
					</altova:table-cell>
					<altova:table-cell altova:paragraph-styles="\sl0">
						<altova:TableCellStyles altova:nColSpan="1">
							<xsl:text>\clvertalt</xsl:text>
							<altova:Borders>
								<altova:Top>
									<xsl:text>\clbrdrt</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf4</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Top>
								<altova:Bottom>
									<xsl:text>\clbrdrb</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf5</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Bottom>
								<altova:Left>
									<xsl:text>\clbrdrl</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf4</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Left>
								<altova:Right>
									<xsl:text>\clbrdrr</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf5</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Right>
							</altova:Borders>
						</altova:TableCellStyles>
						<xsl:if test="exists(invoice:response/invoice:payload/invoice:body/invoice:contact/invoice:employee)">
							<xsl:for-each select="$XML">
								<xsl:for-each select="invoice:response">
									<xsl:for-each select="invoice:payload">
										<xsl:for-each select="invoice:body">
											<xsl:for-each select="invoice:contact">
												<xsl:for-each select="invoice:employee">
													<xsl:call-template name="Person_Adresse">
														<xsl:with-param name="templatetablelevel" select="$templatetablelevel + 1"/>
													</xsl:call-template>
												</xsl:for-each>
											</xsl:for-each>
										</xsl:for-each>
									</xsl:for-each>
								</xsl:for-each>
							</xsl:for-each>
						</xsl:if>
					</altova:table-cell>
					<altova:table-cell altova:paragraph-styles="\sl0">
						<altova:TableCellStyles altova:nColSpan="1">
							<xsl:text>\clvertalt</xsl:text>
							<altova:Borders>
								<altova:Top>
									<xsl:text>\clbrdrt</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf4</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Top>
								<altova:Bottom>
									<xsl:text>\clbrdrb</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf5</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Bottom>
								<altova:Left>
									<xsl:text>\clbrdrl</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf4</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Left>
								<altova:Right>
									<xsl:text>\clbrdrr</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf5</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Right>
							</altova:Borders>
						</altova:TableCellStyles>
						<xsl:if test="exists(invoice:response/invoice:payload/invoice:body/invoice:contact/invoice:person)">
							<xsl:for-each select="$XML">
								<xsl:for-each select="invoice:response">
									<xsl:for-each select="invoice:payload">
										<xsl:for-each select="invoice:body">
											<xsl:for-each select="invoice:contact">
												<xsl:for-each select="invoice:person">
													<xsl:call-template name="Person_Adresse">
														<xsl:with-param name="templatetablelevel" select="$templatetablelevel + 1"/>
													</xsl:call-template>
												</xsl:for-each>
											</xsl:for-each>
										</xsl:for-each>
									</xsl:for-each>
								</xsl:for-each>
							</xsl:for-each>
						</xsl:if>
					</altova:table-cell>
				</altova:table-row>
			</altova:table>
		</altova:Document>
	</xsl:variable>
	<xsl:template name="DateToMonthName">
		<xsl:param name="sDate"/>
		<xsl:param name="sFormat"/>
		<xsl:choose>
			<xsl:when test="$sFormat = 'long'">
				<xsl:call-template name="DateToMonthNameLong">
					<xsl:with-param name="sDate" select="$sDate"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:call-template name="DateToMonthNameShort">
					<xsl:with-param name="sDate" select="$sDate"/>
				</xsl:call-template>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="DateToMonthNameLong">
		<xsl:param name="sDate"/>
		<xsl:variable name="nMonth">
			<xsl:call-template name="DateToMonthNum">
				<xsl:with-param name="sDate" select="$sDate"/>
			</xsl:call-template>
		</xsl:variable>
		<xsl:choose>
			<xsl:when test="$nMonth = 1">Januar</xsl:when>
			<xsl:when test="$nMonth = 2">Februar</xsl:when>
			<xsl:when test="$nMonth = 3">März</xsl:when>
			<xsl:when test="$nMonth = 4">April</xsl:when>
			<xsl:when test="$nMonth = 5">Mai</xsl:when>
			<xsl:when test="$nMonth = 6">Juni</xsl:when>
			<xsl:when test="$nMonth = 7">Juli</xsl:when>
			<xsl:when test="$nMonth = 8">August</xsl:when>
			<xsl:when test="$nMonth = 9">September</xsl:when>
			<xsl:when test="$nMonth = 10">Oktober</xsl:when>
			<xsl:when test="$nMonth = 11">November</xsl:when>
			<xsl:otherwise>Dezember</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="DateToMonthNum">
		<xsl:param name="sDate"/>
		<xsl:choose>
			<xsl:when test="starts-with($sDate, '--')">
				<xsl:value-of select="number(substring($sDate, 3, 2))"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="number(substring($sDate, 6, 2))"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="DateToMonthNameShort">
		<xsl:param name="sDate"/>
		<xsl:variable name="nMonth">
			<xsl:call-template name="DateToMonthNum">
				<xsl:with-param name="sDate" select="$sDate"/>
			</xsl:call-template>
		</xsl:variable>
		<xsl:choose>
			<xsl:when test="$nMonth = 1">Jan</xsl:when>
			<xsl:when test="$nMonth = 2">Feb</xsl:when>
			<xsl:when test="$nMonth = 3">Mrz</xsl:when>
			<xsl:when test="$nMonth = 4">Apr</xsl:when>
			<xsl:when test="$nMonth = 5">Mai</xsl:when>
			<xsl:when test="$nMonth = 6">Jun</xsl:when>
			<xsl:when test="$nMonth = 7">Jul</xsl:when>
			<xsl:when test="$nMonth = 8">Aug</xsl:when>
			<xsl:when test="$nMonth = 9">Sep</xsl:when>
			<xsl:when test="$nMonth = 10">Okt</xsl:when>
			<xsl:when test="$nMonth = 11">Nov</xsl:when>
			<xsl:otherwise>Dez</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:key name="altova:BookmarksByName" match="altova:bookmark" use="@name"/>
	<xsl:variable name="altova:nodesAllSeparateDocuments" as="node()" select="$altova:DocumentMonolith/altova:Document"/>
	<xsl:template name="Person_Adresse">
		<xsl:param name="templatetablelevel" select="0"/>
		<xsl:param name="Person" as="xs:string" select="&apos;&apos;"/>
		<xsl:variable name="altova:CurrContextGrid_3" select="."/>
		<xsl:variable name="altova:table">
			<altova:table altova:hide-rows="empty">
				<xsl:variable name="altova:ColumnData"/>
				<altova:TableGrid>
					<altova:GridCol altova:sWidth="0" altova:sType="auto"/>
				</altova:TableGrid>
				<altova:TableStyles altova:nBorderSpacingPt="1.50" altova:sBorderCollapse="separate" altova:nCellPaddingPt="1.50" altova:nLeftMarginPt="0.00">
					<xsl:text>\trbrdrt\brdrnil\trbrdrl\brdrnil\trbrdrb\brdrnil\trbrdrr\brdrnil</xsl:text>
					<altova:TableWidth altova:sWidth="{'100%'}"/>
				</altova:TableStyles>
				<altova:table-row>
					<xsl:element name="altova:TableRowStyles">
						<xsl:text>\trrh0</xsl:text>
					</xsl:element>
					<altova:table-cell altova:is-body-cell="true" altova:paragraph-styles="\sl0">
						<altova:TableCellStyles altova:nColSpan="1">
							<xsl:text>\clvertalc</xsl:text>
						</altova:TableCellStyles>
						<xsl:if test="exists(invoice:companyname)">
							<xsl:for-each select="invoice:companyname">
								<altova:text-block>
									<xsl:apply-templates/>
								</altova:text-block>
							</xsl:for-each>
						</xsl:if>
					</altova:table-cell>
				</altova:table-row>
				<altova:table-row>
					<xsl:element name="altova:TableRowStyles">
						<xsl:text>\trrh0</xsl:text>
					</xsl:element>
					<altova:table-cell altova:is-body-cell="true" altova:paragraph-styles="\sl0">
						<altova:TableCellStyles altova:nColSpan="1">
							<xsl:text>\clvertalc</xsl:text>
						</altova:TableCellStyles>
						<xsl:if test="exists(invoice:department)">
							<xsl:for-each select="invoice:department">
								<altova:text-block>
									<xsl:apply-templates/>
								</altova:text-block>
							</xsl:for-each>
						</xsl:if>
					</altova:table-cell>
				</altova:table-row>
				<altova:table-row>
					<xsl:element name="altova:TableRowStyles">
						<xsl:text>\trrh0</xsl:text>
					</xsl:element>
					<altova:table-cell altova:is-body-cell="true" altova:paragraph-styles="\sl0">
						<altova:TableCellStyles altova:nColSpan="1">
							<xsl:text>\clvertalc</xsl:text>
						</altova:TableCellStyles>
						<xsl:for-each select="@salutation">
							<altova:text-block>
								<altova:string-to-unicode>
									<xsl:value-of select="string(.)"/>
								</altova:string-to-unicode>
							</altova:text-block>
						</xsl:for-each>
					</altova:table-cell>
				</altova:table-row>
				<altova:table-row>
					<xsl:element name="altova:TableRowStyles">
						<xsl:text>\trrh0</xsl:text>
					</xsl:element>
					<altova:table-cell altova:is-body-cell="true" altova:paragraph-styles="\sl0">
						<altova:TableCellStyles altova:nColSpan="1">
							<xsl:text>\clvertalc</xsl:text>
						</altova:TableCellStyles>
						<xsl:for-each select="@title">
							<altova:text-block>
								<altova:string-to-unicode>
									<xsl:value-of select="string(.)"/>
								</altova:string-to-unicode>
							</altova:text-block>
						</xsl:for-each>
					</altova:table-cell>
				</altova:table-row>
				<altova:table-row>
					<xsl:element name="altova:TableRowStyles">
						<xsl:text>\trrh0</xsl:text>
					</xsl:element>
					<altova:table-cell altova:is-body-cell="true" altova:paragraph-styles="\sl0">
						<altova:TableCellStyles altova:nColSpan="1">
							<xsl:text>\clvertalc</xsl:text>
						</altova:TableCellStyles>
						<xsl:if test="exists(invoice:familyname)">
							<xsl:for-each select="invoice:familyname">
								<altova:text-block>
									<xsl:apply-templates/>
								</altova:text-block>
							</xsl:for-each>
							<altova:text-block>
								<xsl:text>\u32?</xsl:text>
							</altova:text-block>
							<xsl:for-each select="invoice:givenname">
								<altova:text-block>
									<xsl:apply-templates/>
								</altova:text-block>
							</xsl:for-each>
						</xsl:if>
					</altova:table-cell>
				</altova:table-row>
				<altova:table-row>
					<xsl:element name="altova:TableRowStyles">
						<xsl:text>\trrh0</xsl:text>
					</xsl:element>
					<altova:table-cell altova:is-body-cell="true" altova:paragraph-styles="\sl0">
						<altova:TableCellStyles altova:nColSpan="1">
							<xsl:text>\clvertalc</xsl:text>
						</altova:TableCellStyles>
						<xsl:for-each select="invoice:subaddressing">
							<altova:text-block>
								<xsl:apply-templates/>
							</altova:text-block>
						</xsl:for-each>
					</altova:table-cell>
				</altova:table-row>
				<altova:table-row>
					<xsl:element name="altova:TableRowStyles">
						<xsl:text>\trrh0</xsl:text>
					</xsl:element>
					<altova:table-cell altova:is-body-cell="true" altova:paragraph-styles="\sl0">
						<altova:TableCellStyles altova:nColSpan="1">
							<xsl:text>\clvertalc</xsl:text>
						</altova:TableCellStyles>
						<xsl:for-each select="invoice:postal">
							<xsl:for-each select="invoice:pobox">
								<altova:text-block>
									<xsl:apply-templates/>
								</altova:text-block>
							</xsl:for-each>
						</xsl:for-each>
					</altova:table-cell>
				</altova:table-row>
				<altova:table-row>
					<xsl:element name="altova:TableRowStyles">
						<xsl:text>\trrh0</xsl:text>
					</xsl:element>
					<altova:table-cell altova:is-body-cell="true" altova:paragraph-styles="\sl0">
						<altova:TableCellStyles altova:nColSpan="1">
							<xsl:text>\clvertalc</xsl:text>
						</altova:TableCellStyles>
						<xsl:for-each select="invoice:postal">
							<xsl:for-each select="invoice:street">
								<altova:text-block>
									<xsl:apply-templates/>
								</altova:text-block>
							</xsl:for-each>
						</xsl:for-each>
					</altova:table-cell>
				</altova:table-row>
				<altova:table-row>
					<xsl:element name="altova:TableRowStyles">
						<xsl:text>\trrh0</xsl:text>
					</xsl:element>
					<altova:table-cell altova:is-body-cell="true" altova:paragraph-styles="\sl0">
						<altova:TableCellStyles altova:nColSpan="1">
							<xsl:text>\clvertalc</xsl:text>
						</altova:TableCellStyles>
						<xsl:if test="exists(invoice:postal)">
							<xsl:for-each select="invoice:postal">
								<xsl:for-each select="invoice:zip">
									<altova:text-block>
										<xsl:apply-templates/>
									</altova:text-block>
								</xsl:for-each>
							</xsl:for-each>
							<altova:text-block>
								<xsl:text>\u32?</xsl:text>
							</altova:text-block>
							<xsl:for-each select="invoice:postal">
								<xsl:for-each select="invoice:city">
									<altova:text-block>
										<xsl:apply-templates/>
									</altova:text-block>
								</xsl:for-each>
							</xsl:for-each>
						</xsl:if>
					</altova:table-cell>
				</altova:table-row>
				<altova:table-row>
					<xsl:element name="altova:TableRowStyles">
						<xsl:text>\trrh0</xsl:text>
					</xsl:element>
					<altova:table-cell altova:is-body-cell="true" altova:paragraph-styles="\sl0">
						<altova:TableCellStyles altova:nColSpan="1">
							<xsl:text>\clvertalc</xsl:text>
						</altova:TableCellStyles>
						<xsl:if test="exists(invoice:telecom/invoice:phone)">
							<altova:text-block>
								<xsl:text>\u84?\u101?\u108?\u58?\u32?</xsl:text>
							</altova:text-block>
							<xsl:for-each select="invoice:telecom">
								<xsl:for-each select="invoice:phone">
									<altova:text-block>
										<xsl:apply-templates/>
									</altova:text-block>
								</xsl:for-each>
							</xsl:for-each>
						</xsl:if>
					</altova:table-cell>
				</altova:table-row>
				<altova:table-row>
					<xsl:element name="altova:TableRowStyles">
						<xsl:text>\trrh0</xsl:text>
					</xsl:element>
					<altova:table-cell altova:is-body-cell="true" altova:paragraph-styles="\sl0">
						<altova:TableCellStyles altova:nColSpan="1">
							<xsl:text>\clvertalc</xsl:text>
						</altova:TableCellStyles>
						<xsl:if test="exists(invoice:telecom/invoice:fax)">
							<altova:text-block>
								<xsl:text>\u70?\u97?\u120?\u58?\u32?</xsl:text>
							</altova:text-block>
							<xsl:for-each select="invoice:telecom">
								<xsl:for-each select="invoice:fax">
									<altova:text-block>
										<xsl:apply-templates/>
									</altova:text-block>
								</xsl:for-each>
							</xsl:for-each>
						</xsl:if>
					</altova:table-cell>
				</altova:table-row>
				<altova:table-row>
					<xsl:element name="altova:TableRowStyles">
						<xsl:text>\trrh0</xsl:text>
					</xsl:element>
					<altova:table-cell altova:is-body-cell="true" altova:paragraph-styles="\sl0">
						<altova:TableCellStyles altova:nColSpan="1">
							<xsl:text>\clvertalc</xsl:text>
						</altova:TableCellStyles>
						<xsl:if test="exists(invoice:online/invoice:email)">
							<altova:text-block>
								<xsl:text>\u69?\u45?\u77?\u97?\u105?\u108?\u58?\u32?</xsl:text>
							</altova:text-block>
							<xsl:for-each select="invoice:online">
								<xsl:for-each select="invoice:email">
									<altova:text-block>
										<xsl:apply-templates/>
									</altova:text-block>
								</xsl:for-each>
							</xsl:for-each>
						</xsl:if>
					</altova:table-cell>
				</altova:table-row>
				<altova:table-row>
					<xsl:element name="altova:TableRowStyles">
						<xsl:text>\trrh0</xsl:text>
					</xsl:element>
					<altova:table-cell altova:is-body-cell="true" altova:paragraph-styles="\sl0">
						<altova:TableCellStyles altova:nColSpan="1">
							<xsl:text>\clvertalc</xsl:text>
						</altova:TableCellStyles>
						<xsl:if test="exists(invoice:online/invoice:url)">
							<altova:text-block>
								<xsl:text>\u85?\u82?\u76?\u58?\u32?</xsl:text>
							</altova:text-block>
							<xsl:for-each select="invoice:online">
								<xsl:for-each select="invoice:url">
									<altova:text-block>
										<xsl:apply-templates/>
									</altova:text-block>
								</xsl:for-each>
							</xsl:for-each>
						</xsl:if>
					</altova:table-cell>
				</altova:table-row>
			</altova:table>
		</xsl:variable>
		<xsl:variable name="altova:col-count" select="sum(for $altova:cell in $altova:table/altova:table/altova:table-row[1]/altova:table-cell return altova:col-span($altova:cell))"/>
		<xsl:variable name="altova:generate-cols" as="xs:boolean*" select="for $altova:pos in 1 to $altova:col-count return true()"/>
		<xsl:apply-templates select="$altova:table" mode="altova:generate-table">
			<xsl:with-param name="altova:generate-cols" select="$altova:generate-cols"/>
		</xsl:apply-templates>
	</xsl:template>
	<xsl:template name="PendingState">
		<xsl:param name="templatetablelevel" select="0"/>
		<xsl:param name="Pending" as="xs:string*" select="&apos;&apos;"/>
		<altova:text-block>
			<xsl:text>\u83?\u116?\u97?\u116?\u117?\u115?\u58?\u32?</xsl:text>
		</altova:text-block>
		<xsl:for-each select="@status_out">
			<xsl:choose>
				<xsl:when test=". = &apos;canceled&apos;">
					<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
						<xsl:text>\u65?\u110?\u110?\u117?\u108?\u108?\u105?\u101?\u114?\u116?</xsl:text>
					</altova:text-block>
				</xsl:when>
				<xsl:when test=". = &apos;claimed&apos;">
					<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
						<xsl:text>\u65?\u98?\u103?\u101?\u104?\u111?\u108?\u116?</xsl:text>
					</altova:text-block>
				</xsl:when>
				<xsl:when test=". = &apos;frozen&apos;">
					<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
						<xsl:text>\u69?\u105?\u110?\u103?\u101?\u102?\u114?\u111?\u104?\u114?\u101?\u110?</xsl:text>
					</altova:text-block>
				</xsl:when>
			</xsl:choose>
		</xsl:for-each>
		<xsl:if test="exists(invoice:explanation)">
			<altova:new-line/>
			<altova:text-block>
				<xsl:text>\u71?\u114?\u117?\u110?\u100?\u58?\u32?</xsl:text>
			</altova:text-block>
			<xsl:for-each select="invoice:explanation">
				<altova:text-block altova:character-styles="\chcbpat6\b" altova:character-reset-styles="\chcbpat0\b0">
					<xsl:apply-templates/>
				</altova:text-block>
			</xsl:for-each>
		</xsl:if>
		<altova:new-line/>
		<xsl:variable name="altova:CurrContextGrid_4" select="."/>
		<altova:table>
			<xsl:variable name="altova:ColumnData"/>
			<altova:TableGrid>
				<altova:GridCol altova:sWidth="1843" altova:sType="twips"/>
				<altova:GridCol altova:sWidth="0" altova:sType="auto"/>
			</altova:TableGrid>
			<altova:TableStyles altova:nBorderSpacingPt="0.00" altova:sBorderCollapse="separate" altova:nCellPaddingPt="0.00" altova:nLeftMarginPt="0.00">
				<xsl:text>\trbrdrt\brdroutset\brdrcf3\brdrw15\trbrdrl\brdroutset\brdrcf3\brdrw15\trbrdrb\brdroutset\brdrcf3\brdrw15\trbrdrr\brdroutset\brdrcf3\brdrw15</xsl:text>
				<altova:Borders>
					<altova:Left altova:nWidthPt="0.75"/>
					<altova:Right altova:nWidthPt="0.75"/>
					<altova:Top altova:nWidthPt="0.75"/>
					<altova:Bottom altova:nWidthPt="0.75"/>
				</altova:Borders>
				<altova:TableWidth altova:sWidth="{'100%'}"/>
			</altova:TableStyles>
			<altova:table-row>
				<xsl:element name="altova:TableRowStyles">
					<xsl:text>\trrh0\trhdr</xsl:text>
				</xsl:element>
				<altova:table-cell altova:paragraph-styles="\ql\sl0">
					<altova:TableCellStyles altova:nColSpan="1">
						<xsl:text>\clvertalc</xsl:text>
						<altova:Borders>
							<altova:Top>
								<xsl:text>\clbrdrt</xsl:text>
								<xsl:text>\brdrs</xsl:text>
								<xsl:text>\brdrcf4</xsl:text>
								<xsl:element name="altova:BorderWidthPt">
									<xsl:attribute name="altova:nWidthPt" select="0.75"/>
								</xsl:element>
							</altova:Top>
							<altova:Bottom>
								<xsl:text>\clbrdrb</xsl:text>
								<xsl:text>\brdrs</xsl:text>
								<xsl:text>\brdrcf5</xsl:text>
								<xsl:element name="altova:BorderWidthPt">
									<xsl:attribute name="altova:nWidthPt" select="0.75"/>
								</xsl:element>
							</altova:Bottom>
							<altova:Left>
								<xsl:text>\clbrdrl</xsl:text>
								<xsl:text>\brdrs</xsl:text>
								<xsl:text>\brdrcf4</xsl:text>
								<xsl:element name="altova:BorderWidthPt">
									<xsl:attribute name="altova:nWidthPt" select="0.75"/>
								</xsl:element>
							</altova:Left>
							<altova:Right>
								<xsl:text>\clbrdrr</xsl:text>
								<xsl:text>\brdrs</xsl:text>
								<xsl:text>\brdrcf5</xsl:text>
								<xsl:element name="altova:BorderWidthPt">
									<xsl:attribute name="altova:nWidthPt" select="0.75"/>
								</xsl:element>
							</altova:Right>
						</altova:Borders>
					</altova:TableCellStyles>
					<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
						<xsl:text>\u67?\u111?\u100?\u101?</xsl:text>
					</altova:text-block>
				</altova:table-cell>
				<altova:table-cell altova:paragraph-styles="\ql\sl0">
					<altova:TableCellStyles altova:nColSpan="1">
						<xsl:text>\clvertalc</xsl:text>
						<altova:Borders>
							<altova:Top>
								<xsl:text>\clbrdrt</xsl:text>
								<xsl:text>\brdrs</xsl:text>
								<xsl:text>\brdrcf4</xsl:text>
								<xsl:element name="altova:BorderWidthPt">
									<xsl:attribute name="altova:nWidthPt" select="0.75"/>
								</xsl:element>
							</altova:Top>
							<altova:Bottom>
								<xsl:text>\clbrdrb</xsl:text>
								<xsl:text>\brdrs</xsl:text>
								<xsl:text>\brdrcf5</xsl:text>
								<xsl:element name="altova:BorderWidthPt">
									<xsl:attribute name="altova:nWidthPt" select="0.75"/>
								</xsl:element>
							</altova:Bottom>
							<altova:Left>
								<xsl:text>\clbrdrl</xsl:text>
								<xsl:text>\brdrs</xsl:text>
								<xsl:text>\brdrcf4</xsl:text>
								<xsl:element name="altova:BorderWidthPt">
									<xsl:attribute name="altova:nWidthPt" select="0.75"/>
								</xsl:element>
							</altova:Left>
							<altova:Right>
								<xsl:text>\clbrdrr</xsl:text>
								<xsl:text>\brdrs</xsl:text>
								<xsl:text>\brdrcf5</xsl:text>
								<xsl:element name="altova:BorderWidthPt">
									<xsl:attribute name="altova:nWidthPt" select="0.75"/>
								</xsl:element>
							</altova:Right>
						</altova:Borders>
					</altova:TableCellStyles>
					<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
						<xsl:text>\u84?\u101?\u120?\u116?</xsl:text>
					</altova:text-block>
				</altova:table-cell>
			</altova:table-row>
			<xsl:for-each select="invoice:message">
				<altova:table-row>
					<xsl:element name="altova:TableRowStyles">
						<xsl:text>\trrh0</xsl:text>
					</xsl:element>
					<altova:table-cell altova:paragraph-styles="\sl0">
						<altova:TableCellStyles altova:nColSpan="1">
							<xsl:text>\clvertalt</xsl:text>
							<xsl:element name="altova:TableCellColor">
								<xsl:attribute name="altova:sValue" select="'#ffc0a0'"/>
							</xsl:element>
							<altova:Borders>
								<altova:Top>
									<xsl:text>\clbrdrt</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf4</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Top>
								<altova:Bottom>
									<xsl:text>\clbrdrb</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf5</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Bottom>
								<altova:Left>
									<xsl:text>\clbrdrl</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf4</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Left>
								<altova:Right>
									<xsl:text>\clbrdrr</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf5</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Right>
							</altova:Borders>
						</altova:TableCellStyles>
						<xsl:for-each select="@code">
							<altova:text-block>
								<altova:string-to-unicode>
									<xsl:value-of select="string(.)"/>
								</altova:string-to-unicode>
							</altova:text-block>
						</xsl:for-each>
					</altova:table-cell>
					<altova:table-cell altova:paragraph-styles="\sl0">
						<altova:TableCellStyles altova:nColSpan="1">
							<xsl:text>\clvertalc</xsl:text>
							<xsl:element name="altova:TableCellColor">
								<xsl:attribute name="altova:sValue" select="'#ffc0a0'"/>
							</xsl:element>
							<altova:Borders>
								<altova:Top>
									<xsl:text>\clbrdrt</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf4</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Top>
								<altova:Bottom>
									<xsl:text>\clbrdrb</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf5</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Bottom>
								<altova:Left>
									<xsl:text>\clbrdrl</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf4</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Left>
								<altova:Right>
									<xsl:text>\clbrdrr</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf5</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Right>
							</altova:Borders>
						</altova:TableCellStyles>
						<xsl:for-each select="@text">
							<altova:text-block>
								<altova:string-to-unicode>
									<xsl:value-of select="string(.)"/>
								</altova:string-to-unicode>
							</altova:text-block>
						</xsl:for-each>
					</altova:table-cell>
				</altova:table-row>
			</xsl:for-each>
		</altova:table>
	</xsl:template>
	<xsl:template name="AcceptedState">
		<xsl:param name="templatetablelevel" select="0"/>
		<xsl:param name="Accepted" as="xs:string*" select="&apos;&apos;"/>
		<altova:text-block>
			<xsl:text>\u83?\u116?\u97?\u116?\u117?\u115?\u58?\u32?</xsl:text>
		</altova:text-block>
		<xsl:for-each select="@status_out">
			<xsl:choose>
				<xsl:when test=". = &apos;canceled&apos;">
					<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
						<xsl:text>\u65?\u110?\u110?\u117?\u108?\u108?\u105?\u101?\u114?\u116?</xsl:text>
					</altova:text-block>
				</xsl:when>
				<xsl:when test=". = &apos;claimed&apos;">
					<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
						<xsl:text>\u65?\u98?\u103?\u101?\u104?\u111?\u108?\u116?</xsl:text>
					</altova:text-block>
				</xsl:when>
				<xsl:when test=". = &apos;frozen&apos;">
					<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
						<xsl:text>\u69?\u105?\u110?\u103?\u101?\u102?\u114?\u111?\u104?\u114?\u101?\u110?</xsl:text>
					</altova:text-block>
				</xsl:when>
			</xsl:choose>
		</xsl:for-each>
		<xsl:if test="exists(invoice:explanation)">
			<altova:new-line/>
			<altova:text-block>
				<xsl:text>\u71?\u114?\u117?\u110?\u100?\u58?\u32?</xsl:text>
			</altova:text-block>
			<xsl:for-each select="invoice:explanation">
				<altova:text-block altova:character-styles="\chcbpat6\b" altova:character-reset-styles="\chcbpat0\b0">
					<xsl:apply-templates/>
				</altova:text-block>
			</xsl:for-each>
		</xsl:if>
		<altova:new-line/>
		<xsl:if test="exists(invoice:reimbursement)">
			<altova:paragraph altova:selector="h3" altova:character-styles="\f1\fs26\b" altova:character-reset-styles="\fs24\f0\b0" altova:paragraph-styles="\sl0\sa0\sl0\sa0" altova:is-div="false">
				<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
					<xsl:text>\u82?\u252?\u99?\u107?\u118?\u101?\u114?\u103?\u252?\u116?\u117?\u110?\u103?\u115?\u112?\u97?\u114?\u97?\u109?\u101?\u116?\u101?\u114?</xsl:text>
				</altova:text-block>
			</altova:paragraph>
			<altova:text-block>
				<xsl:text>\u220?\u98?\u101?\u114?\u119?\u101?\u105?\u115?\u101?\u110?\u101?\u114?\u32?\u66?\u101?\u116?\u114?\u97?\u103?\u58?\u32?</xsl:text>
			</altova:text-block>
			<xsl:for-each select="invoice:reimbursement">
				<xsl:for-each select="invoice:balance">
					<xsl:for-each select="@amount_due">
						<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
							<altova:string-to-unicode>
								<xsl:value-of select="string(.)"/>
							</altova:string-to-unicode>
						</altova:text-block>
					</xsl:for-each>
				</xsl:for-each>
			</xsl:for-each>
			<altova:new-line/>
			<xsl:if test="exists(invoice:reimbursement/invoice:esr9/@reference_number)">
				<altova:text-block>
					<xsl:text>\u69?\u83?\u82?\u45?\u82?\u101?\u102?\u101?\u114?\u101?\u110?\u122?\u110?\u117?\u109?\u109?\u101?\u114?\u58?\u32?</xsl:text>
				</altova:text-block>
				<xsl:for-each select="invoice:reimbursement">
					<xsl:for-each select="invoice:esr9">
						<xsl:for-each select="@reference_number">
							<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
								<altova:string-to-unicode>
									<xsl:value-of select="string(.)"/>
								</altova:string-to-unicode>
							</altova:text-block>
						</xsl:for-each>
					</xsl:for-each>
				</xsl:for-each>
			</xsl:if>
			<altova:new-line/>
			<xsl:variable name="altova:CurrContextGrid_5" select="."/>
			<altova:table>
				<xsl:variable name="altova:ColumnData"/>
				<altova:TableGrid>
					<altova:GridCol altova:sWidth="4608" altova:sType="twips"/>
					<altova:GridCol altova:sWidth="4939" altova:sType="twips"/>
					<altova:GridCol altova:sWidth="0" altova:sType="auto"/>
				</altova:TableGrid>
				<altova:TableStyles altova:nBorderSpacingPt="0.00" altova:sBorderCollapse="separate" altova:nCellPaddingPt="0.00" altova:nLeftMarginPt="0.00">
					<xsl:text>\trbrdrt\brdroutset\brdrcf3\brdrw15\trbrdrl\brdroutset\brdrcf3\brdrw15\trbrdrb\brdroutset\brdrcf3\brdrw15\trbrdrr\brdroutset\brdrcf3\brdrw15</xsl:text>
					<altova:Borders>
						<altova:Left altova:nWidthPt="0.75"/>
						<altova:Right altova:nWidthPt="0.75"/>
						<altova:Top altova:nWidthPt="0.75"/>
						<altova:Bottom altova:nWidthPt="0.75"/>
					</altova:Borders>
					<altova:TableWidth altova:sWidth="{'100%'}"/>
				</altova:TableStyles>
				<altova:table-row>
					<xsl:element name="altova:TableRowStyles">
						<xsl:text>\trrh0</xsl:text>
					</xsl:element>
					<altova:table-cell altova:paragraph-styles="\sl0">
						<altova:TableCellStyles altova:nColSpan="1">
							<xsl:text>\clvertalc</xsl:text>
							<altova:Borders>
								<altova:Top>
									<xsl:text>\clbrdrt</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf4</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Top>
								<altova:Bottom>
									<xsl:text>\clbrdrb</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf5</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Bottom>
								<altova:Left>
									<xsl:text>\clbrdrl</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf4</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Left>
								<altova:Right>
									<xsl:text>\clbrdrr</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf5</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Right>
							</altova:Borders>
						</altova:TableCellStyles>
						<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
							<xsl:text>\u68?\u101?\u98?\u105?\u116?\u111?\u114?</xsl:text>
						</altova:text-block>
					</altova:table-cell>
					<altova:table-cell altova:paragraph-styles="\sl0">
						<altova:TableCellStyles altova:nColSpan="1">
							<xsl:text>\clvertalc</xsl:text>
							<altova:Borders>
								<altova:Top>
									<xsl:text>\clbrdrt</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf4</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Top>
								<altova:Bottom>
									<xsl:text>\clbrdrb</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf5</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Bottom>
								<altova:Left>
									<xsl:text>\clbrdrl</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf4</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Left>
								<altova:Right>
									<xsl:text>\clbrdrr</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf5</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Right>
							</altova:Borders>
						</altova:TableCellStyles>
						<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
							<xsl:text>\u75?\u114?\u101?\u100?\u105?\u116?\u111?\u114?</xsl:text>
						</altova:text-block>
					</altova:table-cell>
					<altova:table-cell altova:paragraph-styles="\sl0">
						<altova:TableCellStyles altova:nColSpan="1">
							<xsl:text>\clvertalc</xsl:text>
							<altova:Borders>
								<altova:Top>
									<xsl:text>\clbrdrt</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf4</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Top>
								<altova:Bottom>
									<xsl:text>\clbrdrb</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf5</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Bottom>
								<altova:Left>
									<xsl:text>\clbrdrl</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf4</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Left>
								<altova:Right>
									<xsl:text>\clbrdrr</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf5</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Right>
							</altova:Borders>
						</altova:TableCellStyles>
						<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
							<xsl:text>\u66?\u97?\u110?\u107?</xsl:text>
						</altova:text-block>
					</altova:table-cell>
				</altova:table-row>
				<altova:table-row>
					<xsl:element name="altova:TableRowStyles">
						<xsl:text>\trrh-2218</xsl:text>
					</xsl:element>
					<altova:table-cell altova:paragraph-styles="\sl0">
						<altova:TableCellStyles altova:nColSpan="1">
							<xsl:text>\clvertalt</xsl:text>
							<altova:Borders>
								<altova:Top>
									<xsl:text>\clbrdrt</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf4</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Top>
								<altova:Bottom>
									<xsl:text>\clbrdrb</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf5</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Bottom>
								<altova:Left>
									<xsl:text>\clbrdrl</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf4</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Left>
								<altova:Right>
									<xsl:text>\clbrdrr</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf5</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Right>
							</altova:Borders>
						</altova:TableCellStyles>
						<xsl:for-each select="invoice:reimbursement">
							<xsl:for-each select="invoice:debitor">
								<xsl:for-each select="invoice:company">
									<xsl:call-template name="Person_Adresse">
										<xsl:with-param name="templatetablelevel" select="$templatetablelevel + 1"/>
									</xsl:call-template>
								</xsl:for-each>
							</xsl:for-each>
						</xsl:for-each>
						<altova:new-line/>
					</altova:table-cell>
					<altova:table-cell altova:paragraph-styles="\sl0">
						<altova:TableCellStyles altova:nColSpan="1">
							<xsl:text>\clvertalt</xsl:text>
							<altova:Borders>
								<altova:Top>
									<xsl:text>\clbrdrt</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf4</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Top>
								<altova:Bottom>
									<xsl:text>\clbrdrb</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf5</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Bottom>
								<altova:Left>
									<xsl:text>\clbrdrl</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf4</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Left>
								<altova:Right>
									<xsl:text>\clbrdrr</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf5</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Right>
							</altova:Borders>
						</altova:TableCellStyles>
						<xsl:for-each select="invoice:reimbursement">
							<xsl:for-each select="invoice:creditor">
								<xsl:for-each select="invoice:company">
									<xsl:call-template name="Person_Adresse">
										<xsl:with-param name="templatetablelevel" select="$templatetablelevel + 1"/>
									</xsl:call-template>
								</xsl:for-each>
							</xsl:for-each>
						</xsl:for-each>
						<altova:new-line/>
					</altova:table-cell>
					<altova:table-cell altova:paragraph-styles="\sl0">
						<altova:TableCellStyles altova:nColSpan="1">
							<xsl:text>\clvertalc</xsl:text>
							<altova:Borders>
								<altova:Top>
									<xsl:text>\clbrdrt</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf4</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Top>
								<altova:Bottom>
									<xsl:text>\clbrdrb</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf5</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Bottom>
								<altova:Left>
									<xsl:text>\clbrdrl</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf4</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Left>
								<altova:Right>
									<xsl:text>\clbrdrr</xsl:text>
									<xsl:text>\brdrs</xsl:text>
									<xsl:text>\brdrcf5</xsl:text>
									<xsl:element name="altova:BorderWidthPt">
										<xsl:attribute name="altova:nWidthPt" select="0.75"/>
									</xsl:element>
								</altova:Right>
							</altova:Borders>
						</altova:TableCellStyles>
						<xsl:for-each select="invoice:reimbursement">
							<xsl:for-each select="invoice:esr9">
								<xsl:for-each select="invoice:bank">
									<xsl:for-each select="invoice:company">
										<xsl:call-template name="Person_Adresse">
											<xsl:with-param name="templatetablelevel" select="$templatetablelevel + 1"/>
										</xsl:call-template>
									</xsl:for-each>
								</xsl:for-each>
							</xsl:for-each>
						</xsl:for-each>
						<altova:new-line/>
					</altova:table-cell>
				</altova:table-row>
			</altova:table>
		</xsl:if>
		<altova:new-line/>
	</xsl:template>
	<xsl:template name="RejectedState">
		<xsl:param name="templatetablelevel" select="0"/>
		<xsl:param name="Rejected" as="xs:string*" select="&apos;&apos;"/>
		<altova:text-block>
			<xsl:text>\u83?\u116?\u97?\u116?\u117?\u115?\u58?\u32?</xsl:text>
		</altova:text-block>
		<xsl:for-each select="@status_out">
			<xsl:choose>
				<xsl:when test=". = &apos;canceled&apos;">
					<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
						<xsl:text>\u65?\u110?\u110?\u117?\u108?\u108?\u105?\u101?\u114?\u116?</xsl:text>
					</altova:text-block>
				</xsl:when>
				<xsl:when test=". = &apos;claimed&apos;">
					<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
						<xsl:text>\u65?\u98?\u103?\u101?\u104?\u111?\u108?\u116?</xsl:text>
					</altova:text-block>
				</xsl:when>
				<xsl:when test=". = &apos;frozen&apos;">
					<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
						<xsl:text>\u69?\u105?\u110?\u103?\u101?\u102?\u114?\u111?\u104?\u114?\u101?\u110?</xsl:text>
					</altova:text-block>
				</xsl:when>
			</xsl:choose>
		</xsl:for-each>
		<xsl:if test="exists(invoice:explanation)">
			<altova:new-line/>
			<altova:text-block>
				<xsl:text>\u71?\u114?\u117?\u110?\u100?\u58?\u32?</xsl:text>
			</altova:text-block>
			<xsl:for-each select="invoice:explanation">
				<altova:text-block altova:character-styles="\chcbpat6\b" altova:character-reset-styles="\chcbpat0\b0">
					<xsl:apply-templates/>
				</altova:text-block>
			</xsl:for-each>
		</xsl:if>
		<xsl:if test="exists(invoice:error)">
			<xsl:variable name="altova:CurrContextGrid_6" select="."/>
			<xsl:variable name="altova:table">
				<altova:table altova:hide-cols="body-empty">
					<xsl:variable name="altova:ColumnData"/>
					<altova:TableGrid>
						<altova:GridCol altova:sWidth="1584" altova:sType="twips"/>
						<altova:GridCol altova:sWidth="8626" altova:sType="twips"/>
						<altova:GridCol altova:sWidth="1685" altova:sType="twips"/>
						<altova:GridCol altova:sWidth="1728" altova:sType="twips"/>
						<altova:GridCol altova:sWidth="0" altova:sType="auto"/>
					</altova:TableGrid>
					<altova:TableStyles altova:nBorderSpacingPt="0.00" altova:sBorderCollapse="separate" altova:nCellPaddingPt="0.00" altova:nLeftMarginPt="0.00">
						<xsl:text>\trbrdrt\brdroutset\brdrcf3\brdrw15\trbrdrl\brdroutset\brdrcf3\brdrw15\trbrdrb\brdroutset\brdrcf3\brdrw15\trbrdrr\brdroutset\brdrcf3\brdrw15</xsl:text>
						<altova:Borders>
							<altova:Left altova:nWidthPt="0.75"/>
							<altova:Right altova:nWidthPt="0.75"/>
							<altova:Top altova:nWidthPt="0.75"/>
							<altova:Bottom altova:nWidthPt="0.75"/>
						</altova:Borders>
						<altova:TableWidth altova:sWidth="{'100%'}"/>
					</altova:TableStyles>
					<altova:table-row>
						<xsl:element name="altova:TableRowStyles">
							<xsl:text>\trrh-317\trhdr</xsl:text>
						</xsl:element>
						<altova:table-cell altova:paragraph-styles="\ql\sl0">
							<altova:TableCellStyles altova:nColSpan="1">
								<xsl:text>\clvertalc</xsl:text>
								<altova:Borders>
									<altova:Top>
										<xsl:text>\clbrdrt</xsl:text>
										<xsl:text>\brdrs</xsl:text>
										<xsl:text>\brdrcf4</xsl:text>
										<xsl:element name="altova:BorderWidthPt">
											<xsl:attribute name="altova:nWidthPt" select="0.75"/>
										</xsl:element>
									</altova:Top>
									<altova:Bottom>
										<xsl:text>\clbrdrb</xsl:text>
										<xsl:text>\brdrs</xsl:text>
										<xsl:text>\brdrcf5</xsl:text>
										<xsl:element name="altova:BorderWidthPt">
											<xsl:attribute name="altova:nWidthPt" select="0.75"/>
										</xsl:element>
									</altova:Bottom>
									<altova:Left>
										<xsl:text>\clbrdrl</xsl:text>
										<xsl:text>\brdrs</xsl:text>
										<xsl:text>\brdrcf4</xsl:text>
										<xsl:element name="altova:BorderWidthPt">
											<xsl:attribute name="altova:nWidthPt" select="0.75"/>
										</xsl:element>
									</altova:Left>
									<altova:Right>
										<xsl:text>\clbrdrr</xsl:text>
										<xsl:text>\brdrs</xsl:text>
										<xsl:text>\brdrcf5</xsl:text>
										<xsl:element name="altova:BorderWidthPt">
											<xsl:attribute name="altova:nWidthPt" select="0.75"/>
										</xsl:element>
									</altova:Right>
								</altova:Borders>
							</altova:TableCellStyles>
							<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
								<xsl:text>\u67?\u111?\u100?\u101?</xsl:text>
							</altova:text-block>
						</altova:table-cell>
						<altova:table-cell altova:paragraph-styles="\ql\sl0">
							<altova:TableCellStyles altova:nColSpan="1">
								<xsl:text>\clvertalc</xsl:text>
								<altova:Borders>
									<altova:Top>
										<xsl:text>\clbrdrt</xsl:text>
										<xsl:text>\brdrs</xsl:text>
										<xsl:text>\brdrcf4</xsl:text>
										<xsl:element name="altova:BorderWidthPt">
											<xsl:attribute name="altova:nWidthPt" select="0.75"/>
										</xsl:element>
									</altova:Top>
									<altova:Bottom>
										<xsl:text>\clbrdrb</xsl:text>
										<xsl:text>\brdrs</xsl:text>
										<xsl:text>\brdrcf5</xsl:text>
										<xsl:element name="altova:BorderWidthPt">
											<xsl:attribute name="altova:nWidthPt" select="0.75"/>
										</xsl:element>
									</altova:Bottom>
									<altova:Left>
										<xsl:text>\clbrdrl</xsl:text>
										<xsl:text>\brdrs</xsl:text>
										<xsl:text>\brdrcf4</xsl:text>
										<xsl:element name="altova:BorderWidthPt">
											<xsl:attribute name="altova:nWidthPt" select="0.75"/>
										</xsl:element>
									</altova:Left>
									<altova:Right>
										<xsl:text>\clbrdrr</xsl:text>
										<xsl:text>\brdrs</xsl:text>
										<xsl:text>\brdrcf5</xsl:text>
										<xsl:element name="altova:BorderWidthPt">
											<xsl:attribute name="altova:nWidthPt" select="0.75"/>
										</xsl:element>
									</altova:Right>
								</altova:Borders>
							</altova:TableCellStyles>
							<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
								<xsl:text>\u66?\u101?\u103?\u114?\u252?\u110?\u100?\u117?\u110?\u103?</xsl:text>
							</altova:text-block>
						</altova:table-cell>
						<altova:table-cell altova:paragraph-styles="\ql\sl0">
							<altova:TableCellStyles altova:nColSpan="1">
								<xsl:text>\clvertalc</xsl:text>
								<altova:Borders>
									<altova:Top>
										<xsl:text>\clbrdrt</xsl:text>
										<xsl:text>\brdrs</xsl:text>
										<xsl:text>\brdrcf4</xsl:text>
										<xsl:element name="altova:BorderWidthPt">
											<xsl:attribute name="altova:nWidthPt" select="0.75"/>
										</xsl:element>
									</altova:Top>
									<altova:Bottom>
										<xsl:text>\clbrdrb</xsl:text>
										<xsl:text>\brdrs</xsl:text>
										<xsl:text>\brdrcf5</xsl:text>
										<xsl:element name="altova:BorderWidthPt">
											<xsl:attribute name="altova:nWidthPt" select="0.75"/>
										</xsl:element>
									</altova:Bottom>
									<altova:Left>
										<xsl:text>\clbrdrl</xsl:text>
										<xsl:text>\brdrs</xsl:text>
										<xsl:text>\brdrcf4</xsl:text>
										<xsl:element name="altova:BorderWidthPt">
											<xsl:attribute name="altova:nWidthPt" select="0.75"/>
										</xsl:element>
									</altova:Left>
									<altova:Right>
										<xsl:text>\clbrdrr</xsl:text>
										<xsl:text>\brdrs</xsl:text>
										<xsl:text>\brdrcf5</xsl:text>
										<xsl:element name="altova:BorderWidthPt">
											<xsl:attribute name="altova:nWidthPt" select="0.75"/>
										</xsl:element>
									</altova:Right>
								</altova:Borders>
							</altova:TableCellStyles>
							<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
								<xsl:text>\u70?\u97?\u108?\u115?\u99?\u104?\u101?\u114?\u32?\u87?\u101?\u114?\u116?</xsl:text>
							</altova:text-block>
						</altova:table-cell>
						<altova:table-cell altova:paragraph-styles="\ql\sl0">
							<altova:TableCellStyles altova:nColSpan="1">
								<xsl:text>\clvertalc</xsl:text>
								<altova:Borders>
									<altova:Top>
										<xsl:text>\clbrdrt</xsl:text>
										<xsl:text>\brdrs</xsl:text>
										<xsl:text>\brdrcf4</xsl:text>
										<xsl:element name="altova:BorderWidthPt">
											<xsl:attribute name="altova:nWidthPt" select="0.75"/>
										</xsl:element>
									</altova:Top>
									<altova:Bottom>
										<xsl:text>\clbrdrb</xsl:text>
										<xsl:text>\brdrs</xsl:text>
										<xsl:text>\brdrcf5</xsl:text>
										<xsl:element name="altova:BorderWidthPt">
											<xsl:attribute name="altova:nWidthPt" select="0.75"/>
										</xsl:element>
									</altova:Bottom>
									<altova:Left>
										<xsl:text>\clbrdrl</xsl:text>
										<xsl:text>\brdrs</xsl:text>
										<xsl:text>\brdrcf4</xsl:text>
										<xsl:element name="altova:BorderWidthPt">
											<xsl:attribute name="altova:nWidthPt" select="0.75"/>
										</xsl:element>
									</altova:Left>
									<altova:Right>
										<xsl:text>\clbrdrr</xsl:text>
										<xsl:text>\brdrs</xsl:text>
										<xsl:text>\brdrcf5</xsl:text>
										<xsl:element name="altova:BorderWidthPt">
											<xsl:attribute name="altova:nWidthPt" select="0.75"/>
										</xsl:element>
									</altova:Right>
								</altova:Borders>
							</altova:TableCellStyles>
							<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
								<xsl:text>\u75?\u111?\u114?\u114?\u101?\u107?\u116?\u101?\u114?\u32?\u87?\u101?\u114?\u116?</xsl:text>
							</altova:text-block>
						</altova:table-cell>
						<altova:table-cell altova:paragraph-styles="\ql\sl0">
							<altova:TableCellStyles altova:nColSpan="1">
								<xsl:text>\clvertalc</xsl:text>
								<altova:Borders>
									<altova:Top>
										<xsl:text>\clbrdrt</xsl:text>
										<xsl:text>\brdrs</xsl:text>
										<xsl:text>\brdrcf4</xsl:text>
										<xsl:element name="altova:BorderWidthPt">
											<xsl:attribute name="altova:nWidthPt" select="0.75"/>
										</xsl:element>
									</altova:Top>
									<altova:Bottom>
										<xsl:text>\clbrdrb</xsl:text>
										<xsl:text>\brdrs</xsl:text>
										<xsl:text>\brdrcf5</xsl:text>
										<xsl:element name="altova:BorderWidthPt">
											<xsl:attribute name="altova:nWidthPt" select="0.75"/>
										</xsl:element>
									</altova:Bottom>
									<altova:Left>
										<xsl:text>\clbrdrl</xsl:text>
										<xsl:text>\brdrs</xsl:text>
										<xsl:text>\brdrcf4</xsl:text>
										<xsl:element name="altova:BorderWidthPt">
											<xsl:attribute name="altova:nWidthPt" select="0.75"/>
										</xsl:element>
									</altova:Left>
									<altova:Right>
										<xsl:text>\clbrdrr</xsl:text>
										<xsl:text>\brdrs</xsl:text>
										<xsl:text>\brdrcf5</xsl:text>
										<xsl:element name="altova:BorderWidthPt">
											<xsl:attribute name="altova:nWidthPt" select="0.75"/>
										</xsl:element>
									</altova:Right>
								</altova:Borders>
							</altova:TableCellStyles>
							<altova:text-block altova:character-styles="\b" altova:character-reset-styles="\b0">
								<xsl:text>\u82?\u101?\u99?\u104?\u110?\u117?\u110?\u103?\u115?\u112?\u111?\u115?\u105?\u116?\u105?\u111?\u110?</xsl:text>
							</altova:text-block>
						</altova:table-cell>
					</altova:table-row>
					<xsl:for-each select="invoice:error">
						<altova:table-row>
							<xsl:element name="altova:TableRowStyles">
								<xsl:text>\trrh0</xsl:text>
							</xsl:element>
							<altova:table-cell altova:is-body-cell="true" altova:paragraph-styles="\ql\sl0">
								<altova:TableCellStyles altova:nColSpan="1">
									<xsl:text>\clvertalc</xsl:text>
									<xsl:element name="altova:TableCellColor">
										<xsl:attribute name="altova:sValue" select="'#ffc0a0'"/>
									</xsl:element>
									<altova:Borders>
										<altova:Top>
											<xsl:text>\clbrdrt</xsl:text>
											<xsl:text>\brdrs</xsl:text>
											<xsl:text>\brdrcf4</xsl:text>
											<xsl:element name="altova:BorderWidthPt">
												<xsl:attribute name="altova:nWidthPt" select="0.75"/>
											</xsl:element>
										</altova:Top>
										<altova:Bottom>
											<xsl:text>\clbrdrb</xsl:text>
											<xsl:text>\brdrs</xsl:text>
											<xsl:text>\brdrcf5</xsl:text>
											<xsl:element name="altova:BorderWidthPt">
												<xsl:attribute name="altova:nWidthPt" select="0.75"/>
											</xsl:element>
										</altova:Bottom>
										<altova:Left>
											<xsl:text>\clbrdrl</xsl:text>
											<xsl:text>\brdrs</xsl:text>
											<xsl:text>\brdrcf4</xsl:text>
											<xsl:element name="altova:BorderWidthPt">
												<xsl:attribute name="altova:nWidthPt" select="0.75"/>
											</xsl:element>
										</altova:Left>
										<altova:Right>
											<xsl:text>\clbrdrr</xsl:text>
											<xsl:text>\brdrs</xsl:text>
											<xsl:text>\brdrcf5</xsl:text>
											<xsl:element name="altova:BorderWidthPt">
												<xsl:attribute name="altova:nWidthPt" select="0.75"/>
											</xsl:element>
										</altova:Right>
									</altova:Borders>
								</altova:TableCellStyles>
								<xsl:for-each select="@code">
									<altova:text-block>
										<altova:string-to-unicode>
											<xsl:value-of select="string(.)"/>
										</altova:string-to-unicode>
									</altova:text-block>
								</xsl:for-each>
							</altova:table-cell>
							<altova:table-cell altova:is-body-cell="true" altova:paragraph-styles="\ql\sl0">
								<altova:TableCellStyles altova:nColSpan="1">
									<xsl:text>\clvertalc</xsl:text>
									<xsl:element name="altova:TableCellColor">
										<xsl:attribute name="altova:sValue" select="'#ffc0a0'"/>
									</xsl:element>
									<altova:Borders>
										<altova:Top>
											<xsl:text>\clbrdrt</xsl:text>
											<xsl:text>\brdrs</xsl:text>
											<xsl:text>\brdrcf4</xsl:text>
											<xsl:element name="altova:BorderWidthPt">
												<xsl:attribute name="altova:nWidthPt" select="0.75"/>
											</xsl:element>
										</altova:Top>
										<altova:Bottom>
											<xsl:text>\clbrdrb</xsl:text>
											<xsl:text>\brdrs</xsl:text>
											<xsl:text>\brdrcf5</xsl:text>
											<xsl:element name="altova:BorderWidthPt">
												<xsl:attribute name="altova:nWidthPt" select="0.75"/>
											</xsl:element>
										</altova:Bottom>
										<altova:Left>
											<xsl:text>\clbrdrl</xsl:text>
											<xsl:text>\brdrs</xsl:text>
											<xsl:text>\brdrcf4</xsl:text>
											<xsl:element name="altova:BorderWidthPt">
												<xsl:attribute name="altova:nWidthPt" select="0.75"/>
											</xsl:element>
										</altova:Left>
										<altova:Right>
											<xsl:text>\clbrdrr</xsl:text>
											<xsl:text>\brdrs</xsl:text>
											<xsl:text>\brdrcf5</xsl:text>
											<xsl:element name="altova:BorderWidthPt">
												<xsl:attribute name="altova:nWidthPt" select="0.75"/>
											</xsl:element>
										</altova:Right>
									</altova:Borders>
								</altova:TableCellStyles>
								<xsl:for-each select="@text">
									<altova:text-block>
										<altova:string-to-unicode>
											<xsl:value-of select="string(.)"/>
										</altova:string-to-unicode>
									</altova:text-block>
								</xsl:for-each>
							</altova:table-cell>
							<altova:table-cell altova:is-body-cell="true" altova:paragraph-styles="\ql\sl0">
								<altova:TableCellStyles altova:nColSpan="1">
									<xsl:text>\clvertalc</xsl:text>
									<xsl:element name="altova:TableCellColor">
										<xsl:attribute name="altova:sValue" select="'#ffc0a0'"/>
									</xsl:element>
									<altova:Borders>
										<altova:Top>
											<xsl:text>\clbrdrt</xsl:text>
											<xsl:text>\brdrs</xsl:text>
											<xsl:text>\brdrcf4</xsl:text>
											<xsl:element name="altova:BorderWidthPt">
												<xsl:attribute name="altova:nWidthPt" select="0.75"/>
											</xsl:element>
										</altova:Top>
										<altova:Bottom>
											<xsl:text>\clbrdrb</xsl:text>
											<xsl:text>\brdrs</xsl:text>
											<xsl:text>\brdrcf5</xsl:text>
											<xsl:element name="altova:BorderWidthPt">
												<xsl:attribute name="altova:nWidthPt" select="0.75"/>
											</xsl:element>
										</altova:Bottom>
										<altova:Left>
											<xsl:text>\clbrdrl</xsl:text>
											<xsl:text>\brdrs</xsl:text>
											<xsl:text>\brdrcf4</xsl:text>
											<xsl:element name="altova:BorderWidthPt">
												<xsl:attribute name="altova:nWidthPt" select="0.75"/>
											</xsl:element>
										</altova:Left>
										<altova:Right>
											<xsl:text>\clbrdrr</xsl:text>
											<xsl:text>\brdrs</xsl:text>
											<xsl:text>\brdrcf5</xsl:text>
											<xsl:element name="altova:BorderWidthPt">
												<xsl:attribute name="altova:nWidthPt" select="0.75"/>
											</xsl:element>
										</altova:Right>
									</altova:Borders>
								</altova:TableCellStyles>
								<xsl:if test="exists(invoice:error_value)">
									<xsl:for-each select="@error_value">
										<altova:text-block>
											<altova:string-to-unicode>
												<xsl:value-of select="string(.)"/>
											</altova:string-to-unicode>
										</altova:text-block>
									</xsl:for-each>
								</xsl:if>
							</altova:table-cell>
							<altova:table-cell altova:is-body-cell="true" altova:paragraph-styles="\ql\sl0">
								<altova:TableCellStyles altova:nColSpan="1">
									<xsl:text>\clvertalc</xsl:text>
									<xsl:element name="altova:TableCellColor">
										<xsl:attribute name="altova:sValue" select="'#ffc0a0'"/>
									</xsl:element>
									<altova:Borders>
										<altova:Top>
											<xsl:text>\clbrdrt</xsl:text>
											<xsl:text>\brdrs</xsl:text>
											<xsl:text>\brdrcf4</xsl:text>
											<xsl:element name="altova:BorderWidthPt">
												<xsl:attribute name="altova:nWidthPt" select="0.75"/>
											</xsl:element>
										</altova:Top>
										<altova:Bottom>
											<xsl:text>\clbrdrb</xsl:text>
											<xsl:text>\brdrs</xsl:text>
											<xsl:text>\brdrcf5</xsl:text>
											<xsl:element name="altova:BorderWidthPt">
												<xsl:attribute name="altova:nWidthPt" select="0.75"/>
											</xsl:element>
										</altova:Bottom>
										<altova:Left>
											<xsl:text>\clbrdrl</xsl:text>
											<xsl:text>\brdrs</xsl:text>
											<xsl:text>\brdrcf4</xsl:text>
											<xsl:element name="altova:BorderWidthPt">
												<xsl:attribute name="altova:nWidthPt" select="0.75"/>
											</xsl:element>
										</altova:Left>
										<altova:Right>
											<xsl:text>\clbrdrr</xsl:text>
											<xsl:text>\brdrs</xsl:text>
											<xsl:text>\brdrcf5</xsl:text>
											<xsl:element name="altova:BorderWidthPt">
												<xsl:attribute name="altova:nWidthPt" select="0.75"/>
											</xsl:element>
										</altova:Right>
									</altova:Borders>
								</altova:TableCellStyles>
								<xsl:if test="exists(invoice:valid_value)">
									<xsl:for-each select="@valid_value">
										<altova:text-block>
											<altova:string-to-unicode>
												<xsl:value-of select="string(.)"/>
											</altova:string-to-unicode>
										</altova:text-block>
									</xsl:for-each>
								</xsl:if>
							</altova:table-cell>
							<altova:table-cell altova:is-body-cell="true" altova:paragraph-styles="\ql\sl0">
								<altova:TableCellStyles altova:nColSpan="1">
									<xsl:text>\clvertalc</xsl:text>
									<xsl:element name="altova:TableCellColor">
										<xsl:attribute name="altova:sValue" select="'#ffc0a0'"/>
									</xsl:element>
									<altova:Borders>
										<altova:Top>
											<xsl:text>\clbrdrt</xsl:text>
											<xsl:text>\brdrs</xsl:text>
											<xsl:text>\brdrcf4</xsl:text>
											<xsl:element name="altova:BorderWidthPt">
												<xsl:attribute name="altova:nWidthPt" select="0.75"/>
											</xsl:element>
										</altova:Top>
										<altova:Bottom>
											<xsl:text>\clbrdrb</xsl:text>
											<xsl:text>\brdrs</xsl:text>
											<xsl:text>\brdrcf5</xsl:text>
											<xsl:element name="altova:BorderWidthPt">
												<xsl:attribute name="altova:nWidthPt" select="0.75"/>
											</xsl:element>
										</altova:Bottom>
										<altova:Left>
											<xsl:text>\clbrdrl</xsl:text>
											<xsl:text>\brdrs</xsl:text>
											<xsl:text>\brdrcf4</xsl:text>
											<xsl:element name="altova:BorderWidthPt">
												<xsl:attribute name="altova:nWidthPt" select="0.75"/>
											</xsl:element>
										</altova:Left>
										<altova:Right>
											<xsl:text>\clbrdrr</xsl:text>
											<xsl:text>\brdrs</xsl:text>
											<xsl:text>\brdrcf5</xsl:text>
											<xsl:element name="altova:BorderWidthPt">
												<xsl:attribute name="altova:nWidthPt" select="0.75"/>
											</xsl:element>
										</altova:Right>
									</altova:Borders>
								</altova:TableCellStyles>
								<xsl:if test="exists(invoice:record_id)">
									<xsl:for-each select="@record_id">
										<altova:text-block>
											<altova:string-to-unicode>
												<xsl:value-of select="string(.)"/>
											</altova:string-to-unicode>
										</altova:text-block>
									</xsl:for-each>
								</xsl:if>
							</altova:table-cell>
						</altova:table-row>
					</xsl:for-each>
				</altova:table>
			</xsl:variable>
			<xsl:variable name="altova:col-count" select="sum(for $altova:cell in $altova:table/altova:table/altova:table-row[1]/altova:table-cell return altova:col-span($altova:cell))"/>
			<xsl:variable name="altova:generate-cols" as="xs:boolean*">
				<xsl:choose>
					<xsl:when test="$altova:table/altova:table/@altova:hide-cols = 'empty'">
						<xsl:sequence select="for $altova:pos in 1 to $altova:col-count return some $altova:cell in $altova:table/altova:table/altova:table-row/altova:table-cell[altova:col-position(.) = $altova:pos] satisfies not(altova:is-cell-empty($altova:cell))"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:sequence select="for $altova:pos in 1 to $altova:col-count return some $altova:cell in $altova:table/altova:table/altova:table-row/altova:table-cell[@altova:is-body-cell = 'true' and altova:col-position(.) = $altova:pos] satisfies not(altova:is-cell-empty($altova:cell))"/>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:variable>
			<xsl:apply-templates select="$altova:table" mode="altova:generate-table">
				<xsl:with-param name="altova:generate-cols" select="$altova:generate-cols"/>
			</xsl:apply-templates>
		</xsl:if>
		<altova:new-line/>
		<altova:new-line/>
	</xsl:template>
	<xsl:template name="EmptyHeader"/>
	<xsl:template name="EmptyFooter"/>
	<xsl:function name="altova:is-cell-empty" as="xs:boolean">
		<xsl:param name="altova:cell" as="element()"/>
		<xsl:sequence select="not(exists($altova:cell/child::node() except $altova:cell/altova:TableCellStyles))"/>
	</xsl:function>
	<xsl:function name="altova:col-span" as="xs:integer">
		<xsl:param name="altova:cell" as="element()"/>
		<xsl:sequence select="1"/>
	</xsl:function>
	<xsl:template match="@* | node()" mode="altova:generate-table">
		<xsl:param name="altova:generate-cols"/>
		<xsl:copy>
			<xsl:apply-templates select="@* | node()" mode="#current">
				<xsl:with-param name="altova:generate-cols" select="$altova:generate-cols"/>
			</xsl:apply-templates>
		</xsl:copy>
	</xsl:template>
	<xsl:template match="@altova:hide-rows | @altova:hide-cols | @altova:is-body-cell" mode="altova:generate-table"/>
	<xsl:template match="altova:table-row" mode="altova:generate-table">
		<xsl:param name="altova:generate-cols"/>
		<xsl:choose>
			<xsl:when test="ancestor::altova:table[ 1 ]/@altova:hide-rows = 'empty'">
				<xsl:if test="some $altova:cell in altova:table-cell satisfies not( altova:is-cell-empty( $altova:cell ) )">
					<xsl:copy>
						<xsl:apply-templates select="@* | node()" mode="#current">
							<xsl:with-param name="altova:generate-cols" select="$altova:generate-cols"/>
						</xsl:apply-templates>
					</xsl:copy>
				</xsl:if>
			</xsl:when>
			<xsl:when test="ancestor::altova:table[ 1 ]/@altova:hide-rows = 'body-empty'">
				<xsl:if test="not( exists( altova:table-cell[ @altova:is-body-cell = 'true' ] ) ) or ( some $altova:cell in altova:table-cell[ @altova:is-body-cell = 'true' ] satisfies not( altova:is-cell-empty( $altova:cell ) ) )">
					<xsl:copy>
						<xsl:apply-templates select="@* | node()" mode="#current">
							<xsl:with-param name="altova:generate-cols" select="$altova:generate-cols"/>
						</xsl:apply-templates>
					</xsl:copy>
				</xsl:if>
			</xsl:when>
			<xsl:otherwise>
				<xsl:copy>
					<xsl:apply-templates select="@* | node()" mode="#current">
						<xsl:with-param name="altova:generate-cols" select="$altova:generate-cols"/>
					</xsl:apply-templates>
				</xsl:copy>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:function name="altova:col-position" as="xs:integer">
		<xsl:param name="altova:cell" as="element()"/>
		<xsl:sequence select="sum( for $altova:cell-before in $altova:cell/preceding-sibling::altova:table-cell return altova:col-span( $altova:cell-before ) ) + 1"/>
	</xsl:function>
	<xsl:template match="altova:GridCol" mode="altova:generate-table">
		<xsl:param name="altova:generate-cols"/>
		<xsl:variable name="altova:col-index" select="count(preceding-sibling::altova:GridCol) + 1"/>
		<xsl:if test="$altova:generate-cols[$altova:col-index]">
			<xsl:copy>
				<xsl:apply-templates select="@*" mode="#current">
					<xsl:with-param name="altova:generate-cols" select="$altova:generate-cols"/>
				</xsl:apply-templates>
				<xsl:copy-of select="node()"/>
			</xsl:copy>
		</xsl:if>
	</xsl:template>
	<xsl:template match="altova:table-cell" mode="altova:generate-table">
		<xsl:param name="altova:generate-cols"/>
		<xsl:variable name="altova:this-cell" select="."/>
		<xsl:variable name="altova:col-index" select="altova:col-position( $altova:this-cell )"/>
		<xsl:choose>
			<xsl:when test="$altova:generate-cols[ $altova:col-index ]">
				<xsl:copy>
					<xsl:apply-templates select="@*" mode="#current">
						<xsl:with-param name="altova:generate-cols" select="$altova:generate-cols"/>
					</xsl:apply-templates>
					<xsl:copy-of select="node()"/>
				</xsl:copy>
			</xsl:when>
			<xsl:when test="altova:col-span( $altova:this-cell ) &gt; 1">
				<xsl:for-each select="for $altova:pos in $altova:col-index to ( $altova:col-index + altova:col-span( $altova:this-cell ) - 1 ) return if ( $altova:generate-cols[ $altova:pos ] ) then true() else ()">
					<altova:table-cell>
						<xsl:apply-templates select="$altova:this-cell/@*" mode="altova:copy-table-cell-properties"/>
					</altova:table-cell>
				</xsl:for-each>
			</xsl:when>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="@*" mode="altova:copy-table-cell-properties">
		<xsl:copy-of select="."/>
	</xsl:template>
	<xsl:template match="@altova:is-body-cell" mode="altova:copy-table-cell-properties"/>
	<xsl:variable name="altova:non-xpath-fonts-in-use" select="('Times New Roman','Arial','Symbol','Wingdings')"/>
	<xsl:variable name="altova:non-xpath-colors-in-use" select="('BLUE','GRAY','#AAAAAA','#ACA899','#ECE9D8','#FFC0A0')"/>
	<xsl:variable name="altova:paragraph-style-selectors-in-use" select="('p','div','address','center','blockquote','fieldset','pre','pre-wrap','h1','h2','h3','h4','h5','h6')"/>
	<xsl:variable name="altova:character-style-selectors-in-use" select="()"/>
	<xsl:variable name="altova:table-style-selectors-in-use" select="()"/>
	<xsl:variable name="altova:nodeCssClasses" select="()"/>
	<xsl:template match="/">
		<xsl:for-each select="$altova:nodesAllSeparateDocuments">
			<xsl:variable name="altova:nodeDocument" as="node()" select="."/>
			<xsl:result-document href="{$altova:nodeDocument/@altova:Url}">
				<xsl:text>{\rtf1\ansi\deff0</xsl:text>
				<xsl:value-of select="altova:GenerateRtfFontTable()"/>
				<xsl:value-of select="altova:GenerateRtfColorTable()"/>
				<xsl:value-of select="altova:get-list-table($altova:nodeDocument)"/>
				<xsl:text>{\stylesheet</xsl:text>
				<xsl:text>{\s1\f0\fs24\snext0 Normal;}</xsl:text>
				<xsl:text>{\s2\f0\fs24\snext0 Paragraph;}</xsl:text>
				<xsl:text>{\s3\f0\fs24\i\snext0 Address;}</xsl:text>
				<xsl:text>{\s4\qc\f0\fs24\snext0 Center;}</xsl:text>
				<xsl:text>{\s5\lin720\f0\fs24\snext0 Blockquote;}</xsl:text>
				<xsl:text>{\s6\lin60\rin60\brdrs\brdrcf2\brdrw15\f0\fs24\snext0 Fieldset;}</xsl:text>
				<xsl:text>{\s7\f1\fs24\snext0 Preformatted;}</xsl:text>
				<xsl:text>{\s8\f1\fs24\snext0 Preformatted and wrapping;}</xsl:text>
				<xsl:text>{\s9\sl0\sa0\f1\fs48\b\snext0 Heading 1;}</xsl:text>
				<xsl:text>{\s10\sl0\sa0\f1\fs36\b\snext0 Heading 2;}</xsl:text>
				<xsl:text>{\s11\sl0\sa0\f1\fs26\b\snext0 Heading 3;}</xsl:text>
				<xsl:text>{\s12\f1\fs22\b\snext0 Heading 4;}</xsl:text>
				<xsl:text>{\s13\f1\fs18\b\snext0 Heading 5;}</xsl:text>
				<xsl:text>{\s14\f1\fs16\b\snext0 Heading 6;}</xsl:text>
				<xsl:text>}</xsl:text>
				<xsl:text>{\*\generator Altova StyleVision Enterprise Edition;}</xsl:text>
				<xsl:value-of select="concat('{\info', if (string-length(altova:DocumentProperties/@altova:Title)    gt 0) then concat('{\title ',    altova:DocumentProperties/@altova:Title,    '}') else (), if (string-length(altova:DocumentProperties/@altova:Subject)  gt 0) then concat('{\subject ',  altova:DocumentProperties/@altova:Subject,  '}') else (), if (string-length(altova:DocumentProperties/@altova:Author)   gt 0) then concat('{\author ',   altova:DocumentProperties/@altova:Author,   '}') else (), if (string-length(altova:DocumentProperties/@altova:Keywords) gt 0) then concat('{\keywords ', altova:DocumentProperties/@altova:Keywords, '}') else (), '}')"/>
				<xsl:text>\viewkind1\viewzk0\viewscale100\viewbksp1\newtblstyruls\nogrowautofit\nofeaturethrottle1 </xsl:text>
				<xsl:apply-templates select="$altova:nodeDocument" mode="altova:rtf"/>
				<xsl:text>}</xsl:text>
			</xsl:result-document>
		</xsl:for-each>
		<xsl:if test="$altova:bGeneratingFromPxf">
			<xsl:for-each select="distinct-values(for $i in $altova:DocumentMonolith//altova:image[not(@altova:ImageDataBase64)]/@altova:SrcUrl return lower-case($i))">
				<xsl:if test="unparsed-text-available(., 'x-binarytobase64')">
					<xsl:if test="not(starts-with(., 'http://') or starts-with(., 'ftp://') or starts-with(., 'file:///') or substring(., 2, 2) = ':\' or substring(., 2, 2) = ':/')">
						<xsl:result-document href="{.}" method="text" encoding="x-base64tobinary">
							<xsl:value-of select="unparsed-text(., 'x-binarytobase64')"/>
						</xsl:result-document>
					</xsl:if>
				</xsl:if>
			</xsl:for-each>
		</xsl:if>
	</xsl:template>
	<xsl:variable name="altova:seqHexDigits" select="('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F')"/>
	<xsl:variable name="altova:seqPredefinedColorNames" select="('WHITE','IVORY','LIGHTYELLOW','YELLOW','SNOW','FLORALWHITE','LEMONCHIFFON','CORNSILK','SEASHELL','LAVENDERBLUSH','PAPAYAWHIP','BLANCHEDALMOND','MISTYROSE','BISQUE','MOCCASIN','NAVAJOWHITE','PEACHPUFF','GOLD','PINK','LIGHTPINK','ORANGE','LIGHTSALMON','DARKORANGE','CORAL','HOTPINK','TOMATO','ORANGERED','DEEPPINK','FUCHSIA','MAGENTA','RED','OLDLACE','LIGHTGOLDENRODYELLOW','LINEN','ANTIQUEWHITE','SALMON','GHOSTWHITE','MINTCREAM','WHITESMOKE','BEIGE','WHEAT','SANDYBROWN','AZURE','HONEYDEW','ALICEBLUE','KHAKI','LIGHTCORAL','PALEGOLDENROD','VIOLET','DARKSALMON','LAVENDER','LIGHTCYAN','BURLYWOOD','PLUM','GAINSBORO','CRIMSON','PALEVIOLETRED','GOLDENROD','ORCHID','THISTLE','LIGHTGRAY','TAN','CHOCOLATE','PERU','INDIANRED','MEDIUMVIOLETRED','SILVER','DARKKHAKI','ROSYBROWN','MEDIUMORCHID','DARKGOLDENROD','FIREBRICK','POWDERBLUE','LIGHTSTEELBLUE','PALETURQUOISE','GREENYELLOW','LIGHTBLUE','DARKGRAY','BROWN','SIENNA','YELLOWGREEN','DARKORCHID','PALEGREEN','DARKVIOLET','MEDIUMPURPLE','LIGHTGREEN','DARKSEAGREEN','SADDLEBROWN','DARKMAGENTA','DARKRED','BLUEVIOLET','LIGHTSKYBLUE','SKYBLUE','GRAY','OLIVE','PURPLE','MAROON','AQUAMARINE','CHARTREUSE','LAWNGREEN','MEDIUMSLATEBLUE','LIGHTSLATEGRAY','SLATEGRAY','OLIVEDRAB','SLATEBLUE','DIMGRAY','MEDIUMAQUAMARINE','CORNFLOWERBLUE','CADETBLUE','DARKOLIVEGREEN','INDIGO','MEDIUMTURQUOISE','DARKSLATEBLUE','STEELBLUE','ROYALBLUE','TURQUOISE','MEDIUMSEAGREEN','LIMEGREEN','DARKSLATEGRAY','SEAGREEN','FORESTGREEN','LIGHTSEAGREEN','DODGERBLUE','MIDNIGHTBLUE','CYAN','AQUA','SPRINGGREEN','LIME','MEDIUMSPRINGGREEN','DARKTURQUOISE','DEEPSKYBLUE','DARKCYAN','TEAL','GREEN','DARKGREEN','BLUE','MEDIUMBLUE','DARKBLUE','NAVY','BLACK')"/>
	<xsl:variable name="altova:seqPredefinedColorHexValues" select="('FFFFFF','FFFFF0','FFFFE0','FFFF00','FFFAFA','FFFAF0','FFFACD','FFF8DC','FFF5EE','FFF0F5','FFEFD5','FFEBCD','FFE4E1','FFE4C4','FFE4B5','FFDEAD','FFDAB9','FFD700','FFC0CB','FFB6C1','FFA500','FFA07A','FF8C00','FF7F50','FF69B4','FF6347','FF4500','FF1493','FF00FF','FF00FF','FF0000','FDF5E6','FAFAD2','FAF0E6','FAEBD7','FA8072','F8F8FF','F5FFFA','F5F5F5','F5F5DC','F5DEB3','F4A460','F0FFFF','F0FFF0','F0F8FF','F0E68C','F08080','EEE8AA','EE82EE','E9967A','E6E6FA','E0FFFF','DEB887','DDA0DD','DCDCDC','DC143C','DB7093','DAA520','DA70D6','D8BFD8','D3D3D3','D2B48C','D2691E','CD853F','CD5C5C','C71585','C0C0C0','BDB76B','BC8F8F','BA55D3','B8860B','B22222','B0E0E6','B0C4DE','AFEEEE','ADFF2F','ADD8E6','A9A9A9','A52A2A','A0522D','9ACD32','9932CC','98FB98','9400D3','9370DB','90EE90','8FBC8B','8B4513','8B008B','8B0000','8A2BE2','87CEFA','87CEEB','808080','808000','800080','800000','7FFFD4','7FFF00','7CFC00','7B68EE','778899','708090','6B8E23','6A5ACD','696969','66CDAA','6495ED','5F9EA0','556B2F','4B0082','48D1CC','483D8B','4682B4','4169E1','40E0D0','3CB371','32CD32','2F4F4F','2E8B57','228B22','20B2AA','1E90FF','191970','00FFFF','00FFFF','00FF7F','00FF00','00FA9A','00CED1','00BFFF','008B8B','008080','008000','006400','0000FF','0000CD','00008B','000080','000000')"/>
	<xsl:variable name="altova:seqCompositeStyleFonts" select="altova:GetFontsFromCompositeStyles($altova:DocumentMonolith)"/>
	<xsl:variable name="altova:seqFontsInUse" select="distinct-values(($altova:non-xpath-fonts-in-use, $altova:DocumentMonolith//@font-family, $altova:seqCompositeStyleFonts))[. != '']"/>
	<xsl:variable name="altova:seqCompositeStyleColors" select="altova:GetColorsFromCompositeStyles($altova:DocumentMonolith)"/>
	<xsl:variable name="altova:seqColorsInUseNotNormalizedNotValidated" select="($altova:non-xpath-colors-in-use, $altova:DocumentMonolith//(@color | @background-color | @border-color | @border-top-color | @border-bottom-color | @border-left-color | @border-right-color | altova:BorderColor/@altova:sValue | altova:TableCellColor/@altova:sValue), $altova:seqCompositeStyleColors)" as="xs:string*"/>
	<xsl:variable name="altova:seqColorsInUseNormalizedNotValidated" select="distinct-values(for $Color in $altova:seqColorsInUseNotNormalizedNotValidated return upper-case($Color))"/>
	<xsl:variable name="altova:seqColorsInUseNormalizedValidated" select="$altova:seqColorsInUseNormalizedNotValidated[altova:IsColorValid(.)]"/>
	<xsl:variable name="altova:nDefaultFontSizePt" select="12"/>
	<xsl:variable name="altova:nCmPerIn" select="2.54"/>
	<xsl:variable name="altova:nEmuPerPoint" select="12700"/>
	<xsl:variable name="altova:nPercentPerEm" select="100"/>
	<xsl:variable name="altova:nPercentPerEx" select="50"/>
	<xsl:variable name="altova:nPtPerPc" select="12"/>
	<xsl:variable name="altova:nPtPerIn" select="72"/>
	<xsl:variable name="altova:nFontScalingFactor" select="1.2"/>
	<xsl:variable name="altova:nTwipsPerPt" select="20"/>
	<xsl:variable name="altova:nSpacingAroundP" select="160"/>
	<xsl:template match="node()" mode="altova:CopyOwnDocument">
		<xsl:copy>
			<xsl:copy-of select="@*"/>
			<xsl:apply-templates select="node()" mode="#current"/>
		</xsl:copy>
	</xsl:template>
	<xsl:template match="altova:Document" mode="altova:CopyOwnDocument"/>
	<xsl:template name="altova:bookmark">
		<xsl:apply-templates/>
	</xsl:template>
	<xsl:template match="altova:bookmark" mode="altova:rtf">
		<xsl:variable name="sNameNormalized" select="translate(@name, ' ', '_')"/>
		<xsl:text>{\*\bkmkstart </xsl:text>
		<altova:string-to-unicode>
			<xsl:value-of select="$sNameNormalized"/>
		</altova:string-to-unicode>
		<xsl:text>}</xsl:text>
		<xsl:apply-templates mode="altova:rtf"/>
		<xsl:text>{\*\bkmkend </xsl:text>
		<altova:string-to-unicode>
			<xsl:value-of select="$sNameNormalized"/>
		</altova:string-to-unicode>
		<xsl:text>}</xsl:text>
	</xsl:template>
	<xsl:template match="altova:BorderColor" mode="altova:rtf">
		<xsl:value-of select="altova:GenerateRtfBorderColor(@altova:sValue)"/>
	</xsl:template>
	<xsl:template match="altova:BorderStyle" mode="altova:rtf">
		<xsl:value-of select="altova:GenerateRtfBorderStyle(@altova:sValue)"/>
	</xsl:template>
	<xsl:template match="altova:BorderWidth" mode="altova:rtf">
		<xsl:value-of select="altova:GenerateRtfBorderWidth(@altova:sValue)"/>
	</xsl:template>
	<xsl:template match="altova:BorderWidthPt" mode="altova:rtf">
		<xsl:if test="xs:double(@altova:nWidthPt) ge 0">
			<xsl:text>\brdrw</xsl:text>
			<xsl:value-of select="altova:MapPointsToTwips(@altova:nWidthPt)"/>
		</xsl:if>
	</xsl:template>
	<xsl:template match="altova:column-break" mode="altova:rtf">
		<xsl:text>\column</xsl:text>
	</xsl:template>
	<xsl:template match="altova:DocumentSection" mode="altova:rtf">
		<xsl:choose>
			<!-- If we need to suppress the first section break and this is the beginning of the second section -->
			<xsl:when test="not($altova:bDoFirstSectionBreak) and preceding-sibling::altova:DocumentSection[1] and not(preceding-sibling::altova:DocumentSection[2])">
				<xsl:value-of select="substring-after(@altova:RtfSectionIntro, '\sect')"/>
				<!--<xsl:text>\sbknone</xsl:text>-->
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="@altova:RtfSectionIntro"/>
				<!-- Do a page break as defined by the document section (empty for the initial document section) -->
				<xsl:value-of select="@altova:RtfSectionPageBreak"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="altova:Footnote" mode="altova:rtf">
		<!--
		Generating the footnote's styles *before* the footnote references should ensure the reference is formatted
		according to the footnote design element. For unknown reasons, this doesn't entirely succeed.
		-->
		<!--<xsl:value-of select="@altova:CharacterStyles"/>-->
		<xsl:text>\chftn{\footnote{\up-6\chftn</xsl:text>
		<!--<xsl:text> </xsl:text>-->
		<!--
		Empirically determined that *only* the first group in the footnote's content inherits the styles that are active
		at the point the footnote is referenced. So generate this to ensure correct formatting of the footnote.
		-->
		<xsl:text>{}</xsl:text>
		<xsl:value-of select="@altova:CharacterStyles"/>
		<xsl:apply-templates mode="#current"/>
		<xsl:text>}}</xsl:text>
	</xsl:template>
	<xsl:template match="altova:image" mode="altova:rtf">
		<xsl:choose>
			<xsl:when test="altova:Watermark">
				<xsl:if test="altova:Watermark/@altova:sCondition = true()">
					<xsl:variable name="nodeDocSec" as="node()" select="preceding::altova:DocumentSection[1]"/>
					<xsl:variable name="nAvailWidthPt" as="xs:double" select="$nodeDocSec/@altova:PageWidthPt - $nodeDocSec/@altova:MarginLeftPt - $nodeDocSec/@altova:MarginRightPt"/>
					<xsl:variable name="nAvailHeightPt" as="xs:double" select="$nodeDocSec/@altova:PageHeightPt - $nodeDocSec/@altova:MarginTopPt - $nodeDocSec/@altova:MarginBottomPt"/>
					<xsl:variable name="nScaleFactorX" as="xs:double" select="$nAvailWidthPt div altova:Watermark/@altova:nWidthPt"/>
					<xsl:variable name="nScaleFactorY" as="xs:double" select="$nAvailHeightPt div altova:Watermark/@altova:nHeightPt"/>
					<xsl:variable name="nScaleFactor" as="xs:double" select="min(($nScaleFactorX, $nScaleFactorY))"/>
					<xsl:variable name="nImageWidthPt" as="xs:double" select="if (altova:Watermark/@altova:bFillPage) then altova:Watermark/@altova:nWidthPt * $nScaleFactor else altova:Watermark/@altova:nWidthPt"/>
					<xsl:variable name="nImageHeightPt" as="xs:double" select="if (altova:Watermark/@altova:bFillPage) then altova:Watermark/@altova:nHeightPt * $nScaleFactor else altova:Watermark/@altova:nHeightPt"/>
					<xsl:variable name="nLeftPt" as="xs:double" select="if (altova:Watermark/@altova:bFillPage or altova:Watermark/@altova:bCenter) then ($nAvailWidthPt - $nImageWidthPt) div 2 else altova:Watermark/@altova:nLeftPt"/>
					<xsl:variable name="nTopPt" as="xs:double" select="if (altova:Watermark/@altova:bFillPage or altova:Watermark/@altova:bCenter) then ($nAvailHeightPt - $nImageHeightPt) div 2 else altova:Watermark/@altova:nTopPt"/>
					<xsl:variable name="sFileExt" as="xs:string" select="altova:ParseFilePath_GetExtension(@altova:SrcUrl)"/>
					<xsl:variable name="sImageType" as="xs:string" select="altova:MapFileExtToImageTypeControlWord($sFileExt)"/>
					<xsl:variable name="sFilePath" as="xs:string" select="altova:NormalizeFilePathForEmbedding(@altova:SrcUrl)"/>
					<xsl:text>{\shp</xsl:text>
					<xsl:text>{\*\shpinst</xsl:text>
					<!-- Position -->
					<xsl:text>\shpleft</xsl:text>
					<xsl:value-of select="altova:MapPointsToTwips($nLeftPt)"/>
					<xsl:text>\shptop</xsl:text>
					<xsl:value-of select="altova:MapPointsToTwips($nTopPt)"/>
					<!-- Relative position -->
					<xsl:text>\shpbxmargin\shpbxignore\posrelh0</xsl:text>
					<xsl:value-of select="if (altova:Watermark/@altova:bFillPage or altova:Watermark/@altova:bCenter) then '\shpbymargin' else '\shpbypara'"/>
					<xsl:text>\shpbyignore</xsl:text>
					<xsl:text>\posrelv</xsl:text>
					<xsl:value-of select="if (altova:Watermark/@altova:bFillPage or altova:Watermark/@altova:bCenter) then '0' else '2'"/>
					<!-- Size -->
					<xsl:text>\shpright</xsl:text>
					<xsl:value-of select="altova:MapPointsToTwips($nLeftPt + $nImageWidthPt)"/>
					<xsl:text>\shpbottom</xsl:text>
					<xsl:value-of select="altova:MapPointsToTwips($nTopPt + $nImageHeightPt)"/>
					<xsl:text>\shpfhdr1\shpwr3\shpwrk0\shpfblwtxt1\shpz-10</xsl:text>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('shapeType', 1)"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fillType', 3)"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fLine', 0)"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fillOpacity', xs:integer((100 - altova:Watermark/@altova:nTransparencyPct) div 100 * 65536))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fRecolorFillAsPicture', 1)"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fFilled', 1)"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('dhgt', 100000000)"/>
					<xsl:text>{\sp{\sn fillBlip}{\sv{\pict</xsl:text>
					<xsl:value-of select="concat('\picw', altova:MapPointsToTwips(altova:Watermark/@altova:nWidthPt), '\pich', altova:MapPointsToTwips(altova:Watermark/@altova:nHeightPt))"/>
					<xsl:value-of select="concat('\picwgoal', altova:MapPointsToTwips($nImageWidthPt), '\pichgoal', altova:MapPointsToTwips($nImageHeightPt))"/>
					<xsl:value-of select="$sImageType"/>
					<xsl:text>{\*}</xsl:text>
					<xsl:value-of select="unparsed-text($sFilePath, 'x-binarytobase16')"/>
					<!-- Close \pict, \sv, and \sp -->
					<xsl:text>}}}</xsl:text>
					<!-- Close \shpinst -->
					<xsl:text>}</xsl:text>
					<xsl:text>{\shprslt}</xsl:text>
					<!-- Close \shp -->
					<xsl:text>}</xsl:text>
					<!--<xsl:text>\par</xsl:text>-->
				</xsl:if>
			</xsl:when>
			<xsl:otherwise>
				<xsl:variable name="altova:nodeLink" as="node()?" select="ancestor::altova:link[1]"/>
				<xsl:if test="$altova:nodeLink">
					<xsl:variable name="altova:sUrlResolved" as="xs:string" select="altova:ResolveUrlForLink(ancestor::altova:link[1])"/>
					<xsl:text>{\field{\*\fldinst{ HYPERLINK </xsl:text>
					<xsl:if test="starts-with($altova:sUrlResolved, '\u66?')">
						<xsl:text>\\l</xsl:text>
					</xsl:if>
					<xsl:text>"</xsl:text>
					<xsl:value-of select="$altova:sUrlResolved"/>
					<xsl:text>"}}{\fldrslt{</xsl:text>
					<xsl:if test="not($altova:nodeLink/@altova:sUnderline eq 'no')">
						<xsl:text>\ul</xsl:text>
					</xsl:if>
					<xsl:text>\cf1</xsl:text>
				</xsl:if>
				<xsl:variable name="sFileExt" as="xs:string" select="altova:ParseFilePath_GetExtension(@altova:SrcUrl)"/>
				<xsl:variable name="sImageType" as="xs:string" select="altova:MapFileExtToImageTypeControlWord($sFileExt)"/>
				<xsl:choose>
					<!-- If the user wants to embed images and the image type was recognized -->
					<xsl:when test="$altova:bEmbedImages = true() and $sImageType">
						<!-- Generate \pict so we can control the image size -->
						<xsl:text>{\*\shppict {\pict</xsl:text>
						<xsl:value-of select="$sImageType"/>
						<!--
						If a percentage value is taken to refer to the dimensions of the image, we need to generate \picscalex
						and \picscaley. If a percentage value is taken to refer to the dimensions of the page/enclosing block,
						we need to generate \picwgoal and \pichgoal.
						-->
						<xsl:if test="@altova:width">
							<xsl:value-of select="altova:MapImageWidthToControlWord(@altova:width)"/>
						</xsl:if>
						<xsl:if test="@altova:height">
							<xsl:value-of select="altova:MapImageHeightToControlWord(@altova:height)"/>
						</xsl:if>
						<xsl:text> </xsl:text>
						<xsl:choose>
							<xsl:when test="@altova:ImageDataBase64">
								<xsl:value-of select="xs:hexBinary( xs:base64Binary( @altova:ImageDataBase64 ) )"/>
							</xsl:when>
							<xsl:otherwise>
								<xsl:variable name="sFilePath" as="xs:string" select="altova:NormalizeFilePathForEmbedding(@altova:SrcUrl)"/>
								<xsl:value-of select="unparsed-text($sFilePath, 'x-binarytobase16')"/>
							</xsl:otherwise>
						</xsl:choose>
						<xsl:text>}}</xsl:text>
					</xsl:when>
					<xsl:otherwise>
						<!-- Generate INCLUDEPICTURE. This recognizes all image types, but we can't control the image size -->
						<xsl:variable name="sFilePath" as="xs:string" select="altova:NormalizeFilePath(@altova:SrcUrl)"/>
						<xsl:value-of select="concat('{\field{\*\fldinst{\ul0 INCLUDEPICTURE &quot;', $sFilePath, '&quot; \\* MERGEFORMAT \\d }}}')"/>
						<xsl:if test="@altova:ImageDataBase64">
							<xsl:result-document href="{@altova:SrcUrl}" method="text" encoding="x-base64tobinary">
								<xsl:value-of select="@altova:ImageDataBase64"/>
							</xsl:result-document>
						</xsl:if>
					</xsl:otherwise>
				</xsl:choose>
				<xsl:if test="$altova:nodeLink">
					<xsl:text>}}}</xsl:text>
				</xsl:if>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="altova:LayoutContainer" mode="altova:rtf">
		<!-- Group that holds together the rectangle for the layout container and one rectangle for each text box -->
		<!--
		Generate a line break in order to make the layout container a block level element. But not if 'fit to page' is
		active, because the break would push the layout container onto the next page.
		-->
		<xsl:if test="not(@altova:bSizeToPage)">
			<xsl:text>\line</xsl:text>
		</xsl:if>
		<xsl:text>{\shpgrp</xsl:text>
		<xsl:text>{\*\shpinst</xsl:text>
		<xsl:text>\shpleft0</xsl:text>
		<xsl:text>\shptop0</xsl:text>
		<xsl:text>\shpright</xsl:text>
		<xsl:value-of select="@nWidthTw"/>
		<xsl:text>\shpbottom</xsl:text>
		<xsl:value-of select="@nHeightTw"/>
		<xsl:text>\shpfhdr0</xsl:text>
		<xsl:text>\shpbxignore</xsl:text>
		<xsl:text>\shpbyignore</xsl:text>
		<xsl:text>\shpwr3</xsl:text>
		<xsl:text>\shpfblwtxt0</xsl:text>
		<xsl:text>\shpz0</xsl:text>
		<xsl:text>\shplockanchor</xsl:text>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('groupRight', @nWidthTw)"/>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('groupBottom', @nHeightTw)"/>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('posh', 0)"/>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('posrelh', 3)"/>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('posv', 0)"/>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('posrelv', 3)"/>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fPseudoInline', 1)"/>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fLayoutInCell', 1)"/>
		<!-- Rectangle for the layout container -->
		<xsl:text>{\shp{\*\shpinst</xsl:text>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('relRight', @nWidthTw)"/>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('relBottom', @nHeightTw)"/>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('shapeType', 1)"/>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fLine', 0)"/>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fLayoutInCell', 1)"/>
		<!-- Background color -->
		<xsl:if test="altova:RtfShapeStyles/@background-color">
			<xsl:choose>
				<xsl:when test="altova:RtfShapeStyles/@background-color eq 'transparent'">
					<xsl:value-of select="altova:GenerateRtfShapePropertyString('fFilled', '0')"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="altova:GenerateRtfShapePropertyString('fillColor', altova:RtfShapeStyles/@background-color)"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:if>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fLine', 0)"/>
		<!-- Borders -->
		<!--
		Note: Calls to MapCssToShapeDashingStyle and MapCssToShapeLineStyle need no _AbsentOk because if a dynamic style is
		present, so is altova:RtfShapeStyles/Borders/Top/@border-xxx-style.
		-->
		<xsl:if test="altova:RtfShapeStyles/Borders">
			<xsl:if test="altova:RtfShapeStyles/Borders/Top">
				<xsl:if test="altova:RtfShapeStyles/Borders/Top/@border-top-style != 'none'">
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fTopLine', 1)"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineTopColor', altova:MapColorAnyStringToShapePropertyValue_AbsentOk(altova:RtfShapeStyles/Borders/Top/@border-top-color))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineTopDashing', altova:MapCssToShapeDashingStyle(altova:RtfShapeStyles/Borders/Top/@border-top-style))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineTopStyle', altova:MapCssToShapeLineStyle(altova:RtfShapeStyles/Borders/Top/@border-top-style))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineTopWidth', altova:MapUnitPtToEmu(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Borders/Top/@border-top-width)))"/>
				</xsl:if>
			</xsl:if>
			<xsl:if test="altova:RtfShapeStyles/Borders/Left">
				<xsl:if test="altova:RtfShapeStyles/Borders/Left/@border-left-style != 'none'">
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fLeftLine', 1)"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineLeftColor', altova:MapColorAnyStringToShapePropertyValue_AbsentOk(altova:RtfShapeStyles/Borders/Left/@border-left-color))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineLeftDashing', altova:MapCssToShapeDashingStyle(altova:RtfShapeStyles/Borders/Left/@border-left-style))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineLeftStyle', altova:MapCssToShapeLineStyle(altova:RtfShapeStyles/Borders/Left/@border-left-style))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineLeftWidth', altova:MapUnitPtToEmu(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Borders/Left/@border-left-width)))"/>
				</xsl:if>
			</xsl:if>
			<xsl:if test="altova:RtfShapeStyles/Borders/Bottom">
				<xsl:if test="altova:RtfShapeStyles/Borders/Bottom/@border-bottom-style != 'none'">
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fBottomLine', 1)"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineBottomColor', altova:MapColorAnyStringToShapePropertyValue_AbsentOk(altova:RtfShapeStyles/Borders/Bottom/@border-bottom-color))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineBottomDashing', altova:MapCssToShapeDashingStyle(altova:RtfShapeStyles/Borders/Bottom/@border-bottom-style))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineBottomStyle', altova:MapCssToShapeLineStyle(altova:RtfShapeStyles/Borders/Bottom/@border-bottom-style))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineBottomWidth', altova:MapUnitPtToEmu(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Borders/Bottom/@border-bottom-width)))"/>
				</xsl:if>
			</xsl:if>
			<xsl:if test="altova:RtfShapeStyles/Borders/Right">
				<xsl:if test="altova:RtfShapeStyles/Borders/Right/@border-right-style != 'none'">
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fRightLine', 1)"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineRightColor', altova:MapColorAnyStringToShapePropertyValue_AbsentOk(altova:RtfShapeStyles/Borders/Right/@border-right-color))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineRightDashing', altova:MapCssToShapeDashingStyle(altova:RtfShapeStyles/Borders/Right/@border-right-style))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineRightStyle', altova:MapCssToShapeLineStyle(altova:RtfShapeStyles/Borders/Right/@border-right-style))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineRightWidth', altova:MapUnitPtToEmu(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Borders/Right/@border-right-width)))"/>
				</xsl:if>
			</xsl:if>
		</xsl:if>
		<xsl:text>}}</xsl:text>
		<!-- Close {\shp and {\shpinst -->
		<!-- Generate the text boxes and their contents -->
		<xsl:apply-templates mode="altova:rtf"/>
		<!-- -->
		<xsl:text>}</xsl:text>
		<!-- Close {\shpinst -->
		<xsl:text>}</xsl:text>
		<!-- Close {\shpgrp -->
		<!-- pict -->
		<xsl:text>{\pict</xsl:text>
		<xsl:text>{\*\picprop\defshp</xsl:text>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('shapeType', 75)"/>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fPseudoInline', 1)"/>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fLayoutInCell', 1)"/>
		<xsl:text>\wmetafile8</xsl:text>
		<xsl:text>\piccropl0</xsl:text>
		<xsl:text>\piccropr0</xsl:text>
		<xsl:text>\piccropt</xsl:text>
		<xsl:value-of select="-(@nHeightTw - 1)"/>
		<xsl:text>\piccropb</xsl:text>
		<xsl:value-of select="@nHeightTw - 1"/>
		<xsl:text>\picwgoal</xsl:text>
		<xsl:value-of select="@nWidthTw"/>
		<xsl:text>\pichgoal</xsl:text>
		<xsl:value-of select="@nHeightTw"/>
		<xsl:text>}</xsl:text>
		<!-- Close {\pictprop -->
		<xsl:text>}</xsl:text>
		<!-- Close {\pict -->
		<xsl:if test="not(@altova:bSizeToPage)">
			<xsl:text>\line </xsl:text>
		</xsl:if>
	</xsl:template>
	<xsl:template match="altova:line" mode="altova:rtf">
		<xsl:value-of select="altova:EnsureBlockLevelElementBegins(.)"/>
		<!-- Draw the line -->
		<xsl:variable name="nodeTableCell" as="node()?" select="ancestor::altova:table-cell[1]"/>
		<xsl:variable name="nAvailableSpaceTw" as="xs:integer" select="altova:MapPointsToTwips(altova:GetAvailableHorSpaceInParentPt(.))"/>
		<xsl:variable name="nLineWidthTw" as="xs:integer">
			<xsl:variable name="seqLineWidth" as="item()+" select="altova:ParseLengthToPointsOrPercent(@altova:sWidth)"/>
			<xsl:variable name="nLineWidthValue" as="xs:double" select="$seqLineWidth[1]"/>
			<xsl:variable name="sLineWidthType" as="xs:string" select="$seqLineWidth[2]"/>
			<xsl:choose>
				<xsl:when test="$sLineWidthType eq 'percent'">
					<xsl:value-of select="round($nAvailableSpaceTw * $nLineWidthValue div 100)"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="altova:MapPointsToTwips($nLineWidthValue)"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:text>{\shp{\*\shpinst\shpbypara\shptop120\shpbottom120</xsl:text>
		<!-- Left position -->
		<xsl:text>\shpleft</xsl:text>
		<xsl:value-of select="if (@altova:sAlign eq 'left') then 0 else if (@altova:sAlign eq 'right') then max(($nAvailableSpaceTw - $nLineWidthTw, 0)) else max((round(($nAvailableSpaceTw - $nLineWidthTw) div 2), 0))"/>
		<!-- Right position -->
		<xsl:text>\shpright</xsl:text>
		<xsl:value-of select="if (@altova:sAlign eq 'left') then max(($nAvailableSpaceTw - $nLineWidthTw, 0)) else if (@altova:sAlign eq 'right') then $nAvailableSpaceTw else max(($nLineWidthTw + round(($nAvailableSpaceTw - $nLineWidthTw) div 2), 0))"/>
		<!-- The shape is in the main document -->
		<xsl:text>\shpfhdr0</xsl:text>
		<!-- Shape wrapping -->
		<xsl:text>\shpwr3</xsl:text>
		<!-- Relative position -->
		<xsl:text>\shpbxcolumn</xsl:text>
		<!-- Type -->
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('shapeType', 20)"/>
		<!-- Line size (i.e. "breadth") -->
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineWidth', altova:MapUnitPtToEmu(altova:MapLengthUnitToPointsUnrounded(@altova:sSizePx)))"/>
		<!-- Line color -->
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineColor', @altova:sColor)"/>
		<!-- In table cell? -->
		<xsl:if test="$nodeTableCell">
			<xsl:text>{\sp{\sn fLayoutInCell}{\sv 1}}</xsl:text>
		</xsl:if>
		<xsl:text>}}</xsl:text>
		<!-- End paragraph if necessary -->
		<!-- Only if it's not the last element in a table cell -->
		<xsl:if test="xs:string(node-name(..)) ne 'altova:table-cell' or following-sibling::*[1]">
			<xsl:variable name="nDepth" as="xs:integer" select="count(ancestor::altova:table)"/>
			<xsl:text>\par\pard</xsl:text>
			<xsl:if test="$nDepth &gt; 0">
				<xsl:text>\intbl</xsl:text>
			</xsl:if>
			<xsl:value-of select="concat('\itap', $nDepth)"/>
		</xsl:if>
	</xsl:template>
	<xsl:template match="altova:link" mode="altova:rtf">
		<xsl:apply-templates mode="altova:rtf"/>
	</xsl:template>
	<xsl:template match="altova:list" mode="altova:rtf">
		<xsl:value-of select="altova:EnsureBlockLevelElementBegins(.)"/>
		<!--
		The list must not inherit paragraph styles. In particular, when a list is enclosed in a paragraph,
		the first list item must not inherit the paragraph's "space before/after" style.
		-->
		<xsl:text>{\pard</xsl:text>
		<xsl:variable name="nDepth" as="xs:integer" select="count(ancestor::altova:table)"/>
		<xsl:if test="$nDepth &gt; 0">
			<xsl:text>\intbl</xsl:text>
		</xsl:if>
		<xsl:value-of select="concat('\itap', $nDepth)"/>
		<xsl:apply-templates mode="altova:rtf"/>
		<xsl:text>}</xsl:text>
		<!--
		A list is a block level element, so in general we need \par at the end of it. Usually each list
		item generates \par anyway, so there should be no need for another one. But the list item's \par
		is inside an RTF group, and we need \par outside of the group. So the \par we generate here is
		really superfluous, hence avoid generating it where possible: Don't generate it if the list is in
		a list item, paragraph, or table cell, or if there happens to be a newline after the list.
		-->
		<xsl:variable name="nodeBlockLevelAncestor" as="node()?" select="ancestor::*[self::altova:list-item | self::altova:paragraph | self::altova:table-cell][1]"/>
		<!-- Text blocks between the list and its block level ancestor are allowed -->
		<xsl:variable name="bIsDirectlyInBlockLevelAncestor" as="xs:boolean" select="$nodeBlockLevelAncestor and altova:AreOnlyTextBlocksBetween(., $nodeBlockLevelAncestor)"/>
		<xsl:variable name="bParCreatedElsewhere" as="xs:boolean" select="$bIsDirectlyInBlockLevelAncestor or name(following-sibling::*[1]) eq 'altova:new-line' or name(following-sibling::*[1]) eq 'altova:list'"/>
		<xsl:if test="not($bParCreatedElsewhere)">
			<!--<xsl:variable name="nDepth" as="xs:integer" select="count(ancestor::altova:table)"/>-->
			<xsl:text>\pard</xsl:text>
			<xsl:if test="$nDepth &gt; 0">
				<xsl:text>\intbl</xsl:text>
			</xsl:if>
			<xsl:value-of select="concat('\itap', $nDepth)"/>
			<xsl:text>\par</xsl:text>
			<xsl:text>\pard</xsl:text>
			<xsl:if test="$nDepth &gt; 0">
				<xsl:text>\intbl</xsl:text>
			</xsl:if>
			<xsl:value-of select="concat('\itap', $nDepth)"/>
		</xsl:if>
	</xsl:template>
	<xsl:template match="altova:list-item" mode="altova:rtf">
		<!--
		After much experimenting, found out that \lsN must not be inside a group (curly braces). Otherwise, a list
		inside a table cell is missing its bullet (TTP #26773).
		-->
		<xsl:value-of select="concat('\ls', count(ancestor::altova:list) + count(../preceding::altova:list))"/>
		<!-- <xsl:value-of select="concat(if (ancestor::altova:list[last()]/descendant::altova:list-item[1] = . and ((ancestor::altova:list[last()]/preceding-sibling::*[1] and index-of(('altova:new-line','altova:table','altova:paragraph','altova:list'),ancestor::altova:list[last()]/preceding-sibling::*[1]) or not(ancestor::altova:list[last()]/preceding-sibling::*[1])))) then () else '\par','\fi-360\lin',count(ancestor::altova:list) * 720 * xs:integer(if (@altova:position) then @altova:position else if (ancestor::altova:list[1]/@altova:position) then ancestor::altova:list[1]/@altova:position else 1),'\ls',count(ancestor::altova:list) + count(../preceding::altova:list))" /> -->
		<xsl:value-of select="concat('\fi-360\lin',count(ancestor::altova:list) * 720 * xs:integer(if (@altova:position) then @altova:position else if (ancestor::altova:list[1]/@altova:position) then ancestor::altova:list[1]/@altova:position else 1))"/>
		<xsl:text>{</xsl:text>
		<xsl:for-each select="../@*">
			<xsl:variable name="attribute-name" select="name(.)"/>
			<xsl:choose>
				<xsl:when test="$attribute-name = 'altova:character-styles'">
					<xsl:value-of select="."/>
				</xsl:when>
				<xsl:when test="$attribute-name = 'color'">
					<xsl:value-of select="if (. != 'transparent') then concat('\cf',index-of($altova:seqColorsInUseNormalizedValidated,upper-case(.))) else ()"/>
				</xsl:when>
				<xsl:when test="$attribute-name = 'background-color'">
					<xsl:value-of select="if (. != 'transparent') then concat('\cbpat',index-of($altova:seqColorsInUseNormalizedValidated,upper-case(.))) else ()"/>
				</xsl:when>
			</xsl:choose>
		</xsl:for-each>
		<xsl:for-each select="@*">
			<xsl:variable name="attribute-name" select="name(.)"/>
			<xsl:choose>
				<xsl:when test="$attribute-name = 'altova:character-styles'">
					<xsl:value-of select="."/>
				</xsl:when>
				<xsl:when test="$attribute-name = 'color'">
					<xsl:value-of select="if (. != 'transparent') then concat('\cf',index-of($altova:seqColorsInUseNormalizedValidated,upper-case(.))) else ()"/>
				</xsl:when>
				<xsl:when test="$attribute-name = 'background-color'">
					<xsl:value-of select="if (. != 'transparent') then concat('\cbpat',index-of($altova:seqColorsInUseNormalizedValidated,upper-case(.))) else ()"/>
				</xsl:when>
			</xsl:choose>
		</xsl:for-each>
		<xsl:apply-templates mode="altova:rtf"/>
		<!-- Do this before the paragraph ends, not after -->
		<xsl:text>}</xsl:text>
		<!--
		As a list item is a block level element, usually generate a line break, but there are exceptions:

		Exception 1
		===========

		If the current list item LI is the last item in the list L

		1a. If L's parent P is a list item LI', which is the last item in its list, then LI and LI' must
		not both generate a newline, because that would result in two newlines after LI (or even more if
		the nesting level is higher). The rule is that only the innermost list item generates the newline.
		==> This is handled by Exception 2

		1b. If L's parent P is a paragraph, and L ist the last child in P, then LI must not generate a
		newline, because P generates one anyway, resulting again in two newlines at the end of the list.

		1c. If L's parent is a table cell, and L is the last child in P, then LI must not generate a
		newline, because it is simply superfluous inside a table cell.


		Exception 2 (TTP #38792)
		========================

		Regardless of whether the current list item LI is the last item in the list L (covers 1a)

		- If LI's last descendant is in a list L' that is a descendant of L, don't generate a line break.
		-->
		<!-- Exception 1 -->
		<!-- Don't make an exception for paragraph or table cell, otherwise the list item is no longer part of the list
		<xsl:variable name="bException1" as="xs:boolean" select="
			not(following-sibling::*) and
			not(../following-sibling::*) and
			exists(index-of(('altova:paragraph', 'altova:table-cell'), name(../..)))"/>
		-->
		<xsl:variable name="bException1" as="xs:boolean" select="false()"/>
		<!-- Exception 2 -->
		<xsl:variable name="nodeLastDescendant" as="node()?" select="descendant::*[not(self::altova:text-block and empty(*))][last()]"/>
		<xsl:variable name="nodeInnerList" as="node()?" select="$nodeLastDescendant/ancestor::altova:list[1]"/>
		<xsl:variable name="bException2" as="xs:boolean" select="$nodeInnerList and not($nodeInnerList is ..)"/>
		<!-- Generate newline if necessary -->
		<xsl:variable name="bAnyException" as="xs:boolean" select="$bException1 or $bException2"/>
		<xsl:if test="not($bAnyException)">
			<xsl:variable name="nDepth" as="xs:integer" select="count(ancestor::altova:table)"/>
			<xsl:text>\par\pard</xsl:text>
			<xsl:if test="$nDepth &gt; 0">
				<xsl:text>\intbl</xsl:text>
			</xsl:if>
			<xsl:value-of select="concat('\itap', $nDepth)"/>
		</xsl:if>
		<!-- <xsl:value-of select="@altova:character-reset-styles" /> -->
		<!-- After the above \par, we are on the same level as \lsN again, so reset to paragraph defaults -->
		<xsl:if test="not($bAnyException)">
			<xsl:variable name="nDepth" as="xs:integer" select="count(ancestor::altova:table)"/>
			<xsl:text>\pard</xsl:text>
			<xsl:if test="$nDepth &gt; 0">
				<xsl:text>\intbl</xsl:text>
			</xsl:if>
			<xsl:value-of select="concat('\itap', $nDepth)"/>
		</xsl:if>
	</xsl:template>
	<xsl:template match="altova:new-line" mode="altova:rtf">
		<!--
		<xsl:variable name="nDepth" as="xs:integer" select="count(ancestor::altova:table)"/>

		<!- - Do *not* generate \pard before \par, otherwise e.g. paragraph centering is lost from one line to the next (TTP #30057) - ->

		<xsl:text>\par\pard</xsl:text>

		<xsl:if test="$nDepth &gt; 0">
			<xsl:text>\intbl</xsl:text>
		</xsl:if>

		<xsl:value-of select="concat('\itap', $nDepth)"/>

		<xsl:value-of select="altova:get-paragraph-ancestors-styles(ancestor::altova:*)" />
		-->
		<xsl:text>\line</xsl:text>
	</xsl:template>
	<xsl:template match="altova:page-break" mode="altova:rtf">
		<xsl:text>\page</xsl:text>
	</xsl:template>
	<xsl:template match="altova:PageRef" mode="altova:rtf">
		<xsl:variable name="altova:SourceDocument" as="node()" select="ancestor::altova:Document[1]"/>
		<xsl:variable name="altova:nodeBookmark" as="node()?" select="$altova:DocumentMonolith/key('altova:BookmarksByName', current()/@bookmark-id)[1]"/>
		<xsl:variable name="altova:TargetDocument" as="node()" select="$altova:nodeBookmark/ancestor::altova:Document[1]"/>
		<xsl:if test="$altova:SourceDocument/@altova:Url eq $altova:TargetDocument/@altova:Url">
			<xsl:variable name="altova:nodeLink" as="node()?" select="ancestor::altova:link[1]"/>
			<xsl:variable name="bInLink" as="xs:boolean" select="exists(altova:nodeLink)"/>
			<xsl:text>{\field{\*\fldinst{</xsl:text>
			<xsl:if test="$bInLink">
				<xsl:if test="not($altova:nodeLink/@altova:sUnderline eq 'no')">
					<xsl:text>\ul</xsl:text>
				</xsl:if>
				<xsl:text>\cf1</xsl:text>
			</xsl:if>
			<xsl:text> PAGEREF "</xsl:text>
			<xsl:value-of select="@bookmark-id"/>
			<xsl:text>"</xsl:text>
			<xsl:if test="$bInLink">
				<xsl:text> \\h</xsl:text>
			</xsl:if>
			<xsl:text>"}}{\fldrslt}}</xsl:text>
		</xsl:if>
	</xsl:template>
	<xsl:template match="altova:paragraph" mode="altova:rtf">
		<xsl:value-of select="altova:EnsureBlockLevelElementBegins(.)"/>
		<!-- Paragraph styles -->
		<!--
		'p' (etc.) has larger margins than 'div'. Do this even if \par is not generated (e.g. for a paragraph inside a
		list item).
		-->
		<xsl:value-of select="if (@altova:is-div = 'false') then concat('\sb', $altova:nSpacingAroundP, '\sa', $altova:nSpacingAroundP) else '\sb0\sa0'"/>
		<xsl:value-of select="if (@altova:selector) then concat('\s', index-of($altova:paragraph-style-selectors-in-use, @altova:selector)) else ()"/>
		<xsl:value-of select="altova:get-paragraph-styles(.)"/>
		<xsl:if test="@text-align">
			<xsl:value-of select="altova:GenerateRtfTextAlign(@text-align)"/>
		</xsl:if>
		<xsl:if test="@altova:left-indent-tw">
			<xsl:value-of select="concat('\li', @altova:left-indent-tw + sum(ancestor::altova:paragraph/@altova:left-indent-tw))"/>
		</xsl:if>
		<!--
		Note: When the paragraph resides in a global template, it automatically inherits *character* styles from the contents
		element that triggered the global template. *Paragraph* styles from enclosing contents elements must be applied
		explicitly, though.
		-->
		<!-- Paragraph styles (from containing text block) applied via dynamic class values -->
		<xsl:if test="ancestor::altova:text-block/@altova:DynamicClassSelector">
			<xsl:variable name="nodesClass" select="$altova:nodeCssClasses/Class[@sSelector eq current()/ancestor::altova:text-block/@altova:DynamicClassSelector and ($altova:sCssSwitch eq '' or @sFile eq $altova:sCssSwitch)]" as="node()*"/>
			<xsl:if test="$nodesClass">
				<xsl:value-of select="$nodesClass/@sRtfControlWordsPara"/>
				<!-- <xsl:value-of select="$nodesClass/@sRtfControlWordsChar"/> -->
			</xsl:if>
		</xsl:if>
		<!-- Paragraph styles (from containing text block) styles applied via composite styles -->
		<xsl:if test="ancestor::altova:text-block/@altova:sCompositeStyles">
			<xsl:variable name="altova:sTextAlign" select="ancestor::altova:text-block/@altova:sCompositeStyles[contains(., 'text-align')][1]" as="xs:string?"/>
			<xsl:if test="$altova:sTextAlign">
				<xsl:value-of select="altova:GenerateRtfCompositeParagraphStyles(string($altova:sTextAlign))"/>
			</xsl:if>
		</xsl:if>
		<!-- Dynamic class styles (paragraph) from the paragraph itself -->
		<xsl:if test="@altova:DynamicClassSelector">
			<xsl:variable name="nodesClass" select="$altova:nodeCssClasses/Class[@sSelector eq current()/@altova:DynamicClassSelector and ($altova:sCssSwitch eq '' or @sFile eq $altova:sCssSwitch)]" as="node()*"/>
			<xsl:if test="$nodesClass">
				<xsl:value-of select="$nodesClass/@sRtfControlWordsPara"/>
			</xsl:if>
		</xsl:if>
		<!-- Composite styles (paragraph) from the paragraph itself -->
		<xsl:if test="@altova:sCompositeStyles">
			<xsl:variable name="altova:sTextAlign" select="@altova:sCompositeStyles[contains(., 'text-align')]" as="xs:string?"/>
			<xsl:if test="$altova:sTextAlign">
				<xsl:value-of select="altova:GenerateRtfCompositeParagraphStyles(string($altova:sTextAlign))"/>
			</xsl:if>
		</xsl:if>
		<!-- Character styles -->
		<!--
		Character properties (e.g. from composite styles) must not be inherited by the following paragraphs, so enclose them in a group.
		Do this after the paragraph style selector (\sN), and after any paragraph styles.
		-->
		<xsl:text>{</xsl:text>
		<!-- Dynamic class styles (character) from the paragraph itself -->
		<xsl:if test="@altova:DynamicClassSelector">
			<xsl:variable name="nodesClass" select="$altova:nodeCssClasses/Class[@sSelector eq current()/@altova:DynamicClassSelector and ($altova:sCssSwitch eq '' or @sFile eq $altova:sCssSwitch)]" as="node()*"/>
			<xsl:if test="$nodesClass">
				<xsl:value-of select="$nodesClass/@sRtfControlWordsChar"/>
			</xsl:if>
		</xsl:if>
		<!-- Composite styles (character) from the paragraph itself -->
		<xsl:if test="@altova:sCompositeStyles">
			<xsl:value-of select="altova:GenerateRtfCompositeCharacterStyles(string(@altova:sCompositeStyles))"/>
		</xsl:if>
		<!-- Paragraph contents -->
		<xsl:apply-templates mode="altova:rtf"/>
		<!--
		Must be before \par, otherwise e.g. \qc is inherited be the following paragraphs, and before
		@altova:character-reset-styles, otherwise they are not reset for the following paragraphs.
		-->
		<xsl:text>}</xsl:text>
		<!-- TTP #39178 -->
		<xsl:value-of select="concat(@altova:character-reset-styles, altova:get-paragraph-ancestors-styles(ancestor::altova:*))"/>
		<!--
		Ususally generate \par at the end of a paragraph, but there are exceptions. E.g. when the paragraph is the last
		child of an enclosing paragraph, list item, or table cell.
		-->
		<xsl:if test="not(index-of(('altova:paragraph', 'altova:list-item', 'altova:table-cell'), name(..))) or following-sibling::*[1]">
			<xsl:variable name="nDepth" as="xs:integer" select="count(ancestor::altova:table)"/>
			<xsl:text>\par\pard</xsl:text>
			<xsl:if test="$nDepth &gt; 0">
				<xsl:text>\intbl</xsl:text>
			</xsl:if>
			<xsl:value-of select="concat('\itap', $nDepth)"/>
			<xsl:if test="@altova:left-indent-tw">
				<xsl:value-of select="concat('\li', sum(ancestor::altova:paragraph/@altova:left-indent-tw))"/>
			</xsl:if>
		</xsl:if>
		<!-- Paragraph styles must be outside of the group -->
		<xsl:value-of select="altova:get-paragraph-ancestors-styles(ancestor::altova:*)"/>
	</xsl:template>
	<xsl:template match="altova:table" mode="altova:rtf">
		<!--
		If the preceding sibling is a page break, Word needs a \par in order to honour the page break. So if a page
		break is present, generate \par, and call EnsureBlockLevelElementBegins() otherwise.
		-->
		<xsl:variable name="nodePrevious" as="node()?" select="altova:FindVisibleElementOfPrecedingEndTag(.)"/>
		<xsl:choose>
			<xsl:when test="xs:string(node-name($nodePrevious)) = 'altova:page-break'">
				<xsl:variable name="nDepth" as="xs:integer" select="count(ancestor::altova:table)"/>
				<xsl:text>\par\pard</xsl:text>
				<xsl:if test="$nDepth &gt; 0">
					<xsl:text>\intbl</xsl:text>
				</xsl:if>
				<xsl:value-of select="concat('\itap', $nDepth)"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="altova:EnsureBlockLevelElementBegins(.)"/>
			</xsl:otherwise>
		</xsl:choose>
		<xsl:variable name="table-level" select="count(ancestor-or-self::altova:table)"/>
		<xsl:value-of select="@margin-top"/>
		<xsl:apply-templates mode="altova:rtf"/>
		<xsl:value-of select="@margin-bottom"/>
		<xsl:if test="$table-level - 1 gt 0">
			<xsl:text>\intbl</xsl:text>
		</xsl:if>
		<xsl:value-of select="concat('\itap', $table-level - 1)"/>
		<!-- Prevent successive tables from merging -->
		<xsl:if test="string(node-name(following-sibling::*[1])) eq 'altova:table'">
			<xsl:text>{\fs2\par}</xsl:text>
		</xsl:if>
	</xsl:template>
	<xsl:template match="altova:TableCellColor" mode="altova:rtf">
		<xsl:value-of select="altova:GenerateRtfTableCellColor(@altova:sValue)"/>
	</xsl:template>
	<xsl:template match="altova:TableCellStyles" mode="altova:rtf"/>
	<xsl:template match="altova:TableRowStyles" mode="altova:rtf"/>
	<xsl:template match="altova:TableStyles" mode="altova:rtf"/>
	<xsl:template match="altova:TableCellVerticalAlign" mode="altova:rtf">
		<xsl:value-of select="altova:GenerateRtfTableCellVerticalAlign(@altova:sValue)"/>
	</xsl:template>
	<xsl:template match="altova:table-row" mode="altova:rtf">
		<xsl:variable name="bNested" as="xs:boolean" select="exists(ancestor::altova:table[2])"/>
		<xsl:variable name="seqRtf" as="xs:string*" select="altova:ApplyTableAndRowAndCellStyles(.)"/>
		<!-- If we're not in a nested table -->
		<xsl:if test="not($bNested)">
			<!-- Generate the row/cell styles before the cell content -->
			<xsl:value-of select="$seqRtf" separator=""/>
		</xsl:if>
		<xsl:value-of select="if (../@altova:selector) then concat('\ts',count($altova:paragraph-style-selectors-in-use) + count($altova:character-style-selectors-in-use) + index-of($altova:table-style-selectors-in-use,../@altova:selector)) else ()"/>
		<!-- Generate the cell content -->
		<xsl:apply-templates mode="altova:rtf"/>
		<xsl:value-of select="if (../@altova:selector) then concat('\ts',count($altova:paragraph-style-selectors-in-use) + count($altova:character-style-selectors-in-use) + index-of($altova:table-style-selectors-in-use,../@altova:selector)) else ()"/>
		<!-- If we're in a nested table -->
		<xsl:if test="$bNested">
			<xsl:text>{\*\nesttableprops</xsl:text>
		</xsl:if>
		<!-- Generate the row/cell styles after the cell content, regardless of whether the row is nested -->
		<xsl:value-of select="$seqRtf" separator=""/>
		<!-- Must generate \pard in order to reset \intbl -->
		<xsl:value-of select="if ($bNested) then'\nestrow}{\nonesttables\par}' else '\row\pard'"/>
	</xsl:template>
	<xsl:template match="altova:table-cell" mode="altova:rtf">
		<xsl:variable name="nDepth" as="xs:integer" select="count(ancestor::altova:table)"/>
		<xsl:text>\pard</xsl:text>
		<xsl:if test="$nDepth &gt; 0">
			<xsl:text>\intbl</xsl:text>
		</xsl:if>
		<xsl:value-of select="concat('\itap', $nDepth)"/>
		<!-- Paragraph styles (must not reside in the group) -->
		<xsl:value-of select="@altova:paragraph-styles"/>
		<!-- Line height -->
		<xsl:if test="@line-height">
			<xsl:sequence select="altova:GenerateRtfLineHeight(@line-height)"/>
		</xsl:if>
		<!-- Character styles -->
		<xsl:variable name="altova:bCharacterStylesPresent" select="@altova:character-styles or @color or @font-family or @altova:sCompositeStyles or @altova:DynamicClassSelector"/>
		<xsl:if test="$altova:bCharacterStylesPresent">
			<xsl:text>{</xsl:text>
			<xsl:if test="@altova:DynamicClassSelector">
				<xsl:variable name="nodesClass" select="$altova:nodeCssClasses/Class[@sSelector eq current()/@altova:DynamicClassSelector and ($altova:sCssSwitch eq '' or @sFile eq $altova:sCssSwitch)]" as="node()*"/>
				<xsl:if test="$nodesClass">
					<!-- <xsl:value-of select="concat('\cs', $nodesClass/@sRtfStyleNumber, $nodesClass/@sRtfControlWordsChar)"/> -->
					<xsl:value-of select="$nodesClass/@sRtfControlWordsChar"/>
				</xsl:if>
			</xsl:if>
			<xsl:value-of select="@altova:character-styles"/>
			<xsl:value-of select="altova:GenerateRtfForegroundColorForAnyColorString(string(@color))"/>
			<xsl:value-of select="altova:GenerateRtfFontFamily(string(@font-family))"/>
			<xsl:value-of select="altova:GenerateRtfCompositeCharacterStyles(string(@altova:sCompositeStyles))"/>
		</xsl:if>
		<xsl:apply-templates mode="altova:rtf"/>
		<!--<xsl:value-of select="@altova:character-reset-styles" />-->
		<xsl:if test="$altova:bCharacterStylesPresent">
			<xsl:text>}</xsl:text>
		</xsl:if>
		<xsl:value-of select="if (count(ancestor::altova:table) &gt; 1) then'\nestcell' else '\cell'"/>
	</xsl:template>
	<xsl:template match="altova:text-block" mode="altova:rtf">
		<xsl:choose>
			<xsl:when test="altova:Watermark">
				<xsl:if test="altova:Watermark/@altova:sCondition = true()">
					<xsl:variable name="nodeDocSec" as="node()" select="preceding::altova:DocumentSection[1]"/>
					<xsl:variable name="nAvailWidthPt" as="xs:double" select="$nodeDocSec/@altova:PageWidthPt - $nodeDocSec/@altova:MarginLeftPt - $nodeDocSec/@altova:MarginRightPt"/>
					<xsl:variable name="nAvailHeightPt" as="xs:double" select="$nodeDocSec/@altova:PageHeightPt - $nodeDocSec/@altova:MarginTopPt - $nodeDocSec/@altova:MarginBottomPt"/>
					<xsl:variable name="nDeltaH" as="xs:double" select="altova:Watermark/@altova:nFontSizePt div 2 * altova:Sqrt(($nAvailHeightPt * $nAvailHeightPt) div ($nAvailWidthPt * $nAvailWidthPt) + 1)"/>
					<xsl:variable name="nDeltaW" as="xs:double" select="altova:Watermark/@altova:nFontSizePt div 2 * altova:Sqrt(($nAvailWidthPt * $nAvailWidthPt) div ($nAvailHeightPt * $nAvailHeightPt) + 1)"/>
					<xsl:variable name="nDelta" as="xs:double" select="max(($nDeltaW, $nDeltaH))"/>
					<xsl:variable name="nShapeHeightPt" as="xs:double" select="if (altova:Watermark/@altova:sOrientation eq 'hor') then altova:Watermark/@altova:nFontSizePt else $nAvailHeightPt"/>
					<xsl:variable name="seqPoints" as="xs:double+" select="if (altova:Watermark/@altova:sOrientation eq 'diag-up') then (0, $nAvailHeightPt - $nDelta, $nAvailWidthPt - $nDelta, 0, $nDelta, $nAvailHeightPt, $nAvailWidthPt, $nDelta) else if (altova:Watermark/@altova:sOrientation eq 'diag-down') then ($nDelta, 0, $nAvailWidthPt, $nAvailHeightPt - $nDelta,  0, $nDelta, $nAvailWidthPt - $nDelta, $nAvailHeightPt) else (0, 0, $nAvailWidthPt, 0, 0, $nAvailHeightPt, $nAvailWidthPt, $nAvailHeightPt)"/>
					<xsl:text>{\shp</xsl:text>
					<xsl:text>{\*\shpinst</xsl:text>
					<!-- Position -->
					<xsl:text>\shpleft0</xsl:text>
					<xsl:text>\shptop</xsl:text>
					<xsl:value-of select="altova:MapPointsToTwips(if (altova:Watermark/@altova:sOrientation eq 'hor') then ($nAvailHeightPt - $nShapeHeightPt) div 2 else 0)"/>
					<!-- Size -->
					<xsl:text>\shpright</xsl:text>
					<xsl:value-of select="altova:MapPointsToTwips($nAvailWidthPt)"/>
					<xsl:text>\shpbottom</xsl:text>
					<xsl:value-of select="altova:MapPointsToTwips(if (altova:Watermark/@altova:sOrientation eq 'hor') then ($nAvailHeightPt + $nShapeHeightPt) div 2 else $nAvailHeightPt)"/>
					<xsl:text>\shpfhdr1\shpbxmargin\shpbxignore\shpbymargin\shpbyignore\shpwr3\shpwrk0\shpfblwtxt0\shpz-10</xsl:text>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('shapeType', 100)"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyString('gtextUNICODE', text())"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyString('gtextFont', altova:Watermark/@altova:sFontFamily)"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fGtext', 1)"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('gtextFStretch', 1)"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('geoRight', xs:integer($nAvailWidthPt))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('geoBottom', xs:integer($nAvailHeightPt))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyString('pVerticies', concat('8;4;(', round($seqPoints[1]), ',', round($seqPoints[2]), ');(', round($seqPoints[3]), ',', round($seqPoints[4]), ');(', round($seqPoints[5]), ',', round($seqPoints[6]), ');(', round($seqPoints[7]), ',', round($seqPoints[8]), ')'))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyString('pSegmentInfo', '2;5;16384;1;16384;1;32768')"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fGtextOK', 1)"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fillColor', altova:MapColorAnyStringToShapePropertyValue(altova:Watermark/@altova:sColor))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fillOpacity', xs:integer((100 - altova:Watermark/@altova:nTransparencyPct) div 100 * 65536))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fLine', 0)"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('posv', 0)"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('posrelv', 0)"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('dhgt', 100000000)"/>
					<!-- Close \shpinst -->
					<xsl:text>}</xsl:text>
					<xsl:text>{\shprslt}</xsl:text>
					<!-- Close \shp -->
					<xsl:text>}</xsl:text>
					<!--<xsl:text>\par</xsl:text>-->
				</xsl:if>
			</xsl:when>
			<xsl:otherwise>
				<!-- E.g. must not create a hyperlink when there is no text -->
				<xsl:text>{</xsl:text>
				<xsl:variable name="altova:nodeLink" as="node()?" select="ancestor::altova:link[1]"/>
				<xsl:if test="$altova:nodeLink">
					<xsl:if test="string-length(.) gt 0 or altova:PageRef">
						<xsl:variable name="altova:sUrlResolved" as="xs:string" select="altova:ResolveUrlForLink(ancestor::altova:link[1])"/>
						<xsl:text>{\field{\*\fldinst{ HYPERLINK </xsl:text>
						<xsl:if test="starts-with($altova:sUrlResolved, '\u66?')">
							<xsl:text>\\l</xsl:text>
						</xsl:if>
						<xsl:text>"</xsl:text>
						<xsl:value-of select="$altova:sUrlResolved"/>
						<xsl:text>"}}{\fldrslt{</xsl:text>
						<xsl:if test="not($altova:nodeLink/@altova:sUnderline eq 'no')">
							<xsl:text>\ul</xsl:text>
						</xsl:if>
						<xsl:text>\cf1</xsl:text>
					</xsl:if>
				</xsl:if>
				<xsl:if test="@altova:DynamicClassSelector">
					<xsl:variable name="nodesClass" select="$altova:nodeCssClasses/Class[@sSelector eq current()/@altova:DynamicClassSelector and ($altova:sCssSwitch eq '' or @sFile eq $altova:sCssSwitch)]" as="node()*"/>
					<xsl:if test="$nodesClass">
						<!-- <xsl:value-of select="concat('\cs', $nodesClass/@sRtfStyleNumber, $nodesClass/@sRtfControlWordsChar)"/> -->
						<xsl:value-of select="$nodesClass/@sRtfControlWordsChar"/>
					</xsl:if>
				</xsl:if>
				<xsl:value-of select="if (@altova:selector) then concat('\cs', count($altova:paragraph-style-selectors-in-use) + index-of($altova:character-style-selectors-in-use, @altova:selector)) else ()"/>
				<xsl:value-of select="string(@altova:character-styles)"/>
				<xsl:value-of select="altova:GenerateRtfBackgroundColorForAnyColorString(string(@background-color))"/>
				<xsl:value-of select="altova:GenerateRtfCharacterBorderStyle(string(@border-style))"/>
				<xsl:value-of select="altova:GenerateRtfBorderColor(string(@border-color))"/>
				<xsl:value-of select="altova:GenerateRtfBorderWidth(string(@border-width))"/>
				<xsl:value-of select="altova:GenerateRtfForegroundColorForAnyColorString(string(@color))"/>
				<xsl:value-of select="altova:GenerateRtfFontFamily(string(@font-family))"/>
				<xsl:value-of select="altova:GenerateRtfFontSize(string(@font-size))"/>
				<xsl:value-of select="altova:GenerateRtfFontStyle(string(@font-style))"/>
				<xsl:value-of select="altova:GenerateRtfFontVariant(string(@font-variant))"/>
				<xsl:value-of select="altova:GenerateRtfFontWeight(string(@font-weight))"/>
				<xsl:value-of select="altova:GenerateRtfTextDecoration(string(@text-decoration))"/>
				<xsl:value-of select="altova:GenerateRtfCompositeCharacterStyles(string(@altova:sCompositeStyles))"/>
				<xsl:apply-templates mode="altova:rtf"/>
				<xsl:if test="$altova:nodeLink">
					<xsl:if test="string-length(.) gt 0 or altova:PageRef">
						<xsl:text>}}}</xsl:text>
					</xsl:if>
				</xsl:if>
				<xsl:text>}</xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="altova:ControlEditField" mode="altova:rtf">
		<xsl:variable name="nBorderLeftTw" select="altova:MapPointsToTwips(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Borders/Left/@border-left-width))" as="xs:integer"/>
		<xsl:variable name="nBorderTopTw" select="altova:MapPointsToTwips(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Borders/Top/@border-top-width))" as="xs:integer"/>
		<xsl:variable name="nBorderRightTw" select="altova:MapPointsToTwips(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Borders/Right/@border-right-width))" as="xs:integer"/>
		<xsl:variable name="nBorderBottomTw" select="altova:MapPointsToTwips(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Borders/Bottom/@border-bottom-width))" as="xs:integer"/>
		<xsl:variable name="nPaddingLeftTw" select="altova:MapPointsToTwips(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Padding/@padding-left))" as="xs:integer"/>
		<xsl:variable name="nPaddingTopTw" select="altova:MapPointsToTwips(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Padding/@padding-top))" as="xs:integer"/>
		<xsl:variable name="nPaddingRightTw" select="altova:MapPointsToTwips(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Padding/@padding-right))" as="xs:integer"/>
		<xsl:variable name="nPaddingBottomTw" select="altova:MapPointsToTwips(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Padding/@padding-bottom))" as="xs:integer"/>
		<xsl:variable name="nFontSizeTw" select="altova:MapPointsToTwips(altova:MapLengthUnitToPointsUnrounded_AbsentOk(@font-size))" as="xs:integer"/>
		<xsl:variable name="nWidthTw" select="xs:integer(round(($nBorderLeftTw + $nBorderRightTw ) div 2 + $nPaddingLeftTw + $nPaddingRightTw + (if(@nWidth) then altova:MapPointsToTwips(altova:MapLengthUnitToPointsUnrounded_AbsentOk(@nWidth)) else $nFontSizeTw * 0.6 * @nCols)))" as="xs:integer"/>
		<xsl:variable name="nHeightTw" select="xs:integer(round(($nBorderTopTw + $nBorderBottomTw - 40 ) div 2 + $nPaddingTopTw + $nPaddingBottomTw + (if(@nHeight) then altova:MapPointsToTwips(altova:MapLengthUnitToPointsUnrounded_AbsentOk(@nHeight)) else $nFontSizeTw * 1.2 * @nRows)))" as="xs:integer"/>
		<!-- Reset the paragraph and character styles (to mimic the behaviour of input fields in HTML) -->
		<xsl:text>{\pard\plain</xsl:text>
		<!-- field is necessary to set the position to in line with text-->
		<xsl:text>{\field{\*\fldinst SHAPE \\*MERGEFROMAT }{\fldrslt</xsl:text>
		<!-- Rectangle for the edit field -->
		<xsl:text>{\shp</xsl:text>
		<xsl:text>{\*\shpinst</xsl:text>
		<xsl:text>\shpleft0</xsl:text>
		<xsl:text>\shptop0</xsl:text>
		<xsl:text>\shpright</xsl:text>
		<xsl:value-of select="$nWidthTw"/>
		<xsl:text>\shpbottom</xsl:text>
		<xsl:value-of select="$nHeightTw"/>
		<xsl:text>\shpfhdr0</xsl:text>
		<xsl:text>\shpbxcolumn</xsl:text>
		<xsl:text>\shpbxignore</xsl:text>
		<xsl:text>\shpbypara</xsl:text>
		<xsl:text>\shpbyignore</xsl:text>
		<xsl:text>\shpwr3</xsl:text>
		<xsl:text>\shpwrk0</xsl:text>
		<xsl:text>\shpfblwtxt0</xsl:text>
		<xsl:text>\shpz0</xsl:text>
		<xsl:text>\shplockanchor</xsl:text>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('shapeType', 1)"/>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fLine', 0)"/>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('posrelh', 3)"/>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('posrelv', 3)"/>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fLayoutInCell', 1)"/>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fPseudoInline', 1)"/>
		<xsl:if test="altova:RtfShapeStyles/@background-color">
			<xsl:choose>
				<xsl:when test="altova:RtfShapeStyles/@background-color eq 'transparent'">
					<xsl:value-of select="altova:GenerateRtfShapePropertyString('fFilled', '0')"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="altova:GenerateRtfShapePropertyString('fillColor', altova:RtfShapeStyles/@background-color)"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:if>
		<!--
		Note: Calls to MapCssToShapeDashingStyle and MapCssToShapeLineStyle need no _AbsentOk because if a dynamic style is
		present, so is altova:RtfShapeStyles/Borders/Top/@border-xxx-style.
		-->
		<xsl:if test="altova:RtfShapeStyles/Borders">
			<xsl:if test="altova:RtfShapeStyles/Borders/Top">
				<xsl:if test="altova:RtfShapeStyles/Borders/Top/@border-top-style != 'none'">
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fTopLine', 1)"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineTopColor', altova:MapColorAnyStringToShapePropertyValue_AbsentOk(altova:RtfShapeStyles/Borders/Top/@border-top-color))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineTopDashing', altova:MapCssToShapeDashingStyle(altova:RtfShapeStyles/Borders/Top/@border-top-style))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineTopStyle', altova:MapCssToShapeLineStyle(altova:RtfShapeStyles/Borders/Top/@border-top-style))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineTopWidth', altova:MapUnitPtToEmu(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Borders/Top/@border-top-width)))"/>
				</xsl:if>
			</xsl:if>
			<xsl:if test="altova:RtfShapeStyles/Borders/Left">
				<xsl:if test="altova:RtfShapeStyles/Borders/Left/@border-left-style != 'none'">
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fLeftLine', 1)"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineLeftColor', altova:MapColorAnyStringToShapePropertyValue_AbsentOk(altova:RtfShapeStyles/Borders/Left/@border-left-color))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineLeftDashing', altova:MapCssToShapeDashingStyle(altova:RtfShapeStyles/Borders/Left/@border-left-style))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineLeftStyle', altova:MapCssToShapeLineStyle(altova:RtfShapeStyles/Borders/Left/@border-left-style))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineLeftWidth', altova:MapUnitPtToEmu(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Borders/Left/@border-left-width)))"/>
				</xsl:if>
			</xsl:if>
			<xsl:if test="altova:RtfShapeStyles/Borders/Bottom">
				<xsl:if test="altova:RtfShapeStyles/Borders/Bottom/@border-bottom-style != 'none'">
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fBottomLine', 1)"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineBottomColor', altova:MapColorAnyStringToShapePropertyValue_AbsentOk(altova:RtfShapeStyles/Borders/Bottom/@border-bottom-color))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineBottomDashing', altova:MapCssToShapeDashingStyle(altova:RtfShapeStyles/Borders/Bottom/@border-bottom-style))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineBottomStyle', altova:MapCssToShapeLineStyle(altova:RtfShapeStyles/Borders/Bottom/@border-bottom-style))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineBottomWidth', altova:MapUnitPtToEmu(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Borders/Bottom/@border-bottom-width)))"/>
				</xsl:if>
			</xsl:if>
			<xsl:if test="altova:RtfShapeStyles/Borders/Right">
				<xsl:if test="altova:RtfShapeStyles/Borders/Right/@border-right-style != 'none'">
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fRightLine', 1)"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineRightColor', altova:MapColorAnyStringToShapePropertyValue_AbsentOk(altova:RtfShapeStyles/Borders/Right/@border-right-color))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineRightDashing', altova:MapCssToShapeDashingStyle(altova:RtfShapeStyles/Borders/Right/@border-right-style))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineRightStyle', altova:MapCssToShapeLineStyle(altova:RtfShapeStyles/Borders/Right/@border-right-style))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineRightWidth', altova:MapUnitPtToEmu(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Borders/Right/@border-right-width)))"/>
				</xsl:if>
			</xsl:if>
		</xsl:if>
		<xsl:if test="altova:RtfShapeStyles/Padding">
			<xsl:if test="altova:RtfShapeStyles/Padding/@padding-top">
				<xsl:value-of select="altova:GenerateRtfShapePropertyInt('dyTextTop', altova:MapUnitPtToEmu(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Padding/@padding-top)))"/>
			</xsl:if>
			<xsl:if test="altova:RtfShapeStyles/Padding/@padding-left">
				<xsl:value-of select="altova:GenerateRtfShapePropertyInt('dxTextLeft', altova:MapUnitPtToEmu(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Padding/@padding-left)))"/>
			</xsl:if>
			<xsl:if test="altova:RtfShapeStyles/Padding/@padding-bottom">
				<xsl:value-of select="altova:GenerateRtfShapePropertyInt('dyTextBottom', altova:MapUnitPtToEmu(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Padding/@padding-bottom)))"/>
			</xsl:if>
			<xsl:if test="altova:RtfShapeStyles/Padding/@padding-right">
				<xsl:value-of select="altova:GenerateRtfShapePropertyInt('dxTextRight', altova:MapUnitPtToEmu(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Padding/@padding-right)))"/>
			</xsl:if>
		</xsl:if>
		<xsl:if test="@nTextDirection">
			<xsl:value-of select="altova:GenerateRtfShapePropertyInt('txflTextFlow', @nTextDirection)"/>
		</xsl:if>
		<xsl:text>{\shptxt</xsl:text>
		<xsl:value-of select="altova:RtfShapeStyles/@text-align"/>
		<xsl:text>{</xsl:text>
		<xsl:value-of select="@altova:CharacterStyles"/>
		<xsl:apply-templates mode="altova:rtf"/>
		<xsl:text>}\par}</xsl:text>
		<!-- Close \shptxt{ -->
		<xsl:text>}</xsl:text>
		<!-- Close \shpinst{ -->
		<xsl:text>}</xsl:text>
		<!-- Close \shp{ -->
		<!-- pict -->
		<xsl:text>{\pict</xsl:text>
		<xsl:text>{\*\picprop\defshp</xsl:text>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('shapeType', 75)"/>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fPseudoInline', 1)"/>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fLayoutInCell', 1)"/>
		<xsl:text>\wmetafile8</xsl:text>
		<xsl:text>\piccropl0</xsl:text>
		<xsl:text>\piccropr0</xsl:text>
		<xsl:text>\piccropt</xsl:text>
		<xsl:value-of select="-($nHeightTw - 1)"/>
		<xsl:text>\piccropb</xsl:text>
		<xsl:value-of select="$nHeightTw - 1"/>
		<xsl:text>\picwgoal</xsl:text>
		<xsl:value-of select="$nWidthTw"/>
		<xsl:text>\pichgoal</xsl:text>
		<xsl:value-of select="$nHeightTw"/>
		<xsl:text>}</xsl:text>
		<!-- Close {\pictprop -->
		<xsl:text>}</xsl:text>
		<!-- Close {\pict -->
		<xsl:text>}</xsl:text>
		<!-- Close {\fldrslt -->
		<xsl:text>}</xsl:text>
		<!-- Close {\field -->
		<xsl:text>}</xsl:text>
		<!-- Close {\pard -->
	</xsl:template>
	<xsl:template match="altova:TextBox" mode="altova:rtf">
		<xsl:variable name="nBorderLeftTw" select="altova:MapPointsToTwips(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Borders/Left/@border-left-width))" as="xs:integer"/>
		<xsl:variable name="nBorderTopTw" select="altova:MapPointsToTwips(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Borders/Top/@border-top-width))" as="xs:integer"/>
		<xsl:variable name="nBorderRightTw" select="altova:MapPointsToTwips(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Borders/Right/@border-right-width))" as="xs:integer"/>
		<xsl:variable name="nBorderBottomTw" select="altova:MapPointsToTwips(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Borders/Bottom/@border-bottom-width))" as="xs:integer"/>
		<xsl:variable name="nPaddingLeftTw" select="altova:MapPointsToTwips(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Padding/@padding-left))" as="xs:integer"/>
		<xsl:variable name="nPaddingTopTw" select="altova:MapPointsToTwips(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Padding/@padding-top))" as="xs:integer"/>
		<xsl:variable name="nPaddingRightTw" select="altova:MapPointsToTwips(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Padding/@padding-right))" as="xs:integer"/>
		<xsl:variable name="nPaddingBottomTw" select="altova:MapPointsToTwips(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Padding/@padding-bottom))" as="xs:integer"/>
		<xsl:variable name="nLeftTw" select="xs:integer(@nLeftTw)	+ $nBorderLeftTw	idiv 2" as="xs:integer"/>
		<xsl:variable name="nTopTw" select="xs:integer(@nTopTw)		+ $nBorderTopTw		idiv 2" as="xs:integer"/>
		<xsl:variable name="nRightTw" select="xs:integer(@nLeftTw)	+ $nBorderLeftTw	+ $nPaddingLeftTw	+ xs:integer(@nWidthTw)		+ $nPaddingRightTw	+ $nBorderRightTw	idiv 2" as="xs:integer"/>
		<xsl:variable name="nBottomTw" select="xs:integer(@nTopTw)		+ $nBorderTopTw		+ $nPaddingTopTw	+ xs:integer(@nHeightTw)	+ $nPaddingBottomTw	+ $nBorderBottomTw	idiv 2" as="xs:integer"/>
		<xsl:text>{\shp</xsl:text>
		<xsl:text>{\*\shpinst</xsl:text>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('relLeft', $nLeftTw)"/>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('relTop', $nTopTw)"/>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('relRight', $nRightTw)"/>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('relBottom', $nBottomTw)"/>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('shapeType', 1)"/>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('dxTextLeft', 0)"/>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('dyTextTop', 0)"/>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('dxTextRight', 0)"/>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('dyTextBottom', 0)"/>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fLine', 0)"/>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fLayoutInCell', 1)"/>
		<xsl:if test="altova:RtfShapeStyles/@background-color">
			<xsl:choose>
				<xsl:when test="altova:RtfShapeStyles/@background-color eq 'transparent'">
					<xsl:value-of select="altova:GenerateRtfShapePropertyString('fFilled', '0')"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="altova:GenerateRtfShapePropertyString('fillColor', altova:RtfShapeStyles/@background-color)"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:if>
		<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fLine', 0)"/>
		<!--
		Note: Calls to MapCssToShapeDashingStyle and MapCssToShapeLineStyle need no _AbsentOk because if a dynamic style is
		present, so is altova:RtfShapeStyles/Borders/Top/@border-xxx-style.
		-->
		<xsl:if test="altova:RtfShapeStyles/Borders">
			<xsl:if test="altova:RtfShapeStyles/Borders/Top">
				<xsl:if test="altova:RtfShapeStyles/Borders/Top/@border-top-style != 'none'">
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fTopLine', 1)"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineTopColor', altova:MapColorAnyStringToShapePropertyValue_AbsentOk(altova:RtfShapeStyles/Borders/Top/@border-top-color))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineTopDashing', altova:MapCssToShapeDashingStyle(altova:RtfShapeStyles/Borders/Top/@border-top-style))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineTopStyle', altova:MapCssToShapeLineStyle(altova:RtfShapeStyles/Borders/Top/@border-top-style))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineTopWidth', altova:MapUnitPtToEmu(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Borders/Top/@border-top-width)))"/>
				</xsl:if>
			</xsl:if>
			<xsl:if test="altova:RtfShapeStyles/Borders/Left">
				<xsl:if test="altova:RtfShapeStyles/Borders/Left/@border-left-style != 'none'">
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fLeftLine', 1)"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineLeftColor', altova:MapColorAnyStringToShapePropertyValue_AbsentOk(altova:RtfShapeStyles/Borders/Left/@border-left-color))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineLeftDashing', altova:MapCssToShapeDashingStyle(altova:RtfShapeStyles/Borders/Left/@border-left-style))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineLeftStyle', altova:MapCssToShapeLineStyle(altova:RtfShapeStyles/Borders/Left/@border-left-style))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineLeftWidth', altova:MapUnitPtToEmu(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Borders/Left/@border-left-width)))"/>
				</xsl:if>
			</xsl:if>
			<xsl:if test="altova:RtfShapeStyles/Borders/Bottom">
				<xsl:if test="altova:RtfShapeStyles/Borders/Bottom/@border-bottom-style != 'none'">
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fBottomLine', 1)"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineBottomColor', altova:MapColorAnyStringToShapePropertyValue_AbsentOk(altova:RtfShapeStyles/Borders/Bottom/@border-bottom-color))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineBottomDashing', altova:MapCssToShapeDashingStyle(altova:RtfShapeStyles/Borders/Bottom/@border-bottom-style))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineBottomStyle', altova:MapCssToShapeLineStyle(altova:RtfShapeStyles/Borders/Bottom/@border-bottom-style))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineBottomWidth', altova:MapUnitPtToEmu(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Borders/Bottom/@border-bottom-width)))"/>
				</xsl:if>
			</xsl:if>
			<xsl:if test="altova:RtfShapeStyles/Borders/Right">
				<xsl:if test="altova:RtfShapeStyles/Borders/Right/@border-right-style != 'none'">
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('fRightLine', 1)"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineRightColor', altova:MapColorAnyStringToShapePropertyValue_AbsentOk(altova:RtfShapeStyles/Borders/Right/@border-right-color))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineRightDashing', altova:MapCssToShapeDashingStyle(altova:RtfShapeStyles/Borders/Right/@border-right-style))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineRightStyle', altova:MapCssToShapeLineStyle(altova:RtfShapeStyles/Borders/Right/@border-right-style))"/>
					<xsl:value-of select="altova:GenerateRtfShapePropertyInt('lineRightWidth', altova:MapUnitPtToEmu(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Borders/Right/@border-right-width)))"/>
				</xsl:if>
			</xsl:if>
		</xsl:if>
		<xsl:if test="altova:RtfShapeStyles/Padding">
			<xsl:if test="altova:RtfShapeStyles/Padding/@padding-top">
				<xsl:value-of select="altova:GenerateRtfShapePropertyInt('dyTextTop', altova:MapUnitPtToEmu(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Padding/@padding-top)))"/>
			</xsl:if>
			<xsl:if test="altova:RtfShapeStyles/Padding/@padding-left">
				<xsl:value-of select="altova:GenerateRtfShapePropertyInt('dxTextLeft', altova:MapUnitPtToEmu(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Padding/@padding-left)))"/>
			</xsl:if>
			<xsl:if test="altova:RtfShapeStyles/Padding/@padding-bottom">
				<xsl:value-of select="altova:GenerateRtfShapePropertyInt('dyTextBottom', altova:MapUnitPtToEmu(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Padding/@padding-bottom)))"/>
			</xsl:if>
			<xsl:if test="altova:RtfShapeStyles/Padding/@padding-right">
				<xsl:value-of select="altova:GenerateRtfShapePropertyInt('dxTextRight', altova:MapUnitPtToEmu(altova:MapLengthUnitToPointsUnrounded_AbsentOk(altova:RtfShapeStyles/Padding/@padding-right)))"/>
			</xsl:if>
		</xsl:if>
		<xsl:if test="@nTextDirection">
			<xsl:value-of select="altova:GenerateRtfShapePropertyInt('txflTextFlow', @nTextDirection)"/>
		</xsl:if>
		<xsl:text>{\shptxt</xsl:text>
		<xsl:value-of select="altova:RtfShapeStyles/@text-align"/>
		<xsl:text>{</xsl:text>
		<xsl:value-of select="@altova:CharacterStyles"/>
		<xsl:apply-templates mode="altova:rtf"/>
		<xsl:text>}}</xsl:text>
		<xsl:text>}</xsl:text>
		<!-- Close \shpinst{ -->
		<xsl:text>}</xsl:text>
		<!-- Close \shp{ -->
	</xsl:template>
	<xsl:template match="altova:string-to-unicode" mode="altova:rtf">
		<xsl:variable name="sWhitespace" select="(ancestor-or-self::*/@altova:whitespace)[last()]"/>
		<xsl:variable name="bPreserveAllWhitespace" select="$sWhitespace and $sWhitespace eq 'preserve-all'"/>
		<xsl:variable name="bPreserveNewlines" select="$bPreserveAllWhitespace or ($sWhitespace and $sWhitespace eq 'preserve-newlines')"/>
		<xsl:sequence select="altovaext:encode-for-rtf(., $bPreserveAllWhitespace, $bPreserveNewlines)" use-when="function-available('altovaext:encode-for-rtf', 3)"/>
		<xsl:sequence select="altova:string-to-unicode-core(., $bPreserveAllWhitespace, $bPreserveNewlines)" use-when="not(function-available('altovaext:encode-for-rtf', 3))"/>
	</xsl:template>
	<xsl:template match="text()|@*">
		<altova:string-to-unicode>
			<xsl:value-of select="."/>
		</altova:string-to-unicode>
	</xsl:template>
	<xsl:function name="altova:ApplyTableAndRowAndCellStyles" as="xs:string*">
		<xsl:param name="nodeTableRow" as="node()"/>
		<xsl:variable name="nodeTable" as="node()" select="$nodeTableRow/ancestor::altova:table[1]"/>
		<!-- Only if it's not an XML table -->
		<xsl:if test="$nodeTableRow/ancestor::altova:table[1]/altova:TableGrid">
			<xsl:variable name="nodeTableStyles" as="node()" select="$nodeTable/altova:TableStyles"/>
			<xsl:text>\trowd</xsl:text>
			<xsl:if test="empty($nodeTableRow/following-sibling::altova:table-row)">
				<xsl:text>\lastrow</xsl:text>
			</xsl:if>
			<!-- Generate this unconditionally so \clftsWidth1 works -->
			<xsl:text>\trautofit1</xsl:text>
			<!-- Styles that are equal for all rows -->
			<xsl:copy-of select="$nodeTableStyles/text()"/>
			<!-- Indent (left margin) -->
			<xsl:text>\trleft</xsl:text>
			<xsl:value-of select="altova:MapPointsToTwips($nodeTableStyles/@altova:nLeftMarginPt)"/>
			<!-- Cell spacing -->
			<xsl:if test="$nodeTableStyles/@altova:sBorderCollapse ne 'collapse'">
				<xsl:variable name="nBorderSpacingTw" as="xs:integer" select="altova:MapPointsToTwips($nodeTableStyles/@altova:nBorderSpacingPt div 2)"/>
				<xsl:value-of select="concat('\trspdl', $nBorderSpacingTw, '\trspdr', $nBorderSpacingTw, '\trspdt', $nBorderSpacingTw, '\trspdb', $nBorderSpacingTw)"/>
				<xsl:choose>
					<xsl:when test="$nBorderSpacingTw eq 0">
						<xsl:text>\trspdfl0\trspdfr0\trspdft0\trspdfb0</xsl:text>
					</xsl:when>
					<xsl:otherwise>
						<xsl:text>\trspdfl3\trspdfr3\trspdft3\trspdfb3</xsl:text>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:if>
			<!-- Row padding -->
			<xsl:variable name="nCellPaddingTw" as="xs:integer" select="altova:MapPointsToTwips($nodeTableStyles/@altova:nCellPaddingPt)"/>
			<xsl:value-of select="concat('\trpaddl', $nCellPaddingTw, '\trpaddr', $nCellPaddingTw, '\trpaddt', $nCellPaddingTw, '\trpaddb', $nCellPaddingTw)"/>
			<xsl:text>\trpaddfl3\trpaddfr3\trpaddft3\trpaddfb3</xsl:text>
			<!-- Table width -->
			<xsl:variable name="seqWidth" as="item()+" select="altova:ParseLengthToPointsOrPercent(normalize-space($nodeTableRow/ancestor::altova:table[1]/altova:TableStyles/altova:TableWidth/@altova:sWidth))"/>
			<xsl:variable name="nValue" as="xs:double" select="$seqWidth[1]"/>
			<xsl:variable name="sType" as="xs:string" select="$seqWidth[2]"/>
			<xsl:text>\trftsWidth</xsl:text>
			<xsl:choose>
				<xsl:when test="$sType eq 'auto'">
					<xsl:text>1</xsl:text>
				</xsl:when>
				<xsl:when test="$sType eq 'percent'">
					<xsl:text>2</xsl:text>
					<xsl:text>\trwWidth</xsl:text>
					<xsl:value-of select="$nValue * 50"/>
				</xsl:when>
				<xsl:when test="$sType eq 'points'">
					<xsl:text>3</xsl:text>
					<xsl:text>\trwWidth</xsl:text>
					<xsl:value-of select="altova:MapPointsToTwips($nValue)"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:message select="'altova:ApplyTableAndRowAndCellStyles: Unknown width type.'" terminate="yes"/>
				</xsl:otherwise>
			</xsl:choose>
			<!-- Row-specific styles -->
			<xsl:copy-of select="$nodeTableRow/altova:TableRowStyles/text()"/>
			<!-- Cell styles -->
			<xsl:value-of select="altova:BuildTableCellStyles($nodeTableRow)" separator=""/>
		</xsl:if>
	</xsl:function>
	<xsl:function name="altova:AreOnlyTextBlocksBetween" as="xs:boolean">
		<xsl:param name="nodeLower" as="node()"/>
		<xsl:param name="nodeUpper" as="node()"/>
		<xsl:sequence select="altova:AreOnlyTextBlocksBetweenRecursive($nodeLower, $nodeUpper, false())"/>
	</xsl:function>
	<xsl:function name="altova:AreOnlyTextBlocksBetweenRecursive" as="xs:boolean">
		<xsl:param name="nodeLower" as="node()"/>
		<xsl:param name="nodeUpper" as="node()"/>
		<xsl:param name="bInRecursion" as="xs:boolean"/>
		<xsl:choose>
			<xsl:when test="$nodeLower is $nodeUpper">
				<xsl:sequence select="true()"/>
			</xsl:when>
			<xsl:when test="$bInRecursion and name($nodeLower) ne 'altova:text-block'">
				<xsl:sequence select="false()"/>
			</xsl:when>
			<xsl:when test="not($nodeLower/..)">
				<xsl:message select="'Invalid argument passed to altova:AreOnlyTextBlocksBetween.'"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:sequence select="altova:AreOnlyTextBlocksBetweenRecursive($nodeLower/.., $nodeUpper, true())"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:BuildTableCellStyles" as="xs:string*">
		<xsl:param name="nodeTableRow" as="node()"/>
		<xsl:variable name="nodeTable" as="node()" select="$nodeTableRow/ancestor::altova:table[1]"/>
		<xsl:for-each select="$nodeTableRow/altova:table-cell">
			<xsl:variable name="nCol" as="xs:integer" select="position()"/>
			<xsl:variable name="nodeGridCol" as="node()" select="$nodeTable/altova:TableGrid/altova:GridCol[$nCol]"/>
			<xsl:variable name="nodeCell" as="node()" select="$nodeTableRow/altova:table-cell[$nCol]"/>
			<xsl:copy-of select="$nodeCell/altova:TableCellStyles/text()" copy-namespaces="no"/>
			<!-- Cell background color -->
			<xsl:if test="$nodeCell/altova:TableCellStyles/altova:TableCellColor/@altova:sValue">
				<xsl:value-of select="altova:GenerateRtfTableCellColor($nodeCell/altova:TableCellStyles/altova:TableCellColor/@altova:sValue)"/>
			</xsl:if>
			<!-- Cell padding -->
			<xsl:if test="$nodeCell/altova:TableCellStyles/altova:CellPadding">
				<xsl:variable name="nodeCellPadding" as="node()" select="$nodeCell/altova:TableCellStyles/altova:CellPadding"/>
				<xsl:variable name="nCellPaddingOnTablePt" as="xs:double" select="$nodeTable/altova:TableStyles/@altova:nCellPaddingPt"/>
				<!-- Swap control words for top and left due to a bug in Word -->
				<xsl:if test="$nodeCellPadding/altova:Left/@nPaddingPt and xs:double($nodeCellPadding/altova:Left/@nPaddingPt) ne -1">
					<xsl:text>\clpadt</xsl:text>
					<xsl:value-of select="altova:MapPointsToTwips($nodeCellPadding/altova:Left/@nPaddingPt)"/>
					<xsl:text>\clpadft3</xsl:text>
				</xsl:if>
				<xsl:if test="$nodeCellPadding/altova:Right/@nPaddingPt and xs:double($nodeCellPadding/altova:Right/@nPaddingPt) ne -1">
					<xsl:text>\clpadr</xsl:text>
					<xsl:value-of select="altova:MapPointsToTwips($nodeCellPadding/altova:Right/@nPaddingPt)"/>
					<xsl:text>\clpadfr3</xsl:text>
				</xsl:if>
				<xsl:if test="$nodeCellPadding/altova:Top/@nPaddingPt and xs:double($nodeCellPadding/altova:Top/@nPaddingPt) ne -1">
					<xsl:text>\clpadl</xsl:text>
					<xsl:value-of select="altova:MapPointsToTwips($nodeCellPadding/altova:Top/@nPaddingPt)"/>
					<xsl:text>\clpadfl3</xsl:text>
				</xsl:if>
				<xsl:if test="$nodeCellPadding/altova:Bottom/@nPaddingPt and xs:double($nodeCellPadding/altova:Bottom/@nPaddingPt) ne -1">
					<xsl:text>\clpadb</xsl:text>
					<xsl:value-of select="altova:MapPointsToTwips($nodeCellPadding/altova:Bottom/@nPaddingPt)"/>
					<xsl:text>\clpadfb3</xsl:text>
				</xsl:if>
			</xsl:if>
			<!-- Cell borders -->
			<xsl:apply-templates select="$nodeCell/altova:TableCellStyles/altova:Borders" mode="altova:rtf"/>
			<!-- Grid position -->
			<xsl:choose>
				<xsl:when test="$nodeGridCol/@altova:sType eq 'auto'">
					<xsl:text>\clftsWidth1</xsl:text>
				</xsl:when>
				<xsl:when test="$nodeGridCol/@altova:sType eq 'percent'">
					<xsl:text>\clftsWidth2\clwWidth</xsl:text>
					<xsl:value-of select="$nodeGridCol/@altova:sWidth * 50"/>
				</xsl:when>
			</xsl:choose>
			<xsl:text>\cellx</xsl:text>
			<xsl:variable name="nCols" as="xs:integer" select="count($nodeTableRow/altova:table-cell)"/>
			<!-- Add a small width for autofit columns; e.g. a 1x1 table doesn't display correctly if we generate \cellx0 -->
			<!--<xsl:value-of select="sum(for $nColCurr in (1 to $nCol) return for $nVal in altova:GetGridColumnPosTw($nodeTable, $nodeTableRow, $nColCurr, $nCols) return if ($nVal eq 0) then 1440 else $nVal)"/>-->
			<xsl:value-of select="max(for $nRow in count($nodeTable/altova:table-row) return sum(for $nColCurr in (1 to $nCol) return for $nVal in altova:GetGridColumnPosTw($nodeTable, $nodeTable/altova:table-row[$nRow], $nColCurr, $nCols) return if ($nVal eq 0) then 1440 else $nVal))"/>
		</xsl:for-each>
	</xsl:function>
	<xsl:function name="altova:CausesVisualLineBreak" as="xs:boolean">
		<xsl:param name="nodeCurr" as="node()?"/>
		<xsl:choose>
			<xsl:when test="string(node-name($nodeCurr)) eq 'altova:text-block'">
				<xsl:variable name="nodeLastChild" as="node()?" select="$nodeCurr/*[last()]"/>
				<xsl:choose>
					<xsl:when test="not($nodeLastChild)">
						<xsl:value-of select="false()"/>
					</xsl:when>
					<xsl:when test="string(node-name($nodeLastChild)) eq 'altova:paragraph'">
						<xsl:value-of select="true()"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="altova:CausesVisualLineBreak($nodeLastChild)"/>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$nodeCurr and index-of(('altova:line', 'altova:list', 'altova:list-item', 'altova:new-line', 'altova:page-break', 'altova:paragraph', 'altova:table', 'altova:DocumentSection', 'altova:TextBox', 'altova:RtfShapeStyles', 'altova:column-break'), string(node-name($nodeCurr)))"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:ConvertToUnicode" as="xs:string">
		<xsl:param name="sText" as="xs:string"/>
		<xsl:value-of select="string-join(for $i in string-to-codepoints($sText) return if ($i &lt; 32) then ' ' else concat('\u', string($i), '?'), '')"/>
	</xsl:function>
	<xsl:function name="altova:CopyOwnDocument" as="node()+">
		<xsl:param name="nodeAltovaDocument" as="node()"/>
		<xsl:for-each select="$nodeAltovaDocument">
			<xsl:copy>
				<xsl:copy-of select="@*"/>
				<xsl:apply-templates select="node()" mode="altova:CopyOwnDocument"/>
			</xsl:copy>
		</xsl:for-each>
	</xsl:function>
	<xsl:function name="altova:EnsureBlockLevelElementBegins" as="node()*">
		<xsl:param name="nodeCurr" as="node()"/>
		<xsl:choose>
			<!-- If it's the first element in a table cell, no need to force a line break -->
			<xsl:when test="xs:string(node-name($nodeCurr/..)) eq 'altova:table-cell' and not($nodeCurr/preceding-sibling::*[1])"/>
			<xsl:otherwise>
				<!--
				If the previously generated node PN does *not* force a subsequent newline (e.g. it was text; not a paragraph,
				table, etc.), then the current element CE needs to generate '\par' in order to be block-level.
				But only if PN is a (then preceding) sibling of *CE*, not in the case that CE is inside a paragraph, list item, or
				table cell X, and PN is a sibling of *X*.
				-->
				<xsl:variable name="bGenerateParagraphEnd" as="xs:boolean?">
					<xsl:variable name="nodePrevious" as="node()?" select="altova:FindVisibleElementOfPrecedingEndTag($nodeCurr)"/>
					<xsl:choose>
						<!-- If it's the first paragraph in the document, there's no preceding paragraph that needs terminating -->
						<xsl:when test="string(node-name($nodePrevious)) eq 'altova:AfterHeadersFooters'">
							<xsl:value-of select="false()"/>
						</xsl:when>
						<!-- Now that a newline no longer generates \par but \line, this function must add \par -->
						<xsl:when test="xs:string(node-name($nodePrevious)) eq 'altova:new-line'">
							<xsl:value-of select="true()"/>
						</xsl:when>
						<!-- Table after column break needs \par (empirical) -->
						<xsl:when test="xs:string(node-name($nodeCurr)) eq 'altova:table' and xs:string(node-name($nodePrevious)) eq 'altova:column-break'">
							<xsl:value-of select="true()"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:if test="not(altova:CausesVisualLineBreak($nodePrevious))">
								<xsl:if test="not(empty($nodePrevious))">
									<xsl:if test="$nodeCurr/preceding-sibling::*[. = $nodePrevious[1]]">
										<xsl:value-of select="true()"/>
									</xsl:if>
								</xsl:if>
							</xsl:if>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:variable>
				<xsl:if test="$bGenerateParagraphEnd">
					<xsl:variable name="nDepth" as="xs:integer" select="count($nodeCurr/ancestor::altova:table)"/>
					<xsl:text>\par\pard</xsl:text>
					<xsl:if test="$nDepth &gt; 0">
						<xsl:text>\intbl</xsl:text>
					</xsl:if>
					<xsl:value-of select="concat('\itap', $nDepth)"/>
				</xsl:if>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:FindVisibleElementOfPrecedingEndTag" as="node()?">
		<xsl:param name="nodeCurr"/>
		<xsl:variable name="VisibleElementOfPrecedingEndTag" select="$nodeCurr/preceding-sibling::*[name(.) != 'altova:bookmark' and name(.) != 'altova:PageRef'][1]"/>
		<xsl:sequence select="if ($VisibleElementOfPrecedingEndTag) then $VisibleElementOfPrecedingEndTag else if ($nodeCurr/..) then altova:FindVisibleElementOfPrecedingEndTag($nodeCurr/..) else ()"/>
		<!-- xsl:sequence select="if ($nodeCurr/preceding-sibling::*[name(.) != 'altova:bookmark' and name(.) != 'altova:PageRef'][1]) then $nodeCurr/preceding-sibling::*[name(.) != 'altova:bookmark' and name(.) != 'altova:PageRef'][1] else if ($nodeCurr/..) then altova:FindVisibleElementOfPrecedingEndTag($nodeCurr/..) else ()"/ -->
	</xsl:function>
	<xsl:function name="altova:GenerateRtfBackgroundColorForAnyColorString" as="xs:string">
		<xsl:param name="sColor" as="xs:string"/>
		<xsl:variable name="sRetval" as="xs:string">
			<xsl:choose>
				<xsl:when test="$sColor != ''">
					<xsl:choose>
						<xsl:when test="upper-case($sColor) != 'TRANSPARENT'">
							<xsl:variable name="nIndex" as="xs:integer" select="altova:MapColorAnyStringToColorTableIndex($sColor)"/>
							<xsl:choose>
								<xsl:when test="$nIndex &gt;= 0">
									<xsl:value-of select="concat('\chcbpat', $nIndex)"/>
								</xsl:when>
								<xsl:otherwise>
									<xsl:value-of select="''"/>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:when>
						<xsl:otherwise>
							<xsl:value-of select="''"/>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="''"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:value-of select="$sRetval"/>
	</xsl:function>
	<xsl:function name="altova:GenerateRtfBorderColor" as="node()*">
		<xsl:param name="sColor" as="xs:string"/>
		<xsl:choose>
			<xsl:when test="$sColor != ''">
				<xsl:variable name="nIndex" as="xs:integer" select="altova:MapColorAnyStringToColorTableIndex($sColor)"/>
				<xsl:choose>
					<xsl:when test="$nIndex = -1">
						<xsl:message select="concat('GenerateRtfBorderColor: Bad color &quot;', $sColor, '&quot;, ignored.')"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:text>\brdrcf</xsl:text>
						<xsl:value-of select="$nIndex"/>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:when>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:GenerateRtfBorderStyle" as="node()*">
		<xsl:param name="sStyle" as="xs:string"/>
		<xsl:variable name="sStyleNormalized" as="xs:string" select="normalize-space($sStyle)"/>
		<xsl:choose>
			<xsl:when test="$sStyleNormalized = ''">
			</xsl:when>
			<xsl:when test="$sStyleNormalized = 'dashed'">
				<xsl:text>\brdrdash</xsl:text>
			</xsl:when>
			<xsl:when test="$sStyleNormalized = 'dotted'">
				<xsl:text>\brdrdot</xsl:text>
			</xsl:when>
			<xsl:when test="$sStyleNormalized = 'double'">
				<xsl:text>\brdrdb</xsl:text>
			</xsl:when>
			<xsl:when test="$sStyleNormalized = 'groove'">
				<xsl:text>\brdrengrave</xsl:text>
			</xsl:when>
			<xsl:when test="$sStyleNormalized = 'inset'">
				<xsl:text>\brdrinset</xsl:text>
			</xsl:when>
			<xsl:when test="$sStyleNormalized = 'none'">
				<xsl:text>\brdrnone</xsl:text>
			</xsl:when>
			<xsl:when test="$sStyleNormalized = 'outset'">
				<xsl:text>\brdroutset</xsl:text>
			</xsl:when>
			<xsl:when test="$sStyleNormalized = 'ridge'">
				<xsl:text>\brdremboss</xsl:text>
			</xsl:when>
			<xsl:when test="$sStyleNormalized = 'solid'">
				<xsl:text>\brdrs</xsl:text>
			</xsl:when>
			<xsl:when test="$sStyleNormalized = 'inherit'">
				<xsl:message select="concat('GenerateRtfBorderStyle: Value &quot;', $sStyle, '&quot; not supported, no border created.')"/>
				<xsl:text>\brdrnone</xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:message select="concat('GenerateRtfBorderStyle: Bad value &quot;', $sStyle, '&quot;, no border created.')"/>
				<xsl:text>\brdrnone</xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:GenerateRtfCharacterBorderStyle" as="node()*">
		<xsl:param name="sStyle" as="xs:string"/>
		<xsl:variable name="sStyleNormalized" as="xs:string" select="normalize-space($sStyle)"/>
		<xsl:choose>
			<xsl:when test="$sStyleNormalized = ''">
			</xsl:when>
			<xsl:when test="$sStyleNormalized = 'dashed'">
				<xsl:text>\chbrdr\brdrdash</xsl:text>
			</xsl:when>
			<xsl:when test="$sStyleNormalized = 'dotted'">
				<xsl:text>\chbrdr\brdrdot</xsl:text>
			</xsl:when>
			<xsl:when test="$sStyleNormalized = 'double'">
				<xsl:text>\chbrdr\brdrdb</xsl:text>
			</xsl:when>
			<xsl:when test="$sStyleNormalized = 'groove'">
				<xsl:text>\chbrdr\brdrengrave</xsl:text>
			</xsl:when>
			<xsl:when test="$sStyleNormalized = 'inset'">
				<xsl:text>\chbrdr\brdrinset</xsl:text>
			</xsl:when>
			<xsl:when test="$sStyleNormalized = 'none'">
				<xsl:text>\chbrdr\brdrnone</xsl:text>
			</xsl:when>
			<xsl:when test="$sStyleNormalized = 'outset'">
				<xsl:text>\chbrdr\brdroutset</xsl:text>
			</xsl:when>
			<xsl:when test="$sStyleNormalized = 'ridge'">
				<xsl:text>\chbrdr\brdremboss</xsl:text>
			</xsl:when>
			<xsl:when test="$sStyleNormalized = 'solid'">
				<xsl:text>\chbrdr\brdrs</xsl:text>
			</xsl:when>
			<xsl:when test="$sStyleNormalized = 'inherit'">
				<xsl:message select="concat('GenerateRtfCharacterBorderStyle: Value &quot;', $sStyle, '&quot; not supported, no border created.')"/>
				<xsl:text>\chbrdr\brdrnone</xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:message select="concat('GenerateRtfCharacterBorderStyle: Bad value &quot;', $sStyle, '&quot;, no border created.')"/>
				<xsl:text>\chbrdr\brdrnone</xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:GenerateRtfBorderWidth" as="node()*">
		<xsl:param name="sWidth" as="xs:string"/>
		<xsl:variable name="sWidthNormalized" as="xs:string" select="normalize-space($sWidth)"/>
		<xsl:choose>
			<xsl:when test="$sWidthNormalized = ''">
			</xsl:when>
			<xsl:when test="$sWidthNormalized = 'thin'">
				<xsl:text>\brdrhair</xsl:text>
			</xsl:when>
			<xsl:when test="$sWidthNormalized = 'medium'">
				<xsl:text>\brdrs</xsl:text>
			</xsl:when>
			<xsl:when test="$sWidthNormalized = 'thick'">
				<xsl:text>\brdrth</xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:variable name="nPoints" as="xs:double" select="altova:MapFontValueAndUnitToPointsUnrounded($sWidthNormalized)"/>
				<xsl:choose>
					<xsl:when test="$nPoints &gt;= 0">
						<xsl:text>\brdrw</xsl:text>
						<xsl:value-of select="altova:MapPointsToTwips($nPoints)"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:message select="concat('GenerateRtfBorderWidth: Unknown or unsupported value &quot;', $sWidth, '&quot;, using default.')"/>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:GenerateRtfColorTable" as="node()+">
		<xsl:text>{\colortbl;</xsl:text>
		<xsl:for-each select="$altova:seqColorsInUseNormalizedValidated">
			<xsl:variable name="sSixHexDigits" as="xs:string" select="altova:MapColorAnyStringToSixHexDigits(.)"/>
			<xsl:choose>
				<xsl:when test="not($sSixHexDigits)">
					<xsl:message select="concat('--> GenerateRtfColorTable: Encountered bad color &quot;', ., '&quot;.')"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:variable name="seqRgbDec" select="altova:MapColorSixHexDigitsToDecRgbSeq($sSixHexDigits)"/>
					<xsl:choose>
						<xsl:when test="empty($seqRgbDec)">
							<xsl:message select="concat('--> GenerateRtfColorTable: Encountered bad hex value &quot;', $sSixHexDigits, '&quot;.')"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:text>\red</xsl:text>
							<xsl:value-of select="$seqRgbDec[1]"/>
							<xsl:text>\green</xsl:text>
							<xsl:value-of select="$seqRgbDec[2]"/>
							<xsl:text>\blue</xsl:text>
							<xsl:value-of select="$seqRgbDec[3]"/>
							<xsl:text>;</xsl:text>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:for-each>
		<xsl:text>}</xsl:text>
	</xsl:function>
	<xsl:function name="altova:GenerateRtfFontFamily" as="node()*">
		<xsl:param name="sFontFamily" as="xs:string"/>
		<xsl:value-of select="if ($sFontFamily != '') then concat('\f', altova:MapFontFamilyToFontIndex($sFontFamily)) else ()"/>
	</xsl:function>
	<xsl:function name="altova:GenerateRtfFontSize" as="node()*">
		<xsl:param name="sFontSize" as="xs:string"/>
		<xsl:value-of select="if ($sFontSize != '') then concat('\fs', round(altova:MapFontSizeToPointsUnrounded($sFontSize) * 2)) else ()"/>
	</xsl:function>
	<xsl:function name="altova:GenerateRtfFontStyle" as="node()*">
		<xsl:param name="sFontStyle" as="xs:string"/>
		<xsl:value-of select="if ($sFontStyle != '') then altova:MapFontStyleToControlWord($sFontStyle) else ()"/>
	</xsl:function>
	<xsl:function name="altova:GenerateRtfFontVariant" as="node()*">
		<xsl:param name="sFontVariant" as="xs:string"/>
		<xsl:value-of select="if ($sFontVariant != '') then altova:MapFontVariantToControlWord($sFontVariant) else ()"/>
	</xsl:function>
	<xsl:function name="altova:GenerateRtfFontWeight" as="node()*">
		<xsl:param name="sFontWeight" as="xs:string"/>
		<xsl:value-of select="if ($sFontWeight != '') then altova:MapFontWeightToControlWord($sFontWeight) else ()"/>
	</xsl:function>
	<xsl:function name="altova:GenerateRtfFontTable" as="node()+">
		<xsl:text>{\fonttbl</xsl:text>
		<xsl:for-each select="$altova:seqFontsInUse">
			<xsl:text>{\f</xsl:text>
			<xsl:value-of select="position() - 1"/>
			<xsl:text>\fnil </xsl:text>
			<xsl:value-of select="current()"/>
			<xsl:text>;}</xsl:text>
		</xsl:for-each>
		<xsl:text>}</xsl:text>
	</xsl:function>
	<xsl:function name="altova:GenerateRtfForegroundColorForAnyColorString" as="xs:string">
		<xsl:param name="sColor" as="xs:string"/>
		<xsl:variable name="sRetval" as="xs:string">
			<xsl:choose>
				<xsl:when test="$sColor != ''">
					<xsl:variable name="nIndex" select="altova:MapColorAnyStringToColorTableIndex($sColor)"/>
					<xsl:choose>
						<xsl:when test="$nIndex &gt;= 0">
							<xsl:value-of select="concat('\cf', $nIndex)"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:value-of select="''"/>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="''"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:value-of select="$sRetval"/>
	</xsl:function>
	<xsl:function name="altova:GenerateRtfLineHeight" as="xs:string">
		<xsl:param name="sLineHeight" as="xs:string"/>
		<xsl:variable name="nLineHeightTw" select="altova:MapLineHeightToTwips($sLineHeight)" as="xs:integer"/>
		<xsl:value-of select="concat('\sl', string($nLineHeightTw))"/>
	</xsl:function>
	<xsl:function name="altova:GenerateRtfCompositeCharacterStyles" as="xs:string?">
		<xsl:param name="altova:sStyleList" as="xs:string?"/>
		<xsl:variable name="altova:seqStyles" select="tokenize($altova:sStyleList, ';')" as="xs:string*"/>
		<xsl:variable name="altova:seqControlWords" as="xs:string*">
			<xsl:for-each select="$altova:seqStyles">
				<xsl:variable name="altova:sStyleName" select="normalize-space(substring-before(., ':'))" as="xs:string?"/>
				<xsl:variable name="altova:sStyleValue" select="normalize-space(substring-after(., ':'))" as="xs:string?"/>
				<xsl:if test="$altova:sStyleName and $altova:sStyleValue">
					<xsl:choose>
						<xsl:when test="$altova:sStyleName eq 'background-color'">
							<xsl:value-of select="altova:GenerateRtfBackgroundColorForAnyColorString($altova:sStyleValue)"/>
						</xsl:when>
						<xsl:when test="$altova:sStyleName eq 'color'">
							<xsl:value-of select="altova:GenerateRtfForegroundColorForAnyColorString($altova:sStyleValue)"/>
						</xsl:when>
						<xsl:when test="$altova:sStyleName eq 'font-family'">
							<xsl:value-of select="altova:GenerateRtfFontFamily($altova:sStyleValue)"/>
						</xsl:when>
						<xsl:when test="$altova:sStyleName eq 'font-size'">
							<xsl:value-of select="altova:GenerateRtfFontSize($altova:sStyleValue)"/>
						</xsl:when>
						<xsl:when test="$altova:sStyleName eq 'font-style'">
							<xsl:value-of select="altova:GenerateRtfFontStyle($altova:sStyleValue)"/>
						</xsl:when>
						<xsl:when test="$altova:sStyleName eq 'font-weight'">
							<xsl:value-of select="altova:GenerateRtfFontWeight($altova:sStyleValue)"/>
						</xsl:when>
						<xsl:when test="$altova:sStyleName eq 'text-decoration'">
							<xsl:value-of select="altova:GenerateRtfTextDecoration($altova:sStyleValue)"/>
						</xsl:when>
					</xsl:choose>
					<!--
					<xsl:value-of select="altova:GenerateRtfCharacterBorderStyle(string(@border-style))"/>
					<xsl:value-of select="altova:GenerateRtfBorderColor(string(@border-color))"/>
					<xsl:value-of select="altova:GenerateRtfBorderWidth(string(@border-width))"/>
					<xsl:value-of select="altova:GenerateRtfFontVariant(string(@font-variant))"/>
					-->
				</xsl:if>
			</xsl:for-each>
		</xsl:variable>
		<xsl:if test="exists($altova:seqControlWords)">
			<!-- In case of disable-output-escaping, the unescaped text must not directly follow the last control word -->
			<xsl:value-of select="concat(string-join($altova:seqControlWords, ''), ' ')"/>
		</xsl:if>
	</xsl:function>
	<xsl:function name="altova:GenerateRtfCompositeParagraphStyles" as="xs:string?">
		<xsl:param name="altova:sStyleList" as="xs:string?"/>
		<xsl:variable name="altova:seqStyles" select="tokenize($altova:sStyleList, ';')" as="xs:string*"/>
		<xsl:variable name="altova:seqControlWords" as="xs:string*">
			<xsl:for-each select="$altova:seqStyles">
				<xsl:variable name="altova:sStyleName" select="normalize-space(substring-before(., ':'))" as="xs:string?"/>
				<xsl:variable name="altova:sStyleValue" select="normalize-space(substring-after(., ':'))" as="xs:string?"/>
				<xsl:if test="$altova:sStyleName and $altova:sStyleValue">
					<xsl:choose>
						<xsl:when test="$altova:sStyleName eq 'text-align'">
							<xsl:value-of select="altova:GenerateRtfTextAlign($altova:sStyleValue)"/>
						</xsl:when>
					</xsl:choose>
				</xsl:if>
			</xsl:for-each>
		</xsl:variable>
		<xsl:if test="exists($altova:seqControlWords)">
			<!-- In case of disable-output-escaping, the unescaped text must not directly follow the last control word -->
			<xsl:value-of select="concat(string-join($altova:seqControlWords, ''), ' ')"/>
		</xsl:if>
	</xsl:function>
	<xsl:function name="altova:GenerateRtfShapePropertyInt" as="node()+">
		<xsl:param name="sName" as="xs:string"/>
		<xsl:param name="nValue" as="xs:integer"/>
		<xsl:sequence select="altova:GenerateRtfShapePropertyString($sName, xs:string($nValue))"/>
	</xsl:function>
	<xsl:function name="altova:GenerateRtfShapePropertyString" as="node()+">
		<xsl:param name="sName" as="xs:string"/>
		<xsl:param name="sValue" as="xs:string"/>
		<xsl:text>{\sp{\sn </xsl:text>
		<xsl:value-of select="$sName"/>
		<xsl:text>}{\sv </xsl:text>
		<xsl:value-of select="$sValue"/>
		<xsl:text>}}</xsl:text>
	</xsl:function>
	<xsl:function name="altova:GenerateRtfTableCellColor" as="node()*">
		<xsl:param name="sColor" as="xs:string"/>
		<xsl:if test="$sColor ne '' and $sColor ne 'transparent'">
			<xsl:variable name="nIndex" as="xs:integer" select="altova:MapColorAnyStringToColorTableIndex($sColor)"/>
			<xsl:choose>
				<xsl:when test="$nIndex = -1">
					<xsl:message select="concat('GenerateRtfTableCellColor: Bad color &quot;', $sColor, '&quot;, ignored.')"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>\clcbpat</xsl:text>
					<xsl:value-of select="$nIndex"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:if>
	</xsl:function>
	<xsl:function name="altova:GenerateRtfTableCellVerticalAlign" as="node()*">
		<xsl:param name="sVerticalAlign" as="xs:string"/>
		<xsl:choose>
			<xsl:when test="$sVerticalAlign eq 'top' or $sVerticalAlign eq 'baseline'">
				<xsl:text>\clvertalt</xsl:text>
			</xsl:when>
			<xsl:when test="$sVerticalAlign eq 'middle'">
				<xsl:text>\clvertalc</xsl:text>
			</xsl:when>
			<xsl:when test="$sVerticalAlign eq 'bottom'">
				<xsl:text>\clvertalb</xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<!-- This case includes text-top, text-bottom, sub, super; they are not allowed on a table cell -->
				<xsl:message select="concat('GenerateRtfTableCellVerticalAlign: Bad alignment (for table cell) &quot;', $sVerticalAlign, '&quot;, ignored.')"/>
				<xsl:text>\clvertalc</xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:GenerateRtfTextAlign" as="xs:string">
		<xsl:param name="sTextAlign" as="xs:string"/>
		<xsl:sequence select="if ($sTextAlign != '') then altova:MapTextAlignToControlWord($sTextAlign) else ''"/>
	</xsl:function>
	<xsl:function name="altova:GenerateRtfTextDecoration" as="xs:string">
		<xsl:param name="sTextDecoration" as="xs:string"/>
		<xsl:sequence select="if ($sTextDecoration != '') then altova:MapTextDecorationToControlWord($sTextDecoration) else ''"/>
	</xsl:function>
	<xsl:function name="altova:GetAvailableDocumentColumnWidthPt" as="xs:double">
		<xsl:param name="nodeCurr" as="node()"/>
		<xsl:variable name="nodeDocSec" as="node()" select="$nodeCurr/preceding::altova:DocumentSection[1]"/>
		<xsl:variable name="bInHeaderOrFooter" as="xs:boolean" select="empty($nodeCurr/preceding::altova:AfterHeadersFooters[. >> $nodeDocSec])"/>
		<xsl:variable name="nPageWidthWithoutMargins" as="xs:double" select="$nodeDocSec/@altova:PageWidthPt - $nodeDocSec/@altova:MarginLeftPt - $nodeDocSec/@altova:MarginRightPt"/>
		<xsl:sequence select="if ($bInHeaderOrFooter) then $nPageWidthWithoutMargins else ($nPageWidthWithoutMargins - ($nodeDocSec/@altova:Columns - 1) * $nodeDocSec/@altova:ColumnGapPt) div $nodeDocSec/@altova:Columns"/>
	</xsl:function>
	<xsl:function name="altova:GetAvailablePageWidthPt" as="xs:integer">
		<xsl:param name="nodeCurr" as="node()"/>
		<xsl:variable name="nodeDocumentSection" as="node()" select="$nodeCurr/preceding::altova:DocumentSection[1]"/>
		<xsl:value-of select="$nodeDocumentSection/@altova:PageWidthPt - $nodeDocumentSection/@altova:MarginLeftPt - $nodeDocumentSection/@altova:MarginRightPt"/>
	</xsl:function>
	<xsl:function name="altova:GetAvailableHorSpaceInParentPt" as="xs:double">
		<xsl:param name="nodeCurr" as="node()"/>
		<xsl:choose>
			<!-- If it's a table -->
			<xsl:when test="xs:string(node-name($nodeCurr/..)) eq 'altova:table'">
				<!-- The table's width may be given directly -->
				<xsl:variable name="nodeTable" as="node()" select="$nodeCurr/.."/>
				<xsl:variable name="sTableWidth" as="xs:string" select="normalize-space($nodeTable/altova:TableStyles/altova:TableWidth/@altova:sWidth)"/>
				<xsl:variable name="seqTableWidth" as="item()+" select="altova:ParseLengthToPointsOrPercent($sTableWidth)"/>
				<xsl:variable name="nTableWidthValue" as="xs:double" select="$seqTableWidth[1]"/>
				<xsl:variable name="sTableWidthType" as="xs:string" select="$seqTableWidth[2]"/>
				<xsl:variable name="nTableWidthPt" as="xs:double">
					<xsl:choose>
						<!-- If the table width is absolute -->
						<xsl:when test="$sTableWidthType eq 'points'">
							<!-- Convert column percent to points -->
							<xsl:sequence select="$nTableWidthValue"/>
						</xsl:when>
						<!-- If the table width is given in percent -->
						<xsl:when test="$sTableWidthType eq 'percent'">
							<!-- Convert table percent to points -->
							<xsl:variable name="nParentWidthPt" as="xs:double" select="altova:GetAvailableHorSpaceInParentPt($nodeTable)"/>
							<xsl:sequence select="$nParentWidthPt * $nTableWidthValue div 100"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:sequence select="altova:GetAvailableHorSpaceInParentPt($nodeTable)"/>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:variable>
				<!-- Account for (outer) border spacing -->
				<xsl:variable name="nTableWidthPt" as="xs:double" select="$nTableWidthPt - $nodeTable/altova:TableStyles/@altova:nBorderSpacingPt * 2"/>
				<!-- Account for table border -->
				<xsl:variable name="nTableWidthPt" as="xs:double" select="$nTableWidthPt - sum($nodeTable/altova:TableStyles/altova:Borders/(altova:Left|altova:Right)/@altova:nWidthPt)"/>
				<xsl:sequence select="$nTableWidthPt"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:variable name="nodeTableCell" as="node()?" select="$nodeCurr/ancestor::altova:table-cell[1]"/>
				<xsl:choose>
					<!-- If inside a table -->
					<xsl:when test="$nodeTableCell">
						<xsl:variable name="nGridCol" as="xs:integer" select="count($nodeTableCell/preceding-sibling::altova:table-cell) + 1"/>
						<xsl:variable name="nodeGridCol" as="node()" select="$nodeTableCell/ancestor::altova:table[1]/altova:TableGrid/altova:GridCol[$nGridCol]"/>
						<xsl:variable name="nodeTable" as="node()" select="$nodeTableCell/ancestor::altova:table[1]"/>
						<xsl:variable name="nColWidthPt" as="xs:double">
							<xsl:choose>
								<!-- If the column width is absolute -->
								<xsl:when test="$nodeGridCol/@altova:sType eq 'twips'">
									<xsl:sequence select="altova:MapTwipsToPoints(xs:integer($nodeGridCol/@altova:sWidth))"/>
								</xsl:when>
								<!-- If the column width is given in percent -->
								<xsl:when test="$nodeGridCol/@altova:sType eq 'percent'">
									<!-- Get the entire space inside the table -->
									<xsl:variable name="nResultPt" as="xs:double" select="altova:GetAvailableHorSpaceInParentPt($nodeTable/child::*[1])"/>
									<!-- Account for all left and right cell borders -->
									<xsl:variable name="nResultPt" as="xs:double" select="$nResultPt - sum($nodeTableCell/../altova:table-cell/altova:TableCellStyles/altova:Borders/altova:Left/altova:BorderWidthPt/@altova:nWidthPt)"/>
									<xsl:variable name="nResultPt" as="xs:double" select="$nResultPt - sum($nodeTableCell/../altova:table-cell/altova:TableCellStyles/altova:Borders/altova:Right/altova:BorderWidthPt/@altova:nWidthPt)"/>
									<!-- Account for (inner) border spacing -->
									<xsl:variable name="nCols" as="xs:integer" select="count($nodeTableCell/../altova:table-cell)"/>
									<xsl:variable name="nResultPt" as="xs:double" select="$nResultPt - ($nCols - 1) * $nodeTable/altova:TableStyles/@altova:nBorderSpacingPt"/>
									<!-- Apply percent -->
									<xsl:sequence select="$nResultPt * $nodeGridCol/@altova:sWidth div 100"/>
								</xsl:when>
								<!-- Column width is auto-fit -->
								<xsl:otherwise>
									<xsl:sequence select="altova:GetAvailableHorSpaceInParentPt($nodeCurr/..)"/>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:variable>
						<!-- Account for cell padding -->
						<xsl:variable name="nColWidthPt" as="xs:double" select="$nColWidthPt - sum($nodeCurr/altova:TableCellStyles/altova:CellPadding/(altova:Left|altova:Right)/@nPaddingPt)"/>
						<!-- Account for spans -->
						<xsl:variable name="nColWidthPt" as="xs:double" select="if (xs:integer($nodeTableCell/altova:TableCellStyles/@altova:nColSpan) gt 1) then sum(for $i in $nodeTableCell/following-sibling::altova:table-cell[$nodeTableCell/altova:TableCellStyles/@altova:nColSpan - 1] return altova:GetAvailableHorSpaceInParentPt($i)) else $nColWidthPt"/>
						<xsl:sequence select="$nColWidthPt"/>
					</xsl:when>
					<!-- Not inside a table: Use the document column width -->
					<xsl:otherwise>
						<xsl:sequence select="altova:GetAvailableDocumentColumnWidthPt($nodeCurr)"/>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:GetColorsFromCompositeStyles">
		<xsl:param name="altova:RootNode"/>
		<xsl:variable name="altova:seqStyleLists" select="$altova:RootNode//@altova:sCompositeStyles" as="xs:string*"/>
		<xsl:variable name="altova:seqStyles" select="for $StyleList in $altova:seqStyleLists return tokenize($StyleList, ';')" as="xs:string*"/>
		<xsl:variable name="altova:seqCompositeStyleColors" select="for $Style in $altova:seqStyles return if (index-of(('color', 'background-color'), normalize-space(substring-before($Style, ':')))) then normalize-space(substring-after($Style, ':')) else ()"/>
		<xsl:sequence select="$altova:seqCompositeStyleColors"/>
	</xsl:function>
	<xsl:function name="altova:GetFontsFromCompositeStyles">
		<xsl:param name="altova:RootNode"/>
		<xsl:variable name="altova:seqStyleLists" select="$altova:RootNode//@altova:sCompositeStyles" as="xs:string*"/>
		<xsl:variable name="altova:seqStyles" select="for $StyleList in $altova:seqStyleLists return tokenize($StyleList, ';')" as="xs:string*"/>
		<xsl:variable name="altova:seqCompositeStyleFonts" select="for $Style in $altova:seqStyles return if (normalize-space(substring-before($Style, ':')) eq 'font-family') then normalize-space(substring-after($Style, ':')) else ()"/>
		<xsl:sequence select="$altova:seqCompositeStyleFonts"/>
	</xsl:function>
	<xsl:function name="altova:GetGridColumnPosTw" as="xs:integer">
		<xsl:param name="nodeTable" as="node()"/>
		<xsl:param name="nodeTableRow" as="node()"/>
		<xsl:param name="nCol" as="xs:integer"/>
		<xsl:param name="nCols" as="xs:integer"/>
		<xsl:variable name="nodeGridCol" as="node()" select="$nodeTable/altova:TableGrid/altova:GridCol[$nCol]"/>
		<xsl:choose>
			<xsl:when test="$nodeGridCol/@altova:sType eq 'auto'">
				<xsl:sequence select="0"/>
			</xsl:when>
			<xsl:when test="$nodeGridCol/@altova:sType eq 'percent'">
				<xsl:sequence select="0"/>
			</xsl:when>
			<xsl:when test="$nodeGridCol/@altova:sType eq 'twips'">
				<xsl:variable name="nodeTableStyles" as="node()?" select="$nodeTable/altova:TableStyles"/>
				<xsl:variable name="nodeCell" as="node()" select="$nodeTableRow/altova:table-cell[$nCol]"/>
				<xsl:variable name="nodeCellStyles" as="node()?" select="$nodeCell/altova:TableCellStyles"/>
				<xsl:variable name="nodeCellPadding" as="node()?" select="$nodeCellStyles/altova:CellPadding"/>
				<xsl:variable name="nodeTableBorders" as="node()?" select="$nodeTableStyles/altova:Borders"/>
				<xsl:variable name="nodeCellBorders" as="node()?" select="$nodeCellStyles/altova:Borders"/>
				<!-- Content width -->
				<xsl:variable name="nGridPosPt" as="xs:double" select="altova:MapTwipsToPoints($nodeGridCol/@altova:sWidth)"/>
				<!-- Table indent -->
				<xsl:variable name="nGridPosPt" as="xs:double" select="if ($nCol eq 1) then $nGridPosPt + $nodeTableStyles/@altova:nLeftMarginPt else $nGridPosPt"/>
				<!-- Account for border-spacing applied to table -->
				<xsl:variable name="nGridPosPt" as="xs:double" select="if ($nodeTableStyles/@altova:sBorderCollapse eq 'separate' and $nodeTableStyles/@altova:nBorderSpacingPt and $nCol eq 1) then $nGridPosPt + $nodeTableStyles/@altova:nBorderSpacingPt div 2 else $nGridPosPt"/>
				<xsl:variable name="nGridPosPt" as="xs:double" select="if ($nodeTableStyles/@altova:sBorderCollapse eq 'separate' and $nodeTableStyles/@altova:nBorderSpacingPt) then $nGridPosPt + $nodeTableStyles/@altova:nBorderSpacingPt else $nGridPosPt"/>
				<xsl:variable name="nGridPosPt" as="xs:double" select="if ($nodeTableStyles/@altova:sBorderCollapse eq 'separate' and $nodeTableStyles/@altova:nBorderSpacingPt and $nCol eq $nCols) then $nGridPosPt + $nodeTableStyles/@altova:nBorderSpacingPt div 2 else $nGridPosPt"/>
				<!-- Account for left and right cell padding (possibly inherited from the table's cellpadding) -->
				<xsl:variable name="nGridPosPt" as="xs:double" select="if ($nodeCellPadding/altova:Left) then $nGridPosPt + $nodeCellPadding/altova:Left/@nPaddingPt else if ($nodeTableStyles/@altova:nCellPaddingPt) then $nGridPosPt + $nodeTableStyles/@altova:nCellPaddingPt else $nGridPosPt"/>
				<xsl:variable name="nGridPosPt" as="xs:double" select="if ($nodeCellPadding/altova:Right) then $nGridPosPt + $nodeCellPadding/altova:Right/@nPaddingPt else if ($nodeTableStyles/@altova:nCellPaddingPt) then $nGridPosPt + $nodeTableStyles/@altova:nCellPaddingPt else $nGridPosPt"/>
				<!-- Account for left and right table border width -->
				<xsl:variable name="nGridPosPt" as="xs:double" select="if ($nCol eq 1 and $nodeTableBorders/altova:Left) then $nGridPosPt + $nodeTableBorders/altova:Left/@altova:nWidthPt div 2 else $nGridPosPt"/>
				<xsl:variable name="nGridPosPt" as="xs:double" select="if ($nCol eq $nCols and $nodeTableBorders/altova:Right) then $nGridPosPt + $nodeTableBorders/altova:Right/@altova:nWidthPt div 2 else $nGridPosPt"/>
				<!-- Account for left and right cell border width -->
				<xsl:variable name="nGridPosPt" as="xs:double" select="if ($nodeCellBorders/altova:Left/altova:BorderWidthPt/@altova:nWidthPt) then $nGridPosPt + $nodeCellBorders/altova:Left/altova:BorderWidthPt//@altova:nWidthPt else $nGridPosPt"/>
				<xsl:variable name="nGridPosPt" as="xs:double" select="if ($nodeCellBorders/altova:Right/altova:BorderWidthPt/@altova:nWidthPt) then $nGridPosPt + $nodeCellBorders/altova:Right/altova:BorderWidthPt/@altova:nWidthPt else $nGridPosPt"/>
				<xsl:variable name="nGridPosTw" as="xs:integer" select="altova:MapPointsToTwips($nGridPosPt)"/>
				<xsl:sequence select="$nGridPosTw"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:message select="'altova:GetGridColumnPosTw: Unknown column width type.'" terminate="yes"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:get-list-table">
		<xsl:param name="nodeAltovaDocument" as="node()"/>
		<xsl:if test="exists($nodeAltovaDocument//altova:list)">
			<xsl:text>{\*\listtable</xsl:text>
			<xsl:for-each select="$nodeAltovaDocument//altova:list">
				<xsl:choose>
					<xsl:when test="@altova:ordered=1">
						<xsl:text>{\list\listhybrid{\listlevel\leveljcn0\levelfollow0\levelstartat</xsl:text>
						<xsl:value-of select="if (@start) then @start else 1"/>
						<xsl:choose>
							<xsl:when test="@type='1'">
								<xsl:text>\levelnfcn0</xsl:text>
							</xsl:when>
							<xsl:when test="@type='I'">
								<xsl:text>\levelnfcn1</xsl:text>
							</xsl:when>
							<xsl:when test="@type='i'">
								<xsl:text>\levelnfcn2</xsl:text>
							</xsl:when>
							<xsl:when test="@type='A'">
								<xsl:text>\levelnfcn3</xsl:text>
							</xsl:when>
							<xsl:when test="@type='a'">
								<xsl:text>\levelnfcn4</xsl:text>
							</xsl:when>
							<xsl:otherwise>
								<xsl:text>\levelnfcn0</xsl:text>
							</xsl:otherwise>
						</xsl:choose>
						<xsl:text>{\leveltext\'02\'00.;}{\levelnumbers\'01;}}{\listname ;}\listid</xsl:text>
					</xsl:when>
					<xsl:otherwise>
						<xsl:variable name="type" select="translate(@type, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz' )"/>
						<xsl:text>{\list\listhybrid{\listlevel\leveljcn0\levelfollow0\levelstartat1\levelnfcn23</xsl:text>
						<xsl:choose>
							<xsl:when test="$type='none'">
								<xsl:text>{\leveltext\'00;}{\levelnumbers;}\f2}</xsl:text>
							</xsl:when>
							<xsl:when test="$type='circle'">
								<xsl:text>{\leveltext\'01o;}{\levelnumbers;}\f2}</xsl:text>
							</xsl:when>
							<xsl:when test="$type='disc'">
								<xsl:text>{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f2}</xsl:text>
							</xsl:when>
							<xsl:when test="$type='square'">
								<xsl:text>{\leveltext\'01\u-3929 ?;}{\levelnumbers;}\f3}</xsl:text>
							</xsl:when>
							<xsl:otherwise>
								<xsl:text>{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f2}</xsl:text>
							</xsl:otherwise>
						</xsl:choose>
						<xsl:text>{\listname ;}\listid</xsl:text>
					</xsl:otherwise>
				</xsl:choose>
				<xsl:value-of select="position()"/>
				<xsl:text>}</xsl:text>
			</xsl:for-each>
			<xsl:text>}{\*\listoverridetable</xsl:text>
			<xsl:for-each select="$nodeAltovaDocument//altova:list">
				<xsl:text>{\listoverride\listid</xsl:text>
				<xsl:value-of select="position()"/>
				<xsl:text>\ls</xsl:text>
				<xsl:value-of select="position()"/>
				<xsl:text>}</xsl:text>
			</xsl:for-each>
			<xsl:text>}</xsl:text>
		</xsl:if>
	</xsl:function>
	<xsl:function name="altova:get-paragraph-ancestors-styles">
		<xsl:param name="ancestors"/>
		<!--		
		<xsl:value-of select="string-join(for $i in 1 to count($ancestors) return altova:get-paragraph-styles($ancestors[count($ancestors) - $i + 1]),'')"/>
		-->
		<xsl:variable name="sStyles" select="string-join(for $i in 1 to count($ancestors) return altova:get-paragraph-styles($ancestors[count($ancestors) - $i + 1]),'')"/>
		<xsl:value-of select="replace($sStyles, '\\pagebb', '')"/>
	</xsl:function>
	<xsl:function name="altova:get-paragraph-styles">
		<xsl:param name="paragraph"/>
		<xsl:for-each select="$paragraph/@*">
			<xsl:variable name="attribute-name" select="name(.)"/>
			<xsl:choose>
				<xsl:when test="$attribute-name = 'altova:paragraph-styles'">
					<xsl:value-of select="."/>
				</xsl:when>
				<xsl:when test="$attribute-name = 'altova:character-styles'">
					<xsl:value-of select="."/>
				</xsl:when>
				<xsl:when test="$attribute-name = 'background-color'">
					<xsl:value-of select="if (. != 'transparent') then concat('\cbpat',index-of($altova:seqColorsInUseNormalizedValidated,upper-case(.))) else ()"/>
				</xsl:when>
				<xsl:when test="$attribute-name = 'color'">
					<xsl:value-of select="if (. != 'transparent') then concat('\cf',index-of($altova:seqColorsInUseNormalizedValidated,upper-case(.))) else ()"/>
				</xsl:when>
			</xsl:choose>
		</xsl:for-each>
	</xsl:function>
	<xsl:function name="altova:IsBlockLevelElement" as="xs:boolean">
		<xsl:param name="nodeCurr" as="node()"/>
		<xsl:value-of select="not(empty(index-of(('altova:line', 'altova:list', 'altova:list-item', 'altova:new-line', 'altova:page-break', 'altova:paragraph', 'altova:table', 'altova:table-row'), name($nodeCurr))))"/>
	</xsl:function>
	<xsl:function name="altova:IsColorValid" as="xs:boolean">
		<xsl:param name="sColor" as="xs:string"/>
		<xsl:variable name="sSixHexDigits" as="xs:string" select="altova:MapColorAnyStringToSixHexDigits($sColor)"/>
		<xsl:variable name="seqRgbDec" as="xs:integer*">
			<xsl:choose>
				<xsl:when test="$sSixHexDigits = ''">
					<xsl:sequence select="()"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:sequence select="altova:MapColorSixHexDigitsToDecRgbSeq($sSixHexDigits)"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:sequence select="not(empty($seqRgbDec))"/>
	</xsl:function>
	<xsl:function name="altova:IsFirstChildIn" as="xs:boolean">
		<xsl:param name="nodeCurr" as="node()"/>
		<xsl:param name="sElemName" as="xs:string"/>
		<xsl:value-of select="$nodeCurr/position() = 1 and string(node-name($nodeCurr/..)) = $sElemName"/>
	</xsl:function>
	<xsl:function name="altova:IsInParagraphAfterFlattening" as="xs:boolean">
		<xsl:param name="nodeCurr" as="node()"/>
		<xsl:variable name="nodePrecedingParagraph" as="node()*" select="($nodeCurr/preceding::altova:paragraph[1] | $nodeCurr/ancestor::altova:paragraph[1])[last()]"/>
		<xsl:variable name="bIsParent" as="xs:boolean" select="exists($nodeCurr/ancestor::*[. is $nodePrecedingParagraph])"/>
		<xsl:value-of select="$bIsParent"/>
	</xsl:function>
	<xsl:function name="altova:MapColor255OrPercentTo255" as="xs:integer?">
		<xsl:param name="sColor" as="xs:string"/>
		<xsl:choose>
			<!-- 0 - 100% -->
			<xsl:when test="matches($sColor, '^(\d{1,2}|100)%$')">
				<xsl:sequence select="xs:integer(round(xs:integer(substring-before($sColor, '%')) * 255 div 100))"/>
			</xsl:when>
			<!-- 0 - 255 -->
			<xsl:when test="matches($sColor, '^\d{1,3}$')">
				<xsl:variable name="nValue" as="xs:integer" select="xs:integer($sColor)"/>
				<xsl:if test="$nValue ge 0 and $nValue le 255">
					<xsl:sequence select="$nValue"/>
				</xsl:if>
			</xsl:when>
			<xsl:otherwise>
				<!-- Return an empty sequence -->
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:MapColorAnyStringToColorTableIndex" as="xs:integer">
		<xsl:param name="sColor" as="xs:string"/>
		<xsl:variable name="seqIndex" as="xs:integer*" select="index-of($altova:seqColorsInUseNormalizedValidated, upper-case($sColor))"/>
		<xsl:choose>
			<xsl:when test="empty($seqIndex)">
				<xsl:sequence select="-1"/>
			</xsl:when>
			<xsl:when test="count($seqIndex) &gt; 1">
				<xsl:message select="concat('--> MapColorAnyStringToColorTableIndex: Color &quot;', $sColor, '&quot; found more than once in color table.')"/>
				<xsl:value-of select="$seqIndex[1]"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$seqIndex[1]"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:MapColorAnyStringToShapePropertyValue" as="xs:integer">
		<xsl:param name="sColor" as="xs:string"/>
		<xsl:variable name="sSixHexDigits" as="xs:string" select="altova:MapColorAnyStringToSixHexDigits($sColor)"/>
		<xsl:variable name="nDecR" as="xs:integer" select="altova:MapTwoHexDigitsToDec(substring($sSixHexDigits, 1, 2))"/>
		<xsl:variable name="nDecG" as="xs:integer" select="altova:MapTwoHexDigitsToDec(substring($sSixHexDigits, 3, 2))"/>
		<xsl:variable name="nDecB" as="xs:integer" select="altova:MapTwoHexDigitsToDec(substring($sSixHexDigits, 5, 2))"/>
		<xsl:sequence select="$nDecB * 65536 + $nDecG * 256 + $nDecR"/>
	</xsl:function>
	<xsl:function name="altova:MapColorAnyStringToShapePropertyValue_AbsentOk" as="xs:integer">
		<xsl:param name="sColor" as="xs:string?"/>
		<xsl:choose>
			<xsl:when test="not($sColor)">000000</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="altova:MapColorAnyStringToShapePropertyValue($sColor)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:MapColorAnyStringToSixHexDigits" as="xs:string">
		<xsl:param name="sColor" as="xs:string"/>
		<xsl:variable name="sColorUpper" as="xs:string" select="upper-case($sColor)"/>
		<xsl:choose>
			<xsl:when test="matches($sColorUpper, '^#[0-9A-F]{6}$')">
				<xsl:value-of select="upper-case(substring($sColorUpper, 2))"/>
			</xsl:when>
			<xsl:when test="matches($sColorUpper, '^#[0-9A-F]{3}$')">
				<xsl:value-of select="upper-case(concat(substring($sColorUpper, 2, 1), substring($sColorUpper, 2, 1), substring($sColorUpper, 3, 1), substring($sColorUpper, 3, 1), substring($sColorUpper, 4, 1), substring($sColorUpper, 4, 1)))"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:variable name="sSixHexDigits" as="xs:string?" select="altova:MapColorRgbToSixHexDigits($sColorUpper)"/>
				<xsl:choose>
					<!-- Format 'RGB(...)' -->
					<xsl:when test="$sSixHexDigits">
						<xsl:sequence select="$sSixHexDigits"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:variable name="nIndex" select="index-of($altova:seqPredefinedColorNames, $sColorUpper)"/>
						<xsl:choose>
							<!-- Format 'antiquewhite' -->
							<xsl:when test="$nIndex &gt;= 0">
								<xsl:value-of select="$altova:seqPredefinedColorHexValues[$nIndex]"/>
							</xsl:when>
							<xsl:otherwise>
								<xsl:value-of select="''"/>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:MapColorRgbToSixHexDigits" as="xs:string?">
		<xsl:param name="sColorUpper" as="xs:string"/>
		<xsl:variable name="sDelimitedValues" as="xs:string?" select="replace(replace($sColorUpper, '^RGB\(', ''), '\)$', '')"/>
		<xsl:variable name="seqValues" as="xs:string*" select="tokenize($sDelimitedValues, ',\s*')"/>
		<xsl:if test="count($seqValues) = 3">
			<xsl:variable name="nRed" as="xs:integer*" select="altova:MapColor255OrPercentTo255($seqValues[1])"/>
			<xsl:variable name="nGreen" as="xs:integer*" select="altova:MapColor255OrPercentTo255($seqValues[2])"/>
			<xsl:variable name="nBlue" as="xs:integer*" select="altova:MapColor255OrPercentTo255($seqValues[3])"/>
			<xsl:if test="not(empty($nRed)) and not(empty($nGreen)) and not(empty($nBlue))">
				<xsl:sequence select="concat(altova:MapDecToHex($nRed, 2), altova:MapDecToHex($nGreen, 2), altova:MapDecToHex($nBlue, 2))"/>
			</xsl:if>
		</xsl:if>
	</xsl:function>
	<xsl:function name="altova:MapColorSixHexDigitsToDecRgbSeq" as="xs:integer*">
		<xsl:param name="sSixHexDigits" as="xs:string"/>
		<xsl:variable name="nDecR" as="xs:integer" select="altova:MapTwoHexDigitsToDec(substring($sSixHexDigits, 1, 2))"/>
		<xsl:variable name="nDecG" as="xs:integer" select="altova:MapTwoHexDigitsToDec(substring($sSixHexDigits, 3, 2))"/>
		<xsl:variable name="nDecB" as="xs:integer" select="altova:MapTwoHexDigitsToDec(substring($sSixHexDigits, 5, 2))"/>
		<xsl:choose>
			<xsl:when test="$nDecR &gt;= 0 and $nDecR &lt;= 255 and $nDecG &gt;= 0 and $nDecG &lt;= 255 and $nDecB &gt;= 0 and $nDecB &lt;= 255">
				<xsl:sequence select="($nDecR, $nDecG, $nDecB)"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:sequence select="()"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:MapCssToBorderWidthPt" as="xs:double">
		<xsl:param name="sCssBorderWidth" as="xs:string"/>
		<xsl:choose>
			<xsl:when test="$sCssBorderWidth = 'medium'">
				<xsl:sequence select="3"/>
			</xsl:when>
			<xsl:when test="$sCssBorderWidth = 'thick'">
				<xsl:sequence select="4"/>
			</xsl:when>
			<xsl:when test="$sCssBorderWidth = 'thin'">
				<xsl:sequence select="1.5"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:sequence select="altova:MapLengthUnitToPointsUnrounded($sCssBorderWidth)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:MapCssToShapeDashingStyle" as="xs:integer">
		<xsl:param name="sCssBorderStyle" as="xs:string"/>
		<xsl:choose>
			<xsl:when test="exists(index-of(('solid', 'double', 'groove', 'inset', 'outset', 'ridge'), $sCssBorderStyle))">
				<xsl:sequence select="0"/>
			</xsl:when>
			<xsl:when test="$sCssBorderStyle = 'dashed'">
				<xsl:sequence select="1"/>
			</xsl:when>
			<xsl:when test="$sCssBorderStyle = 'dotted'">
				<xsl:sequence select="2"/>
			</xsl:when>
			<xsl:when test="$sCssBorderStyle = 'none'">
				<!-- 'none' is not a valid option. The border is turned off via {\sp{\sn fLine]{\sv 0}} -->
				<xsl:sequence select="0"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:message select="concat('&quot;', $sCssBorderStyle, '&quot; is not a valid border style; using default.')"/>
				<xsl:sequence select="0"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:MapCssToShapeDashingStyle_AbsentOk" as="xs:double">
		<xsl:param name="sCssBorderStyle" as="xs:string?"/>
		<xsl:choose>
			<xsl:when test="not($sCssBorderStyle)">0</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="altova:MapCssToShapeDashingStyle($sCssBorderStyle)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:MapCssToShapeLineStyle" as="xs:integer">
		<xsl:param name="sCssBorderStyle" as="xs:string"/>
		<xsl:choose>
			<xsl:when test="exists(index-of(('double', 'groove', 'inset', 'outset', 'ridge'), $sCssBorderStyle))">
				<xsl:sequence select="1"/>
			</xsl:when>
			<xsl:when test="exists(index-of(('dashed', 'dotted', 'none', 'solid'), $sCssBorderStyle))">
				<xsl:sequence select="0"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:message select="concat('&quot;', $sCssBorderStyle, '&quot; is not a valid border style; using default.')"/>
				<xsl:sequence select="0"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:MapDecToHex" as="xs:string">
		<xsl:param name="nDecValue" as="xs:integer"/>
		<xsl:param name="nMinLen" as="xs:integer"/>
		<xsl:choose>
			<xsl:when test="$nDecValue &lt; 0">
				<xsl:message select="concat('MapDecToHex: Bad value &quot;', $nDecValue, '&quot;')"/>
				<xsl:text>'0'</xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="altova:StringPadLeft(altova:MapDecToHexRecursive($nDecValue), $nMinLen, '0')"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:MapDecToHexRecursive" as="xs:string">
		<xsl:param name="nDecValue" as="xs:integer"/>
		<xsl:choose>
			<xsl:when test="$nDecValue &lt; 16">
				<xsl:value-of select="$altova:seqHexDigits[$nDecValue + 1]"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="concat(altova:MapDecToHexRecursive($nDecValue idiv 16), altova:MapDecToHexRecursive($nDecValue mod 16))"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:MapFileExtToImageTypeControlWord" as="xs:string">
		<xsl:param name="sFileExt" as="xs:string"/>
		<xsl:variable name="sFileExtLower" as="xs:string" select="lower-case($sFileExt)"/>
		<xsl:choose>
			<xsl:when test="$sFileExtLower = 'emf'">
				<xsl:text>\emfblip</xsl:text>
			</xsl:when>
			<xsl:when test="$sFileExtLower = 'jpg' or $sFileExtLower = 'jpeg'">
				<xsl:text>\jpegblip</xsl:text>
			</xsl:when>
			<xsl:when test="$sFileExtLower = 'png'">
				<xsl:text>\pngblip</xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:sequence select="''"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:MapFontFamilyToFontIndex">
		<xsl:param name="sFontFamily" as="xs:string"/>
		<xsl:variable name="seqIndex" as="xs:integer" select="index-of($altova:seqFontsInUse, $sFontFamily)"/>
		<xsl:choose>
			<xsl:when test="empty($seqIndex)">
				<xsl:message select="concat('MapFontFamilyToFontIndex: Font family &quot;', $sFontFamily, '&quot; not found in font table, using default.')"/>
				<xsl:value-of select="0"/>
			</xsl:when>
			<xsl:when test="count($seqIndex) &gt; 1">
				<xsl:message select="concat('MapFontFamilyToFontIndex: Font family &quot;', $sFontFamily, '&quot; found more than once in font table.')"/>
				<xsl:value-of select="$seqIndex[1] - 1"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$seqIndex[1] - 1"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:MapFontSizeToPointsUnrounded" as="xs:double">
		<xsl:param name="sFontSize" as="xs:string"/>
		<xsl:variable name="sFontSizeNormalized" as="xs:string" select="normalize-space($sFontSize)"/>
		<xsl:choose>
			<xsl:when test="$sFontSizeNormalized = 'xx-small'">
				<xsl:value-of select="altova:ScaleFont($altova:nDefaultFontSizePt, -3)"/>
			</xsl:when>
			<xsl:when test="$sFontSizeNormalized = 'x-small'">
				<xsl:value-of select="altova:ScaleFont($altova:nDefaultFontSizePt, -2)"/>
			</xsl:when>
			<xsl:when test="$sFontSizeNormalized = 'small'">
				<xsl:value-of select="altova:ScaleFont($altova:nDefaultFontSizePt, -1)"/>
			</xsl:when>
			<xsl:when test="$sFontSizeNormalized = 'medium'">
				<xsl:value-of select="altova:ScaleFont($altova:nDefaultFontSizePt, 0)"/>
			</xsl:when>
			<xsl:when test="$sFontSizeNormalized = 'large'">
				<xsl:value-of select="altova:ScaleFont($altova:nDefaultFontSizePt, 1)"/>
			</xsl:when>
			<xsl:when test="$sFontSizeNormalized = 'x-large'">
				<xsl:value-of select="altova:ScaleFont($altova:nDefaultFontSizePt, 2)"/>
			</xsl:when>
			<xsl:when test="$sFontSizeNormalized = 'xx-large'">
				<xsl:value-of select="altova:ScaleFont($altova:nDefaultFontSizePt, 3)"/>
			</xsl:when>
			<xsl:when test="$sFontSizeNormalized = 'smaller'">
				<xsl:message select="concat('MapFontSizeToPointsUnrounded: Font size &quot;', $sFontSize, '&quot; not supported, using default.')"/>
				<xsl:value-of select="$altova:nDefaultFontSizePt"/>
			</xsl:when>
			<xsl:when test="$sFontSizeNormalized = 'larger'">
				<xsl:message select="concat('MapFontSizeToPointsUnrounded: Font size &quot;', $sFontSize, '&quot; not supported, using default.')"/>
				<xsl:value-of select="$altova:nDefaultFontSizePt"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:variable name="nPoints" as="xs:double" select="altova:MapFontValueAndUnitToPointsUnrounded($sFontSizeNormalized)"/>
				<xsl:choose>
					<xsl:when test="$nPoints &gt;= 0">
						<xsl:value-of select="$nPoints"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:message select="concat('MapFontSizeToPoints: Unknown font size &quot;', $sFontSize, '&quot;, using default.')"/>
						<xsl:value-of select="$altova:nDefaultFontSizePt"/>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:MapFontStyleToControlWord">
		<xsl:param name="sFontStyle" as="xs:string"/>
		<xsl:choose>
			<xsl:when test="$sFontStyle = 'italic'">
				<xsl:value-of select="'\i'"/>
			</xsl:when>
			<xsl:when test="$sFontStyle = 'oblique'">
				<xsl:value-of select="'\i'"/>
			</xsl:when>
			<xsl:when test="$sFontStyle = 'normal'">
				<xsl:value-of select="'\i0'"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:message select="concat('MapFontStyleToControlWord: Unknown font style &quot;', $sFontStyle, '&quot;, using default.')"/>
				<xsl:value-of select="''"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:MapFontValueAndUnitToPointsUnrounded" as="xs:double">
		<xsl:param name="sLength" as="xs:string"/>
		<xsl:variable name="sLengthNormalized" as="xs:string" select="normalize-space($sLength)"/>
		<xsl:choose>
			<xsl:when test="matches($sLengthNormalized, '^\d+(\.\d+)?[a-zA-Z%]+$')">
				<xsl:variable name="nValue" select="number(replace($sLengthNormalized, '([a-zA-Z%])+', ''))"/>
				<xsl:variable name="sUnit" select="replace($sLengthNormalized, '(\d+(\.\d+)?)', '')"/>
				<xsl:choose>
					<xsl:when test="$sUnit = '%'">
						<xsl:value-of select="altova:MapUnitPercentToPt($nValue)"/>
					</xsl:when>
					<xsl:when test="$sUnit = 'cm'">
						<xsl:value-of select="altova:MapUnitCmToPt($nValue)"/>
					</xsl:when>
					<xsl:when test="$sUnit = 'em'">
						<xsl:value-of select="altova:MapUnitEmToPt($nValue)"/>
					</xsl:when>
					<xsl:when test="$sUnit = 'ex'">
						<xsl:value-of select="altova:MapUnitExToPt($nValue)"/>
					</xsl:when>
					<xsl:when test="$sUnit = 'in'">
						<xsl:value-of select="altova:MapUnitInToPt($nValue)"/>
					</xsl:when>
					<xsl:when test="$sUnit = 'mm'">
						<xsl:value-of select="altova:MapUnitMmToPt($nValue)"/>
					</xsl:when>
					<xsl:when test="$sUnit = 'pc'">
						<xsl:value-of select="altova:MapUnitPcToPt($nValue)"/>
					</xsl:when>
					<xsl:when test="$sUnit = 'pt'">
						<xsl:value-of select="$nValue"/>
					</xsl:when>
					<xsl:when test="$sUnit = 'px'">
						<xsl:value-of select="altova:MapUnitPxToPt($nValue)"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="-1"/>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="-1"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:MapFontVariantToControlWord">
		<xsl:param name="sFontVariant" as="xs:string"/>
		<xsl:choose>
			<xsl:when test="$sFontVariant = 'small-caps'">
				<xsl:value-of select="'\scaps'"/>
			</xsl:when>
			<xsl:when test="$sFontVariant = 'normal'">
				<xsl:value-of select="'\scaps0'"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:message select="concat('MapFontVariantToControlWord: Unknown font variant &quot;', $sFontVariant, '&quot;, using default.')"/>
				<xsl:value-of select="'\scaps0'"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:MapFontWeightToControlWord">
		<xsl:param name="sFontWeight" as="xs:string"/>
		<xsl:choose>
			<xsl:when test="$sFontWeight = 'normal'">
				<xsl:value-of select="'\b0'"/>
			</xsl:when>
			<xsl:when test="$sFontWeight = 'bold'">
				<xsl:value-of select="'\b'"/>
			</xsl:when>
			<xsl:when test="$sFontWeight = 'bolder'">
				<xsl:value-of select="'\b'"/>
			</xsl:when>
			<xsl:when test="$sFontWeight = 'lighter'">
				<xsl:value-of select="'\b0'"/>
			</xsl:when>
			<xsl:when test="$sFontWeight = '100'">
				<xsl:value-of select="'\b0'"/>
			</xsl:when>
			<xsl:when test="$sFontWeight = '200'">
				<xsl:value-of select="'\b0'"/>
			</xsl:when>
			<xsl:when test="$sFontWeight = '300'">
				<xsl:value-of select="'\b0'"/>
			</xsl:when>
			<xsl:when test="$sFontWeight = '400'">
				<xsl:value-of select="'\b0'"/>
			</xsl:when>
			<xsl:when test="$sFontWeight = '500'">
				<xsl:value-of select="'\b0'"/>
			</xsl:when>
			<xsl:when test="$sFontWeight = '600'">
				<xsl:value-of select="'\b'"/>
			</xsl:when>
			<xsl:when test="$sFontWeight = '700'">
				<xsl:value-of select="'\b'"/>
			</xsl:when>
			<xsl:when test="$sFontWeight = '800'">
				<xsl:value-of select="'\b'"/>
			</xsl:when>
			<xsl:when test="$sFontWeight = '900'">
				<xsl:value-of select="'\b'"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:message select="concat('MapFontWeightToControlWord: Unknown weight &quot;', $sFontWeight, '&quot;, using default.')"/>
				<xsl:value-of select="'\b0'"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:MapHexDigitToDec">
		<xsl:param name="sHexDigit" as="xs:string"/>
		<xsl:variable name="seqIndex" select="index-of($altova:seqHexDigits, $sHexDigit)"/>
		<xsl:choose>
			<xsl:when test="$seqIndex">
				<xsl:value-of select="$seqIndex[1] - 1"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="-1"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:MapImageDimensionToControlWord" as="xs:string">
		<xsl:param name="sValueAndUnit" as="xs:string"/>
		<xsl:param name="sControlWordAbs" as="xs:string"/>
		<xsl:param name="sControlWordRel" as="xs:string"/>
		<xsl:value-of select="concat($sControlWordAbs, altova:MapPointsToTwips(altova:MapLengthUnitToPointsUnrounded($sValueAndUnit)))"/>
	</xsl:function>
	<xsl:function name="altova:MapImageHeightToControlWord" as="xs:string">
		<xsl:param name="sValueAndUnit" as="xs:string"/>
		<xsl:value-of select="altova:MapImageDimensionToControlWord($sValueAndUnit, '\pichgoal', '\picscaley')"/>
	</xsl:function>
	<xsl:function name="altova:MapImageWidthToControlWord" as="xs:string">
		<xsl:param name="sValueAndUnit" as="xs:string"/>
		<xsl:value-of select="altova:MapImageDimensionToControlWord($sValueAndUnit, '\picwgoal', '\picscalex')"/>
	</xsl:function>
	<xsl:function name="altova:MapLengthUnitToEmu">
		<xsl:param name="sLength" as="xs:string"/>
		<xsl:variable name="nPoints" as="xs:double" select="altova:MapLengthUnitToPointsUnrounded($sLength)"/>
		<xsl:sequence select="altova:MapUnitPtToEmu($nPoints)"/>
	</xsl:function>
	<xsl:function name="altova:MapLengthUnitToPointsUnrounded" as="xs:double">
		<xsl:param name="sLength" as="xs:string"/>
		<xsl:variable name="sLengthNormalized" as="xs:string" select="normalize-space($sLength)"/>
		<xsl:choose>
			<xsl:when test="matches($sLengthNormalized, '^\d+(\.\d+)?[a-zA-Z%]+$')">
				<xsl:variable name="nValue" select="number(replace($sLengthNormalized, '([a-zA-Z%])+', ''))"/>
				<xsl:variable name="sUnit" select="replace($sLengthNormalized, '(\d+(\.\d+)?)', '')"/>
				<xsl:choose>
					<xsl:when test="$sUnit = 'cm'">
						<xsl:value-of select="altova:MapUnitCmToPt($nValue)"/>
					</xsl:when>
					<xsl:when test="$sUnit = 'in'">
						<xsl:value-of select="altova:MapUnitInToPt($nValue)"/>
					</xsl:when>
					<xsl:when test="$sUnit = 'mm'">
						<xsl:value-of select="altova:MapUnitMmToPt($nValue)"/>
					</xsl:when>
					<xsl:when test="$sUnit = 'pc'">
						<xsl:value-of select="altova:MapUnitPcToPt($nValue)"/>
					</xsl:when>
					<xsl:when test="$sUnit = 'pt'">
						<xsl:value-of select="$nValue"/>
					</xsl:when>
					<xsl:when test="$sUnit = 'px'">
						<xsl:value-of select="altova:MapUnitPxToPt($nValue)"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="-1"/>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="-1"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:MapLengthUnitToPointsUnrounded_AbsentOk" as="xs:double">
		<xsl:param name="sLength" as="xs:string?"/>
		<xsl:choose>
			<xsl:when test="not($sLength)">0</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="altova:MapLengthUnitToPointsUnrounded($sLength)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:MapLineHeightToTwips" as="xs:integer">
		<xsl:param name="sLineHeight" as="xs:string"/>
		<xsl:choose>
			<xsl:when test="$sLineHeight eq 'normal'">
				<xsl:value-of select="0"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:variable name="nLengthPt" select="altova:MapLengthUnitToPointsUnrounded($sLineHeight)" as="xs:double"/>
				<xsl:value-of select="altova:MapPointsToTwips($nLengthPt)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:MapPointsToTwips" as="xs:integer">
		<xsl:param name="nPoints" as="xs:double"/>
		<xsl:value-of select="round($nPoints * $altova:nTwipsPerPt)"/>
	</xsl:function>
	<xsl:function name="altova:MapTextAlignToControlWord">
		<xsl:param name="sTextAlign" as="xs:string"/>
		<xsl:choose>
			<xsl:when test="$sTextAlign = 'left'">
				<xsl:value-of select="'\ql'"/>
			</xsl:when>
			<xsl:when test="$sTextAlign = 'right'">
				<xsl:value-of select="'\qr'"/>
			</xsl:when>
			<xsl:when test="$sTextAlign = 'center'">
				<xsl:value-of select="'\qc'"/>
			</xsl:when>
			<xsl:when test="$sTextAlign = 'justify'">
				<xsl:value-of select="'\qj'"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:message select="concat('MapTextAlignToControlWord: Unknown text alignment &quot;', $sTextAlign, '&quot;, using default.')"/>
				<xsl:value-of select="'\ql'"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:MapTextDecorationToControlWord">
		<xsl:param name="sTextDecoration" as="xs:string"/>
		<xsl:choose>
			<xsl:when test="$sTextDecoration = 'none'">
				<xsl:value-of select="'\ul0\strike0'"/>
			</xsl:when>
			<xsl:when test="$sTextDecoration = 'underline'">
				<xsl:value-of select="'\ul'"/>
			</xsl:when>
			<xsl:when test="$sTextDecoration = 'overline'">
				<xsl:message select="concat('MapTextDecorationToControlWord: Text decoration &quot;', $sTextDecoration, '&quot; not supported, using default.')"/>
				<xsl:value-of select="''"/>
			</xsl:when>
			<xsl:when test="$sTextDecoration = 'line-through'">
				<xsl:value-of select="'\strike'"/>
			</xsl:when>
			<xsl:when test="$sTextDecoration = 'blink'">
				<xsl:message select="concat('MapTextDecorationToControlWord: Text decoration &quot;', $sTextDecoration, '&quot; not supported, using default.')"/>
				<xsl:value-of select="''"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:message select="concat('MapTextDecorationToControlWord: Unknown text decoration &quot;', $sTextDecoration, '&quot;, using default.')"/>
				<xsl:value-of select="'\ul0\strike0'"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:MapTwipsToPoints" as="xs:double">
		<xsl:param name="nTwips" as="xs:integer"/>
		<xsl:value-of select="$nTwips div $altova:nTwipsPerPt"/>
	</xsl:function>
	<xsl:function name="altova:MapTwoHexDigitsToDec" as="xs:integer">
		<xsl:param name="sTwoHexDigits" as="xs:string"/>
		<xsl:variable name="nDigitHigh" as="xs:integer" select="altova:MapHexDigitToDec(substring($sTwoHexDigits, 1, 1))"/>
		<xsl:variable name="nDigitLow" as="xs:integer" select="altova:MapHexDigitToDec(substring($sTwoHexDigits, 2, 1))"/>
		<xsl:choose>
			<xsl:when test="$nDigitHigh &gt;= 0 and $nDigitHigh &lt; 16 and $nDigitLow &gt;= 0 and $nDigitLow &lt; 16">
				<xsl:sequence select="$nDigitHigh * 16 + $nDigitLow"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:sequence select="-1"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:MapUnitPercentToPt" as="xs:double">
		<xsl:param name="nPercent" as="xs:double"/>
		<xsl:sequence select="$nPercent div 100 * $altova:nDefaultFontSizePt"/>
	</xsl:function>
	<xsl:function name="altova:MapUnitCmToPt" as="xs:double">
		<xsl:param name="nCm" as="xs:double"/>
		<xsl:sequence select="altova:MapUnitInToPt($nCm div $altova:nCmPerIn)"/>
	</xsl:function>
	<xsl:function name="altova:MapUnitEmToPt" as="xs:double">
		<xsl:param name="nEm" as="xs:double"/>
		<xsl:sequence select="altova:MapUnitPercentToPt($nEm * $altova:nPercentPerEm)"/>
	</xsl:function>
	<xsl:function name="altova:MapUnitExToPt" as="xs:double">
		<xsl:param name="nEx" as="xs:double"/>
		<xsl:sequence select="altova:MapUnitPercentToPt($nEx * $altova:nPercentPerEx)"/>
	</xsl:function>
	<xsl:function name="altova:MapUnitInToPt" as="xs:double">
		<xsl:param name="nIn" as="xs:double"/>
		<xsl:sequence select="$nIn * $altova:nPtPerIn"/>
	</xsl:function>
	<xsl:function name="altova:MapUnitMmToPt" as="xs:double">
		<xsl:param name="nMm" as="xs:double"/>
		<xsl:sequence select="altova:MapUnitCmToPt($nMm div 10)"/>
	</xsl:function>
	<xsl:function name="altova:MapUnitPcToPt" as="xs:double">
		<xsl:param name="nPc" as="xs:double"/>
		<xsl:sequence select="$nPc * $altova:nPtPerPc"/>
	</xsl:function>
	<xsl:function name="altova:MapUnitPtToEmu" as="xs:integer">
		<xsl:param name="dPoints" as="xs:double"/>
		<xsl:sequence select="xs:integer(round($dPoints * $altova:nEmuPerPoint))"/>
	</xsl:function>
	<xsl:function name="altova:MapUnitPxToPt" as="xs:double">
		<xsl:param name="nPx" as="xs:double"/>
		<xsl:sequence select="altova:MapUnitInToPt($nPx div $altova:nPxPerIn)"/>
	</xsl:function>
	<xsl:function name="altova:NormalizeFilePath" as="xs:string">
		<xsl:param name="sPath" as="xs:string"/>
		<xsl:variable name="sPathPrefixed" as="xs:string" select="if (substring($sPath, 2, 1) = ':') then concat('file:///', $sPath) else $sPath"/>
		<xsl:variable name="sPathSlashesNormalized" as="xs:string" select="altova:NormalizeSlashes($sPathPrefixed)"/>
		<xsl:variable name="sPathUnicode" as="xs:string" select="altova:ConvertToUnicode($sPathSlashesNormalized)"/>
		<xsl:value-of select="$sPathUnicode"/>
	</xsl:function>
	<xsl:function name="altova:NormalizeFilePathForEmbedding" as="xs:string">
		<xsl:param name="sPath" as="xs:string"/>
		<xsl:variable name="sUrl" select="replace($sPath, '\\', '/')"/>
		<xsl:variable name="sUrl2" select="replace($sUrl, ' ', '%20')"/>
		<xsl:value-of select="$sUrl2"/>
	</xsl:function>
	<xsl:function name="altova:NormalizeSlashes" as="xs:string">
		<xsl:param name="sPath" as="xs:string"/>
		<xsl:value-of select="translate($sPath, '&#x5c;', '/')"/>
	</xsl:function>
	<xsl:function name="altova:NormalizeUrlForLink" as="xs:string">
		<xsl:param name="sExternalPart" as="xs:string"/>
		<xsl:param name="sFragment" as="xs:string"/>
		<!-- Handle external part -->
		<xsl:variable name="altova:sExternalPartWithoutDrive" as="xs:string" select="if (substring(string($sExternalPart), 2, 1) = ':') then concat('file:///', $sExternalPart) else $sExternalPart"/>
		<xsl:variable name="altova:sExternalPartTranslated" as="xs:string" select="translate($altova:sExternalPartWithoutDrive, '&#x5c;', '/')"/>
		<!-- Empirically determined that '?' needs a preceding slash. So add one unless already present. -->
		<xsl:variable name="altova:sExternalPartQuestionMark" as="xs:string" select="if (starts-with($altova:sExternalPartTranslated, 'file:')) then $altova:sExternalPartTranslated else replace($altova:sExternalPartTranslated, '([^/])\?', '$1/?')"/>
		<xsl:variable name="altova:seqExternalPartCodePoints" as="xs:integer*" select="string-to-codepoints($altova:sExternalPartQuestionMark)"/>
		<xsl:variable name="altova:ExternalPartEncoded" as="xs:string" select="string-join(for $altova:CodePoint in $altova:seqExternalPartCodePoints return if ($altova:CodePoint &lt; 32) then ' ' else concat ('\u', string($altova:CodePoint), '?'), '')"/>
		<!-- Handle fragment -->
		<xsl:variable name="altova:seqFragmentCodePoints" as="xs:integer*" select="string-to-codepoints($sFragment)"/>
		<xsl:variable name="altova:sFragmentEncoded" as="xs:string" select="string-join(for $altova:CodePoint in $altova:seqFragmentCodePoints return if ($altova:CodePoint le 32) then '_' else concat('\u', string($altova:CodePoint), '?'), '')"/>
		<xsl:value-of select="concat($altova:ExternalPartEncoded, $altova:sFragmentEncoded)"/>
	</xsl:function>
	<xsl:function name="altova:ParseFilePath_GetExtension" as="xs:string">
		<xsl:param name="sPath" as="xs:string"/>
		<xsl:value-of select="replace($sPath, '.*\.', '')"/>
	</xsl:function>
	<xsl:function name="altova:ParseLengthToPointsOrPercent" as="item()+">
		<xsl:param name="sLength" as="xs:string"/>
		<xsl:variable name="sLengthNormalized" as="xs:string" select="normalize-space($sLength)"/>
		<xsl:choose>
			<xsl:when test="matches($sLengthNormalized, '^\d+(\.\d+)?[a-zA-Z%]+$')">
				<xsl:variable name="nValue" select="number(replace($sLengthNormalized, '([a-zA-Z%])+', ''))"/>
				<xsl:variable name="sUnit" select="replace($sLengthNormalized, '(\d+(\.\d+)?)', '')"/>
				<xsl:choose>
					<xsl:when test="$sUnit = '%'">
						<xsl:sequence select="($nValue, 'percent')"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:variable name="nWidthPt" select="altova:MapFontValueAndUnitToPointsUnrounded($sLength)"/>
						<xsl:choose>
							<xsl:when test="$nWidthPt eq -1">
								<xsl:sequence select="(0, 'auto')"/>
							</xsl:when>
							<xsl:otherwise>
								<xsl:sequence select="($nWidthPt, 'points')"/>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:when>
			<xsl:otherwise>
				<xsl:sequence select="(0, 'auto')"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:ResolveUrlForLink" as="xs:string">
		<xsl:param name="nodeAltovaLink" as="node()"/>
		<xsl:choose>
			<xsl:when test="not(string($nodeAltovaLink/@altova:Dest))">
				<!-- Don't return an empty string, otherwise Word will display an error text instead of the visible link text -->
				<xsl:value-of select="altova:NormalizeUrlForLink('', '#')"/>
			</xsl:when>
			<xsl:when test="substring($nodeAltovaLink/@altova:Dest, 1, 1) = '#'">
				<xsl:variable name="altova:nodeBookmark" as="node()?" select="$altova:DocumentMonolith/key('altova:BookmarksByName', substring($nodeAltovaLink/@altova:Dest, 2))[1]"/>
				<xsl:choose>
					<xsl:when test="empty($altova:nodeBookmark)">
						<!-- Don't return an empty string, otherwise Word will display an error text instead of the visible link text -->
						<xsl:value-of select="altova:NormalizeUrlForLink('', $nodeAltovaLink/@altova:Dest)"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:variable name="altova:SourceDocument" as="node()" select="$nodeAltovaLink/ancestor::altova:Document[1]"/>
						<xsl:variable name="altova:TargetDocument" as="node()" select="$altova:nodeBookmark/ancestor::altova:Document[1]"/>
						<xsl:variable name="altova:sRelativePath" as="xs:string" select="altova:calc-relative-path($altova:SourceDocument/@altova:Url, $altova:TargetDocument/@altova:Url)"/>
						<xsl:value-of select="altova:NormalizeUrlForLink($altova:sRelativePath, $nodeAltovaLink/@altova:Dest)"/>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="altova:NormalizeUrlForLink($nodeAltovaLink/@altova:Dest, '')"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:ScaleFont" as="xs:double">
		<xsl:param name="nCurrSize" as="xs:double"/>
		<xsl:param name="nSteps" as="xs:integer"/>
		<xsl:choose>
			<xsl:when test="$nSteps eq 0">
				<xsl:sequence select="$nCurrSize"/>
			</xsl:when>
			<xsl:when test="$nSteps &lt; 0">
				<xsl:sequence select="altova:ScaleFont($nCurrSize div $altova:nFontScalingFactor, $nSteps + 1)"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:sequence select="altova:ScaleFont($nCurrSize * $altova:nFontScalingFactor, $nSteps - 1)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:Sqrt" as="xs:double">
		<xsl:param name="nValue" as="xs:double"/>
		<xsl:sequence select="altova:SqrtRecursive($nValue, $nValue)"/>
	</xsl:function>
	<xsl:function name="altova:SqrtRecursive" as="xs:double">
		<xsl:param name="nValue" as="xs:double"/>
		<xsl:param name="nApprox" as="xs:double"/>
		<xsl:choose>
			<xsl:when test="abs($nApprox * $nApprox - $nValue) lt 0.01">
				<xsl:sequence select="$nApprox"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:sequence select="altova:SqrtRecursive($nValue, ($nValue div $nApprox + $nApprox) div 2)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:StringPadLeft" as="xs:string">
		<xsl:param name="sText" as="xs:string"/>
		<xsl:param name="nDestLen" as="xs:integer"/>
		<xsl:param name="cPad" as="xs:string"/>
		<xsl:choose>
			<xsl:when test="string-length($sText) &gt;= $nDestLen">
				<xsl:value-of select="$sText"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="altova:StringPadLeft(concat($cPad, $sText), $nDestLen, $cPad)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:string-to-unicode-core">
		<xsl:param name="sText"/>
		<xsl:param name="bPreserveAllWhitespace"/>
		<xsl:param name="bPreserveNewlines"/>
		<!-- Replace "CR followed directly by LF" with just LF, like altovaext:encode-for-rtf does -->
		<xsl:variable name="sTextSingleCrLf" select="replace($sText, codepoints-to-string((13, 10)), codepoints-to-string(10))"/>
		<xsl:choose>
			<xsl:when test="$bPreserveAllWhitespace">
				<xsl:sequence select="string-join(for $c in string-to-codepoints($sTextSingleCrLf) return if ($c ge 32) then concat('\u', string($c), '?') else if ($c eq 10 or $c eq 13) then '\line ' else '\u32?', '')"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:choose>
					<xsl:when test="$bPreserveNewlines">
						<xsl:variable name="sTextNormalized" select="replace($sTextSingleCrLf, '[ \t]+', ' ')"/>
						<xsl:sequence select="string-join(for $c in string-to-codepoints($sTextNormalized) return if ($c ge 32) then concat('\u', string($c), '?') else if ($c eq 10 or $c eq 13) then '\line ' else '\u32?', '')"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:variable name="sTextNormalized" select="replace($sTextSingleCrLf, '\s+', ' ')"/>
						<xsl:sequence select="string-join(for $c in string-to-codepoints($sTextNormalized) return if ($c ge 32) then concat('\u', string($c), '?') else '\u32?', '')"/>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:calc-relative-path" as="xs:string">
		<xsl:param name="altova:source-path"/>
		<xsl:param name="altova:target-path"/>
		<xsl:choose>
			<xsl:when test="$altova:source-path = $altova:target-path">
				<xsl:sequence select="''"/>
			</xsl:when>
			<xsl:when test="starts-with($altova:target-path,'http:') or starts-with($altova:target-path,'ftp:') or starts-with($altova:target-path,'file:')">
				<xsl:sequence select="$altova:target-path"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:variable name="altova:source-parts" select="tokenize($altova:source-path,'[/\\]')"/>
				<xsl:variable name="altova:target-parts" select="tokenize($altova:target-path,'[/\\]')"/>
				<xsl:variable name="altova:common-part-count" select="sum(for $i in (1 to count($altova:source-parts) - 1) return if( subsequence($altova:source-parts,1,$i) = subsequence($altova:target-parts,1,$i) ) then 1 else 0)"/>
				<xsl:sequence select="string-join((for $i in ($altova:common-part-count + 1 to count($altova:source-parts) - 1) return '..',for $i in ($altova:common-part-count + 1 to count($altova:target-parts)) return $altova:target-parts[$i]),'/')"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:map-preview-filepath" as="xs:string">
		<xsl:param name="filepath"/>
		<xsl:sequence select="altovaext:create-temp-file-mapping($filepath)" use-when="function-available('altovaext:create-temp-file-mapping',1)"/>
		<xsl:sequence select="$filepath" use-when="not(function-available('altovaext:create-temp-file-mapping',1))"/>
	</xsl:function>
	<xsl:function name="altova:GetChartYValuesForSingleSeries">
		<xsl:param name="seqCategoryLeafPos" as="node()*"/>
		<xsl:param name="nodeSeriesLeafPos" as="node()"/>
		<xsl:param name="bValuesInCategory" as="xs:boolean"/>
		<xsl:for-each select="$seqCategoryLeafPos">
			<xsl:element name="altova:Value">
				<xsl:value-of select="altova:GetChartYValueForSingleSeriesPos($nodeSeriesLeafPos, ., $bValuesInCategory)"/>
			</xsl:element>
		</xsl:for-each>
	</xsl:function>
	<xsl:function name="altova:GetChartYValueForSingleSeriesPos">
		<xsl:param name="nodeSeriesLeafPos" as="node()"/>
		<xsl:param name="nodeCategoryLeafPos" as="node()"/>
		<xsl:param name="bValuesInCategory" as="xs:boolean"/>
		<xsl:variable name="altova:seqCategoryContextIds" select="$nodeCategoryLeafPos/altova:Context/@altova:ContextId" as="xs:string*"/>
		<xsl:variable name="altova:seqSeriesContextIds" select="$nodeSeriesLeafPos/altova:Context/@altova:ContextId" as="xs:string*"/>
		<xsl:variable name="altova:sCommonContextId" select="for $i in $altova:seqCategoryContextIds return if (some $j in $altova:seqSeriesContextIds satisfies $i eq $j) then $i else ()" as="xs:string*"/>
		<xsl:choose>
			<xsl:when test="count($altova:sCommonContextId) gt 1">
				<xsl:message select="concat('Es wurden mehrere Werte anstatt eines einzigen gefunden (Contexts: ', string-join($altova:sCommonContextId, ', '), ').')" terminate="yes"/>
			</xsl:when>
			<xsl:when test="count($altova:sCommonContextId) lt 1">
				<xsl:message select="concat('XBRL Chart: Info: No value found for position labeled &quot;', $nodeCategoryLeafPos/@altova:sLabel, '&quot;')" terminate="no"/>
				<xsl:sequence select="'altova:no-value'"/>
			</xsl:when>
			<xsl:when test="$bValuesInCategory">
				<xsl:sequence select="xs:string($nodeCategoryLeafPos/altova:Context[@altova:ContextId eq $altova:sCommonContextId]/@altova:Value)"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:sequence select="xs:string($nodeSeriesLeafPos/altova:Context[@altova:ContextId eq $altova:sCommonContextId]/@altova:Value)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:GetChartLabelForPos" as="xs:string">
		<xsl:param name="nodeParam" as="node()"/>
		<xsl:value-of select="string-join($nodeParam/ancestor-or-self::altova:Pos/@altova:sLabel, ' ')"/>
	</xsl:function>
	<xsl:function name="altova:convert-length-to-pixel" as="xs:decimal">
		<xsl:param name="altova:length"/>
		<xsl:variable name="normLength" select="normalize-space($altova:length)"/>
		<xsl:choose>
			<xsl:when test="ends-with($normLength, 'px')">
				<xsl:value-of select="substring-before($normLength, 'px')"/>
			</xsl:when>
			<xsl:when test="ends-with($normLength, 'in')">
				<xsl:value-of select="xs:decimal(substring-before($normLength, 'in')) * $altova:nPxPerIn"/>
			</xsl:when>
			<xsl:when test="ends-with($normLength, 'cm')">
				<xsl:value-of select="xs:decimal(substring-before($normLength, 'cm')) * $altova:nPxPerIn div 2.54"/>
			</xsl:when>
			<xsl:when test="ends-with($normLength, 'mm')">
				<xsl:value-of select="xs:decimal(substring-before($normLength, 'mm')) * $altova:nPxPerIn div 25.4"/>
			</xsl:when>
			<xsl:when test="ends-with($normLength, 'pt')">
				<xsl:value-of select="xs:decimal(substring-before($normLength, 'pt')) * $altova:nPxPerIn div 72.0"/>
			</xsl:when>
			<xsl:when test="ends-with($normLength, 'pc')">
				<xsl:value-of select="xs:decimal(substring-before($normLength, 'pc')) * $altova:nPxPerIn div 6.0"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$normLength"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
	<xsl:function name="altova:convert-length-to-mm" as="xs:decimal">
		<xsl:param name="altova:length"/>
		<xsl:variable name="normLength" select="normalize-space($altova:length)"/>
		<xsl:choose>
			<xsl:when test="ends-with($normLength, 'px')">
				<xsl:value-of select="xs:decimal(substring-before($normLength, 'px')) div $altova:nPxPerIn * 25.4"/>
			</xsl:when>
			<xsl:when test="ends-with($normLength, 'in')">
				<xsl:value-of select="xs:decimal(substring-before($normLength, 'in')) * 25.4"/>
			</xsl:when>
			<xsl:when test="ends-with($normLength, 'cm')">
				<xsl:value-of select="xs:decimal(substring-before($normLength, 'cm')) * 10"/>
			</xsl:when>
			<xsl:when test="ends-with($normLength, 'mm')">
				<xsl:value-of select="substring-before($normLength, 'mm') "/>
			</xsl:when>
			<xsl:when test="ends-with($normLength, 'pt')">
				<xsl:value-of select="xs:decimal(substring-before($normLength, 'pt')) * 25.4 div 72.0"/>
			</xsl:when>
			<xsl:when test="ends-with($normLength, 'pc')">
				<xsl:value-of select="xs:decimal(substring-before($normLength, 'pc')) * 25.4 div 6.0"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="number($normLength) div $altova:nPxPerIn * 25.4"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>
</xsl:stylesheet>
