| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!-- This file is part of the DITA Open Toolkit project hosted on
- Sourceforge.net. See the accompanying license.txt file for
- applicable licenses.-->
- <!-- (c) Copyright IBM Corp. 2005 All Rights Reserved. -->
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:xs="http://www.w3.org/2001/XMLSchema"
- exclude-result-prefixes="xs"
- version="2.0">
- <xsl:output method="text"/>
- <xsl:strip-space elements="*"/>
- <!-- =========== CALS (OASIS) TABLE =========== -->
- <xsl:template match="*[contains(@class,' topic/table ')]" name="topic.table">
- <xsl:call-template name="gen-id"/><xsl:call-template name="dotable"/>
- </xsl:template>
- <xsl:template name="dotable">
- <xsl:text>\par </xsl:text>
- <xsl:apply-templates/>
- <xsl:text>\pard \qj \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 {
- \par }</xsl:text>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/table ')]/*[contains(@class,' topic/title ')]">
- <xsl:variable name="ancestorlang">
- <xsl:call-template name="getLowerCaseLang"/>
- </xsl:variable>
- <xsl:variable name="tbl-count-actual" select="count(preceding::*[contains(@class,' topic/table ') or contains(@class,' topic/simpletable ')]/*[contains(@class,' topic/title ')])+1"/>
- <xsl:call-template name="gen-id"/>\pard \plain\s9 \qc\f4\fs24\b <xsl:choose><!-- Hungarian: "1.
- Table " --><xsl:when test="( (string-length($ancestorlang)=5 and contains($ancestorlang,'hu-hu')) or
- (string-length($ancestorlang)=2 and contains($ancestorlang,'hu')) )"><xsl:value-of
- select="$tbl-count-actual"/><xsl:text>. </xsl:text><xsl:call-template
- name="getString"><xsl:with-param name="stringName" select="'Table'"/></xsl:call-template><xsl:text>
- </xsl:text></xsl:when><xsl:otherwise><xsl:call-template name="getStringRTF"><xsl:with-param
- name="stringName" select="'Table'"/></xsl:call-template><xsl:text> </xsl:text><xsl:value-of
- select="$tbl-count-actual"/><xsl:text>. </xsl:text></xsl:otherwise></xsl:choose><xsl:value-of select="."/>\par \plain\s0 \qj\f2\fs24
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/table ')]/*[contains(@class,' topic/desc ')]">
- <xsl:call-template name="gen-id"/>\pard \plain\s0 \f2\fs24 <xsl:apply-templates/>\par \plain\s0 \f2\fs24
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/tgroup ')]" name="topic.tgroup">
- <xsl:call-template name="gen-id"/><xsl:apply-templates/>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/colspec ')]"></xsl:template>
- <xsl:template match="*[contains(@class,' topic/spanspec ')]"></xsl:template>
- <xsl:template match="*[contains(@class,' topic/thead ')]" name="topic.thead">
- <xsl:call-template name="gen-id"/><xsl:apply-templates/>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/tfoot ')]"/>
- <xsl:template match="*[contains(@class,' topic/tbody ')]" name="topic.tbody">
- <xsl:call-template name="gen-id"/><xsl:apply-templates/>
- <!-- process table footer -->
- <xsl:apply-templates select="../*[contains(@class,' topic/tfoot ')]" mode="gen-tfoot" />
- </xsl:template>
- <!-- special mode for table footers -->
- <xsl:template match="*[contains(@class,' topic/tfoot ')]" mode="gen-tfoot">
- <xsl:apply-templates/>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/row ')]" name="topic.row">
- <xsl:call-template name="gen-id"/>
- <xsl:text>\trowd \trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 </xsl:text>
- <xsl:if test="parent::*[contains(@class,' topic/thead ')]"><xsl:text>\trhdr </xsl:text></xsl:if>
- <xsl:text>\trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10
- \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
- \trftsWidth1\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3</xsl:text>
- <xsl:apply-templates select="*[contains(@class,' topic/entry ')][1]" mode="emit-cell-style"/>
- <xsl:choose>
- <xsl:when test="parent::*[contains(@class,' topic/thead ')]"><xsl:text>\plain \s7\f4\fs24\b \qc</xsl:text></xsl:when>
- <xsl:otherwise>\plain \s0\f4\fs24 <xsl:value-of select="$table-row-default-align"/></xsl:otherwise>
- </xsl:choose>
- \li0\fi0\ri0\nowidctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0
- <xsl:text>{</xsl:text><xsl:apply-templates select="*[contains(@class,' topic/entry ')][1]"/><xsl:text>}\row</xsl:text>
- </xsl:template>
- <xsl:template name="count-colmax">
- <xsl:choose>
- <xsl:when test="../../../*[contains(@class,' topic/colspec ')]">
- <xsl:value-of select="number(count(../../../*[contains(@class,' topic/colspec ')]))"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="number(count(../../*[contains(@class,' topic/row ')][1]/*[contains(@class,' topic/entry ')]))"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/entry ')]" name="topic.entry">
- <xsl:param name="currentpos" select="1"/>
- <xsl:variable name="col-max-num">
- <xsl:call-template name="count-colmax"/>
- </xsl:variable>
- <xsl:variable name="startpos"><xsl:call-template name="find-entry-start-position"/></xsl:variable>
- <xsl:variable name="endpos">
- <xsl:call-template name="find-entry-end-position">
- <xsl:with-param name="startposition" select="$startpos"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:if test="$startpos > $currentpos">
- <xsl:call-template name="emit-empty-cell">
- <xsl:with-param name="startpos" select="$startpos"/>
- <xsl:with-param name="currentpos" select="$currentpos"/>
- </xsl:call-template>
- </xsl:if>
- <xsl:choose>
- <xsl:when test="parent::*/parent::*[contains(@class,' topic/thead ')]">
- <xsl:call-template name="topic.thead_entry"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="topic.tbody_entry"/>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:if test="following-sibling::*[contains(@class,' topic/entry ')]">
- <xsl:apply-templates select="following-sibling::*[contains(@class,' topic/entry ')][1]">
- <xsl:with-param name="currentpos" select="$endpos + 1"/>
- </xsl:apply-templates>
- </xsl:if>
- <xsl:if test="not(following-sibling::*[contains(@class,' topic/entry ')]) and not(($endpos + 1) > $col-max-num)">
- <!-- if this is the last entry in current row and next position is not greater than the number of columns in a row-->
- <xsl:call-template name="emit-empty-cell">
- <xsl:with-param name="startpos" select="$col-max-num + 1"/> <!-- make sure the remaining columns will be generated -->
- <xsl:with-param name="currentpos" select="$endpos + 1"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:template>
- <!-- do header entries -->
- <xsl:template name="topic.thead_entry">
- <xsl:call-template name="doentry"/>
- </xsl:template>
- <!-- do body entries -->
- <xsl:template name="topic.tbody_entry">
- <xsl:call-template name="doentry"/>
- </xsl:template>
- <xsl:template name="doentry">
- <!--xsl:variable name="colspan-num">
- <xsl:call-template name="find-colspan"></xsl:call-template>
- </xsl:variable>
- <xsl:variable name="empty-cell-num" select="$colspan-num - 1"/-->
- <xsl:apply-templates/><xsl:text>\cell </xsl:text>
- <!--xsl:call-template name="emit-empty-cell">
- <xsl:with-param name="num" select="$empty-cell-num"/>
- </xsl:call-template-->
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/colspec ')]" mode="count-rowwidth">
- <xsl:param name="totalwidth">0</xsl:param> <!-- Total counted width so far -->
- <xsl:variable name="thiswidth"> <!-- Width of this column -->
- <xsl:choose>
- <xsl:when test="not(@colwidth) or @colwidth='*'">1</xsl:when>
- <xsl:when test="contains(@colwidth,'*')"><xsl:value-of select="substring-before(@colwidth,'*')"/></xsl:when>
- <xsl:when test="contains(@colwidth,'pt')"><xsl:value-of select="substring-before(@colwidth,'pt')"/></xsl:when>
- <xsl:when test="contains(@colwidth,'cm')"><xsl:value-of select="substring-before(@colwidth,'cm')"/></xsl:when>
- <xsl:when test="contains(@colwidth,'in')"><xsl:value-of select="substring-before(@colwidth,'in')"/></xsl:when>
- <xsl:when test="contains(@colwidth,'mm')"><xsl:value-of select="substring-before(@colwidth,'mm')"/></xsl:when>
- <xsl:otherwise>1</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <!-- If there are more colspecs, continue, otherwise return the current count -->
- <xsl:choose>
- <xsl:when test="following-sibling::*[contains(@class,' topic/colspec ')]">
- <xsl:apply-templates select="following-sibling::*[contains(@class,' topic/colspec ')][1]" mode="count-rowwidth">
- <xsl:with-param name="totalwidth" select="$totalwidth + $thiswidth"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:otherwise><xsl:value-of select="$totalwidth + $thiswidth"/></xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <!-- Find the starting column of an entry in a row. -->
- <xsl:template name="find-entry-start-position">
- <xsl:choose>
- <!-- if the column number is specified, use it -->
- <xsl:when test="@colnum">
- <xsl:value-of select="@colnum"/>
- </xsl:when>
- <xsl:when test="not(../../../*[contains(@class,' topic/colspec ')])">
- <xsl:variable name="prev-sib">
- <xsl:value-of select="count(preceding-sibling::*)"/>
- </xsl:variable>
- <xsl:value-of select="$prev-sib+1"/>
- </xsl:when>
- <!-- If there is a defined column name, check the colspans to determine position -->
- <xsl:when test="@colname">
- <!-- count the number of colspans before the one this entry references, plus one -->
- <xsl:value-of select="number(count(../../../*[contains(@class,' topic/colspec ')][@colname=current()/@colname]/preceding-sibling::*)+1)"/>
- </xsl:when>
- <!-- If the starting column is defined, check colspans to determine position -->
- <xsl:when test="@namest">
- <xsl:value-of select="number(count(../../../*[contains(@class,' topic/colspec ')][@colname=current()/@namest]/preceding-sibling::*)+1)"/>
- </xsl:when>
- <!-- Need a test for spanspec -->
- <xsl:when test="@spanname">
- <xsl:variable name="startspan"> <!-- starting column for this span -->
- <xsl:value-of select="../../../*[contains(@class,' topic/spanspec ')][@spanname=current()/@spanname]/@namest"/>
- </xsl:variable>
- <xsl:value-of select="number(count(../../../*[contains(@class,' topic/colspec ')][@colname=$startspan]/preceding-sibling::*)+1)"/>
- </xsl:when>
- <!-- Otherwise, just use the count of cells in this row -->
- <xsl:otherwise>
- <xsl:variable name="prev-sib">
- <xsl:value-of select="count(preceding-sibling::*)"/>
- </xsl:variable>
- <xsl:value-of select="$prev-sib+1"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <!-- Find the end column of a cell. If the cell does not span any columns,
- the end position is the same as the start position. -->
- <xsl:template name="find-entry-end-position">
- <xsl:param name="startposition" select="0"/>
- <xsl:choose>
- <xsl:when test="not(../../../*[contains(@class,' topic/colspec ')])">
- <xsl:value-of select="$startposition"/>
- </xsl:when>
- <xsl:when test="@nameend">
- <xsl:value-of select="number(count(../../../*[contains(@class,' topic/colspec ')][@colname=current()/@nameend]/preceding-sibling::*)+1)"/>
- </xsl:when>
- <xsl:when test="@spanname">
- <xsl:variable name="endspan"> <!-- starting column for this span -->
- <xsl:value-of select="../../../*[contains(@class,' topic/spanspec ')][@spanname=current()/@spanname]/@nameend"/>
- </xsl:variable>
- <xsl:value-of select="number(count(../../../*[contains(@class,' topic/colspec ')][@colname=$endspan]/preceding-sibling::*)+1)"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$startposition"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <!-- Find the number of column spans between name-start and name-end attrs -->
- <xsl:template name="find-colspan">
- <xsl:variable name="startpos">
- <xsl:call-template name="find-entry-start-position"/>
- </xsl:variable>
- <xsl:variable name="endpos">
- <xsl:call-template name="find-entry-end-position">
- <xsl:with-param name="startposition" select="$startpos"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:value-of select="$endpos - $startpos + 1"/>
- </xsl:template>
- <xsl:template name="find-spanspec-colspan">
- <xsl:variable name="spanname"><xsl:value-of select="@spanname"/></xsl:variable>
- <xsl:variable name="startcolname">
- <xsl:value-of select="../../../*[contains(@class,' topic/spanspec ')][@spanname=$spanname][1]/@namest"/>
- </xsl:variable>
- <xsl:variable name="endcolname">
- <xsl:value-of select="../../../*[contains(@class,' topic/spanspec ')][@spanname=$spanname][1]/@nameend"/>
- </xsl:variable>
- <xsl:variable name="startpos">
- <xsl:value-of select="number(count(../../../*[contains(@class,' topic/colspec ')][@colname=$startcolname]/preceding-sibling::*)+1)"/>
- </xsl:variable>
- <xsl:variable name="endpos">
- <xsl:value-of select="number(count(../../../*[contains(@class,' topic/colspec ')][@colname=$endcolname]/preceding-sibling::*)+1)"/>
- </xsl:variable>
- <xsl:value-of select="$endpos - $startpos + 1"/>
- </xsl:template>
- <xsl:template name="emit-empty-cell">
- <xsl:param name="currentpos" select="1"/>
- <xsl:param name="startpos" select="1"></xsl:param>
- <xsl:if test="$startpos > $currentpos">
- <xsl:variable name="colspan">
- <xsl:apply-templates select="../preceding-sibling::*[*[contains(@class,' topic/entry ')][@morerows][@colnum=$currentpos or @colname=concat('col',$currentpos) or @namest=concat('col',$currentpos)]][1]/*[contains(@class,' topic/entry ')][@morerows][@colnum=$currentpos or @colname=concat('col',$currentpos) or @namest=concat('col',$currentpos)]" mode="find-colspan"/>
- </xsl:variable>
- <xsl:text>\cell </xsl:text>
- <xsl:if test="not($colspan='') and ($startpos > ($currentpos + $colspan))">
- <xsl:call-template name="emit-empty-cell">
- <xsl:with-param name="startpos" select="$startpos"/>
- <xsl:with-param name="currentpos" select="$currentpos + $colspan"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match="*[contains(@class,' topic/entry ')]" mode="emit-cell-style">
- <xsl:param name="copy-style" select="'false'"/>
- <xsl:param name="left-border" select="0"/>
- <xsl:param name="currentpos" select="1"/>
- <xsl:variable name="col-max-num">
- <xsl:call-template name="count-colmax"/>
- </xsl:variable>
- <xsl:variable name="valign">
- <xsl:choose>
- <xsl:when test="@valign and not(@valign='')">
- <xsl:choose>
- <xsl:when test="@valign='top'">\clvertalt</xsl:when>
- <xsl:when test="@valign='middle'">\clvertalc</xsl:when>
- <xsl:when test="@valign='bottom'">\clvertalb</xsl:when>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="../@valign and not(../@valign='')">
- <xsl:choose>
- <xsl:when test="@valign='top'">\clvertalt</xsl:when>
- <xsl:when test="@valign='middle'">\clvertalc</xsl:when>
- <xsl:when test="@valign='bottom'">\clvertalb</xsl:when>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise><xsl:value-of select="table-cell-default-valign"/></xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="colspan-num">
- <xsl:call-template name="find-colspan"/>
- </xsl:variable>
- <xsl:variable name="startpos"><xsl:call-template name="find-entry-start-position"/></xsl:variable>
- <xsl:variable name="endpos">
- <xsl:call-template name="find-entry-end-position">
- <xsl:with-param name="startposition" select="$startpos"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="nextpos">
- <xsl:choose>
- <xsl:when test="$endpos > $startpos">
- <xsl:value-of select="$endpos + 1"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$startpos + 1"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="totalwidth">
- <xsl:choose>
- <xsl:when test="../../../*[contains(@class,' topic/colspec ')]">
- <xsl:apply-templates select="../../../*[contains(@class,' topic/colspec ')][1]" mode="count-rowwidth"/>
- </xsl:when>
- <xsl:otherwise><xsl:value-of select="$col-max-num"/></xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="thiswidth">
- <xsl:choose>
- <xsl:when test="../../../*[contains(@class,' topic/colspec ')]">
- <xsl:apply-templates select="../../../*[contains(@class,' topic/colspec ')][number($startpos)]" mode="count-colwidth">
- <xsl:with-param name="colnum" select="$colspan-num"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:otherwise>1</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="thiswidth-twips">
- <!--xsl:choose>
- <xsl:when test="following-sibling::*[contains(@class,' topic/entry ')]"-->
- <xsl:value-of select="round(($thiswidth div $totalwidth) * $table-row-width)"/>
- <!--/xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="($table-row-width) - ($left-border)"/>
- </xsl:otherwise>
- </xsl:choose-->
- </xsl:variable>
- <xsl:variable name="left-to-right">
- <xsl:choose>
- <xsl:when test="../../../*[contains(@class,' topic/colspec ')]">
- <xsl:apply-templates select="../../../*[contains(@class,' topic/colspec ')][number($currentpos)]" mode="count-colwidth">
- <xsl:with-param name="colnum" select="$colspan-num + $startpos - $currentpos"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:otherwise><xsl:value-of select="$thiswidth"/></xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="right-border">
- <xsl:value-of select="$left-border + round(($left-to-right div $totalwidth) * $table-row-width)"/>
- </xsl:variable>
- <xsl:if test="$startpos > $currentpos">
- <!-- the start position of the entry is after current position
- we need to emit merged entry style -->
- <xsl:call-template name="emit-vmerged-style">
- <xsl:with-param name="left-border" select="$left-border"/>
- <xsl:with-param name="startpos" select="$startpos"/>
- <xsl:with-param name="currentpos" select="$currentpos"/>
- </xsl:call-template>
- </xsl:if>
- <xsl:if test="@morerows and $copy-style='false'"><xsl:text>\clvmgf</xsl:text></xsl:if>
-
- <xsl:value-of select="$valign"/><xsl:text>\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clftsWidth3\clwWidth</xsl:text><xsl:value-of select="$thiswidth-twips"/>
- <xsl:text>\cellx</xsl:text><xsl:value-of select="$right-border"/><xsl:text> </xsl:text>
- <xsl:if test="following-sibling::*[contains(@class,' topic/entry ')] and $copy-style='false'">
- <xsl:apply-templates select="following-sibling::*[contains(@class,' topic/entry ')][1]" mode="emit-cell-style">
- <xsl:with-param name="left-border" select="$right-border"/>
- <xsl:with-param name="currentpos" select="$nextpos"/>
- </xsl:apply-templates>
- </xsl:if>
- <xsl:if test="not(following-sibling::*[contains(@class,' topic/entry ')]) and not($nextpos > $col-max-num)">
- <!-- if this is the last entry in current row and next position is not greater than the number of columns in a row-->
- <xsl:call-template name="emit-vmerged-style">
- <xsl:with-param name="left-border" select="$right-border"/>
- <xsl:with-param name="startpos" select="$col-max-num + 1"/> <!-- make sure the remaining columns will be generated -->
- <xsl:with-param name="currentpos" select="$nextpos"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:template>
-
- <xsl:template name="emit-vmerged-style">
- <xsl:param name="left-border" select="0"/>
- <xsl:param name="startpos" select="1"/>
- <xsl:param name="currentpos" select="1"/>
- <xsl:if test="$startpos > $currentpos">
- <xsl:variable name="colspan">
- <xsl:apply-templates select="../preceding-sibling::*[*[contains(@class,' topic/entry ')][@morerows][@colnum=$currentpos or @colname=concat('col',$currentpos) or @namest=concat('col',$currentpos)]][1]/*[contains(@class,' topic/entry ')][@morerows][@colnum=$currentpos or @colname=concat('col',$currentpos) or @namest=concat('col',$currentpos)]" mode="find-colspan"/>
- </xsl:variable>
- <xsl:variable name="col-max-num">
- <xsl:call-template name="count-colmax"/>
- </xsl:variable>
- <xsl:variable name="totalwidth">
- <xsl:choose>
- <xsl:when test="../../../*[contains(@class,' topic/colspec ')]">
- <xsl:apply-templates select="../../../*[contains(@class,' topic/colspec ')][1]" mode="count-rowwidth"/>
- </xsl:when>
- <xsl:otherwise><xsl:value-of select="$col-max-num"/></xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="thiswidth">
- <xsl:choose>
- <xsl:when test="../../../*[contains(@class,' topic/colspec ')]">
- <xsl:apply-templates select="../../../*[contains(@class,' topic/colspec ')][number($currentpos)]" mode="count-colwidth">
- <xsl:with-param name="colnum" select="$colspan"/>
- </xsl:apply-templates></xsl:when>
- <xsl:otherwise>1</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="thiswidth-twips">
- <xsl:value-of select="round(($thiswidth div $totalwidth) * $table-row-width)"/>
- </xsl:variable>
- <xsl:text>\clvmrg</xsl:text>
- <xsl:apply-templates select="../preceding-sibling::*[*[contains(@class,' topic/entry ')][@morerows][@colnum=$currentpos or @colname=concat('col',$currentpos) or @namest=concat('col',$currentpos)]][1]/*[contains(@class,' topic/entry ')][@morerows][@colnum=$currentpos or @colname=concat('col',$currentpos) or @namest=concat('col',$currentpos)]" mode="emit-cell-style">
- <xsl:with-param name="left-border" select="$left-border"/>
- <xsl:with-param name="copy-style" select="'true'"/>
- <xsl:with-param name="currentpos" select="$currentpos"/>
- </xsl:apply-templates>
-
- <xsl:if test="not($colspan='') and ($startpos > ($currentpos + $colspan))">
- <xsl:call-template name="emit-vmerged-style">
- <xsl:with-param name="left-border" select="$left-border + $thiswidth-twips"/>
- <xsl:with-param name="startpos" select="$startpos"/>
- <xsl:with-param name="currentpos" select="$currentpos + $colspan"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match="*[contains(@class,' topic/entry ')]" mode="find-colspan">
- <xsl:call-template name="find-colspan"/>
- </xsl:template>
-
- <!--xsl:template name="emit-merged-cstyle">
- <xsl:param name="startpos" select="1"/>
- <xsl:param name="num" select="0"/>
- <xsl:if test="$num > 0">
- <xsl:text>\clmrg</xsl:text><xsl:apply-templates select="../../../*[contains(@class,' topic/colspec ')][number($startpos)]" mode="emit-cell-style"></xsl:apply-templates>
- <xsl:call-template name="emit-merged-cstyle">
- <xsl:with-param name="startpos" select="$startpos + 1"/>
- <xsl:with-param name="num" select="$num - 1"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match="*[contains(@class,' topic/colspec ')]" mode="emit-cell-style">
- <xsl:param name="left-border" select="0"/>
- <xsl:param name="colnum" select="1"/>
- <xsl:param name="valign" select="$table-cell-default-valign"/>
- <xsl:variable name="totalwidth">
- <xsl:apply-templates select="../*[contains(@class,' topic/colspec ')][1]" mode="count-rowwidth"/>
- </xsl:variable>
- <xsl:variable name="thiswidth">
- <xsl:call-template name="count-colwidth">
- <xsl:with-param name="colnum" select="$colnum"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="thiswidth-twips">
- <xsl:value-of select="($thiswidth div $totalwidth) * $table-row-width"/>
- </xsl:variable>
- <xsl:value-of select="$valign"/><xsl:text>\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clftsWidth3\clwWidth</xsl:text><xsl:value-of select="round($thiswidth-twips)"/>
- <xsl:text>\cellx </xsl:text><xsl:value-of select="$left-border + "/>
- </xsl:template-->
-
- <xsl:template match="*[contains(@class,' topic/colspec ')]" mode="count-colwidth">
- <xsl:param name="colnum" select="1" as="xs:double"/>
- <xsl:param name="span-width" select="0" as="xs:double"></xsl:param>
- <xsl:variable name="width" as="xs:double">
- <xsl:choose>
- <xsl:when test="not(@colwidth) or @colwidth='*'">1</xsl:when>
- <xsl:when test="contains(@colwidth,'*')"><xsl:value-of select="substring-before(@colwidth,'*')"/></xsl:when>
- <xsl:when test="contains(@colwidth,'pt')"><xsl:value-of select="substring-before(@colwidth,'pt')"/></xsl:when>
- <xsl:when test="contains(@colwidth,'cm')"><xsl:value-of select="substring-before(@colwidth,'cm')"/></xsl:when>
- <xsl:when test="contains(@colwidth,'in')"><xsl:value-of select="substring-before(@colwidth,'in')"/></xsl:when>
- <xsl:when test="contains(@colwidth,'mm')"><xsl:value-of select="substring-before(@colwidth,'mm')"/></xsl:when>
- <xsl:otherwise>1</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$colnum > 1">
- <xsl:apply-templates select="following-sibling::*[1]" mode="count-colwidth">
- <xsl:with-param name="colnum" select="$colnum - 1"/>
- <xsl:with-param name="span-width" select="$span-width + $width"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:otherwise><xsl:value-of select="$span-width + $width"/></xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!--xsl:template name="count-colwidth">
- <xsl:param name="colnum" select="1"/>
- <xsl:param name="span-width" select="0"/>
- <xsl:variable name="width">
- <xsl:choose>
- <xsl:when test="@colwidth and not(@colwidth='')">
- <xsl:value-of select="substring-before(@colwidth,'*')"/>
- </xsl:when>
- <xsl:otherwise>1</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$colnum > 1">
- <xsl:call-template name="count-colwidth">
- <xsl:with-param name="colnum" select="$colnum - 1"/>
- <xsl:with-param name="span-width" select="$span-width + $width"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise><xsl:value-of select="$span-width + $width"/></xsl:otherwise>
- </xsl:choose>
- </xsl:template-->
- <!-- Simple Table -->
- <xsl:template match="*[contains(@class,' topic/simpletable ')]">
- <xsl:call-template name="gen-id"/><xsl:call-template name="dotable"/>
- </xsl:template>
-
- <xsl:template match="*[contains(@class,' topic/simpletable ')]/*[contains(@class,' topic/title ')]">
- <xsl:variable name="ancestorlang">
- <xsl:call-template name="getLowerCaseLang"/>
- </xsl:variable>
- <xsl:variable name="tbl-count-actual" select="count(preceding::*[contains(@class,' topic/table ')
- or contains(@class,' topic/simpletable ')]/*[contains(@class,' topic/title ')])+1"/>
- <xsl:call-template name="gen-id"/>\pard \plain\s9 \qc\f4\fs24\b <xsl:choose><!-- Hungarian: "1.Table " --><xsl:when test="( (string-length($ancestorlang)=5 and contains($ancestorlang,'hu-hu')) or (string-length($ancestorlang)=2 and contains($ancestorlang,'hu')) )"><xsl:value-of select="$tbl-count-actual"/><xsl:text>. </xsl:text><xsl:call-template name="getStringRTF"><xsl:with-param name="stringName" select="'Table'"/></xsl:call-template><xsl:text> </xsl:text></xsl:when><xsl:otherwise><xsl:call-template name="getStringRTF"><xsl:with-param name="stringName" select="'Table'"/></xsl:call-template><xsl:text> </xsl:text><xsl:value-of select="$tbl-count-actual"/><xsl:text>. </xsl:text></xsl:otherwise></xsl:choose><xsl:value-of select="."/>\par \plain\s0 \qj\f2\fs24
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/sthead ')]">
- <xsl:call-template name="gen-id"/>
- <xsl:text>\trowd \trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trhdr </xsl:text>
- <xsl:text>\trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10
- \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
- \trftsWidth1\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3</xsl:text>
- <xsl:apply-templates mode="emit-cell-style"/>
- <xsl:text>\plain \s7\f4\fs24\b \qc</xsl:text>
- \li0\fi0\ri0\nowidctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0
- <xsl:text>{</xsl:text><xsl:apply-templates/><xsl:text>}\row</xsl:text>
- </xsl:template>
-
- <xsl:template match="*[contains(@class,' topic/strow ')]">
- <xsl:call-template name="gen-id"/>
- <xsl:text>\trowd \trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 </xsl:text>
- <xsl:text>\trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10
- \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
- \trftsWidth1\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3</xsl:text>
- <xsl:apply-templates mode="emit-cell-style"/>
- <xsl:text>\plain \s0\f4\fs24 </xsl:text><xsl:value-of select="$table-row-default-align"/>
- \li0\fi0\ri0\nowidctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0
- <xsl:text>{</xsl:text><xsl:apply-templates/><xsl:text>}\row</xsl:text>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/stentry ')]" mode="emit-cell-style">
- <xsl:param name="valign" select="$table-cell-default-valign"/>
- <xsl:variable name="totalcols" select="count(../*[contains(@class,' topic/stentry ')])">
- <!--xsl:apply-templates select="../*[contains(@class,' topic/stentry ')][1]" mode="count-rowwidth"/-->
- </xsl:variable>
-
- <xsl:variable name="thiswidth-twips">
- <xsl:value-of select="$table-row-width div $totalcols"/>
- </xsl:variable>
- <xsl:value-of select="$valign"/><xsl:text>\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clftsWidth3\clwWidth</xsl:text><xsl:value-of select="round($thiswidth-twips)"/>
- <xsl:text>\cellx </xsl:text>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/stentry ')]">
- <xsl:apply-templates/><xsl:text>\cell </xsl:text>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/stentry ')]" mode="count-rowwidth">
- <xsl:param name="totalcols">0</xsl:param> <!-- Total counted columns so far -->
- <xsl:choose>
- <xsl:when test="following-sibling::*[contains(@class,' topic/stentry ')]">
- <xsl:apply-templates select="following-sibling::*[contains(@class,' topic/stentry ')][1]" mode="count-rowwidth">
- <xsl:with-param name="totalwidth" select="$totalcols + 1"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:otherwise><xsl:value-of select="$totalcols + 1"/></xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- </xsl:stylesheet>
|