| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!-- This file is part of the DITA Open Toolkit project.
- See the accompanying license.txt file for applicable licenses. -->
- <!-- (c) Copyright IBM Corp. 2006 All Rights Reserved. -->
- <xsl:stylesheet
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
- xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
- xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
- xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
- xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
- xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
- xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
- xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0"
- xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
- xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
- xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
- xmlns:math="http://www.w3.org/1998/Math/MathML"
- xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
- xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
- xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0"
- xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0"
- xmlns:prodtools="http://www.ibm.com/xmlns/prodtools"
- version="2.0"
- xmlns:ditamsg="http://dita-ot.sourceforge.net/ns/200704/ditamsg"
- exclude-result-prefixes="ditamsg">
-
- <!-- =========== TEMPLATES FOR CALCULATING NESTED TAGS
- NOTE:SOME TAGS' NUMBER ARE MULTPLIED BY A NUMBER FOR FLAGGING STYLES.=========== -->
-
- <xsl:template name="calculate_list_depth">
- <xsl:param name="list_class" select="' topic/li '"/>
- <xsl:value-of select="count(ancestor::*[contains(@class, $list_class)])"/>
- </xsl:template>
-
- <xsl:template name="calculate_span_depth_for_tag">
- <xsl:param name="tag_class" select="' topic/fn '"/>
-
- <xsl:variable name="fig_count" select="(count(ancestor::*[contains(@class, ' topic/fig ')]) -
- count(ancestor::*[contains(@class, $tag_class)][1]/ancestor::*[contains(@class, ' topic/fig ')])) * 2"/>
-
- <xsl:variable name="lq_count" select="(count(ancestor::*[contains(@class, ' topic/lq ')]) -
- count(ancestor::*[contains(@class, $tag_class)][1]/ancestor::*[contains(@class, ' topic/lq ')])) * 2"/>
-
- <xsl:variable name="note_count" select="(count(ancestor::*[contains(@class, ' topic/note ')]) -
- count(ancestor::*[contains(@class, $tag_class)][1]/ancestor::*[contains(@class, ' topic/note ')])) * 3"/>
-
- <xsl:variable name="itemgroup_count" select="(count(ancestor::*[contains(@class, ' topic/itemgroup ')]) -
- count(ancestor::*[contains(@class, $tag_class)][1]/ancestor::*[contains(@class, ' topic/itemgroup ')])) * 2"/>
-
- <xsl:variable name="p_count" select="(count(ancestor::*[contains(@class, ' topic/p ')]) -
- count(ancestor::*[contains(@class, $tag_class)][1]/ancestor::*[contains(@class, ' topic/p ')])) * 2"/>
-
- <xsl:variable name="draft-comment_count" select="(count(ancestor::*[contains(@class, ' topic/draft-comment ')]) -
- count(ancestor::*[contains(@class, $tag_class)][1]/ancestor::*[contains(@class, ' topic/draft-comment ')])) * 2"/>
-
- <xsl:variable name="required-cleanup_count" select="(count(ancestor::*[contains(@class, ' topic/required-cleanup ')]) -
- count(ancestor::*[contains(@class, $tag_class)][1]/ancestor::*[contains(@class, ' topic/required-cleanup ')])) * 2"/>
-
- <xsl:variable name="dd_count" select="(count(ancestor::*[contains(@class, ' topic/dd ')]) -
- count(ancestor::*[contains(@class, $tag_class)][1]/ancestor::*[contains(@class, ' topic/dd ')])) * 2"/>
-
- <!-- sthead/thead count important! -->
- <xsl:variable name="thead_count">
- <xsl:choose>
- <xsl:when test="ancestor::*[contains(@class, ' topic/sthead ')]">
- <xsl:value-of select="1"/>
- </xsl:when>
- <xsl:when test="ancestor::*[contains(@class, ' topic/thead ')]">
- <xsl:value-of select="1"/>
- </xsl:when>
- <xsl:otherwise>0</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:variable name="total_count" select="$fig_count + $lq_count +
- $note_count + $itemgroup_count + $p_count + $draft-comment_count +
- $required-cleanup_count + $dd_count + $thead_count"/>
-
- <xsl:choose>
- <!-- fn is rendered as text:p plus flagging styles-->
- <xsl:when test="$tag_class = ' topic/fn '">
- <xsl:value-of select="$total_count + 1"/>
- </xsl:when>
- <xsl:otherwise>
- <!-- 1st one is rendered as p -->
- <xsl:value-of select="$total_count - 1"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="calculate_span_depth">
- <xsl:variable name="desc_count" select="count(ancestor::*[contains(@class, ' topic/desc ')])"/>
-
- <xsl:variable name="fig_count" select="count(ancestor::*[contains(@class, ' topic/fig ')]) * 2"/>
-
- <xsl:variable name="figgroup_count" select="count(ancestor::*[contains(@class, ' topic/figgroup ')]) * 2"/>
-
- <xsl:variable name="lq_count" select="count(ancestor::*[contains(@class, ' topic/lq ')]) * 2"/>
-
- <xsl:variable name="lines_count" select="count(ancestor::*[contains(@class, ' topic/lines ')]) * 2"/>
- <!-- Add 1 for flagging sytles -->
- <xsl:variable name="note_count" select="count(ancestor::*[contains(@class, ' topic/note ')]) * 3"/>
-
- <xsl:variable name="p_count" select="count(ancestor::*[contains(@class, ' topic/p ')]) * 2"/>
-
- <xsl:variable name="ph_count" select="count(ancestor::*[contains(@class, ' topic/ph ')]) * 2"/>
-
- <xsl:variable name="pre_count" select="count(ancestor::*[contains(@class, ' topic/pre ')]) * 2"/>
-
- <xsl:variable name="draft-comment_count" select="count(ancestor::*[contains(@class, ' topic/draft-comment ')]) * 2"/>
-
- <xsl:variable name="required-cleanup_count" select="count(ancestor::*[contains(@class, ' topic/required-cleanup ')]) * 2"/>
-
- <xsl:variable name="itemgroup_count" select="count(ancestor::*[contains(@class, ' topic/itemgroup ')]) * 2"/>
-
- <xsl:variable name="dd_count" select="count(ancestor::*[contains(@class, ' topic/dd ')]) * 2"/>
-
- <xsl:variable name="fn_count" select="count(ancestor::*[contains(@class, ' topic/fn ')]) * 2"/>
-
- <xsl:variable name="abstract_count" select="count(ancestor::*[contains(@class, ' topic/abstract ')])"/>
-
- <xsl:variable name="bodydiv_count" select="count(ancestor::*[contains(@class, ' topic/bodydiv ')])"/>
-
- <xsl:variable name="section_count" select="count(ancestor::*[contains(@class, ' topic/section ')]) * 2"/>
-
- <xsl:variable name="sectiondiv_count" select="count(ancestor::*[contains(@class, ' topic/sectiondiv ')])"/>
-
- <xsl:variable name="example_count">
- <xsl:choose>
- <xsl:when test="ancestor::*[contains(@class, ' topic/example ')]">
- <xsl:value-of select="count(ancestor::*[contains(@class, ' topic/example ')]) * 2"/>
- </xsl:when>
- <xsl:otherwise>0</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:variable name="linkinfo_count" select="0"/>
-
- <xsl:variable name="related-links_count" select="count(ancestor::*[contains(@class, ' topic/related-links ')])"/>
-
- <xsl:variable name="pd_count" select="count(ancestor::*[contains(@class, ' topic/pd ')])"/>
-
- <xsl:variable name="total_count" select="$desc_count + $fig_count + $figgroup_count
- + $lq_count + $lines_count + $note_count + $p_count + $ph_count + $pre_count + $draft-comment_count + $required-cleanup_count
- + $itemgroup_count + $dd_count + $fn_count + $abstract_count + $bodydiv_count + $section_count + $sectiondiv_count
- + $example_count + $linkinfo_count + $related-links_count + $pd_count"/>
-
- <!-- remove the first one rendered by text:p -->
- <xsl:value-of select="$total_count - 1"/>
-
- </xsl:template>
-
- <xsl:template name="break_span_tags">
- <xsl:param name="depth" select="0"/>
- <xsl:param name="order" select="0"/>
- <!--1st: move out -->
- <xsl:if test="$depth > 0 and $order = 0">
- <xsl:text disable-output-escaping="yes"></text:span></xsl:text>
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$depth - 1"/>
- <xsl:with-param name="order" select="$order"/>
- </xsl:call-template>
- </xsl:if>
- <!--2nd: move in -->
- <xsl:if test="$depth > 0 and $order > 0">
- <xsl:text disable-output-escaping="yes"><text:span></xsl:text>
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$depth - 1"/>
- <xsl:with-param name="order" select="$order"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:template>
-
- <xsl:template name="create_items_for_list">
- <xsl:param name="depth" select="0"/>
- <xsl:param name="order" select="0"/>
- <!--1st: move out -->
- <xsl:if test="$depth > 0 and $order = 0">
- <xsl:text disable-output-escaping="yes"></text:list-item></xsl:text>
- <xsl:text disable-output-escaping="yes"></text:list></xsl:text>
- <xsl:call-template name="create_items_for_list">
- <xsl:with-param name="depth" select="$depth - 1"/>
- <xsl:with-param name="order" select="$order"/>
- </xsl:call-template>
- </xsl:if>
- <!--2nd: move in -->
- <xsl:if test="$depth > 0 and $order > 0">
- <!-- for ol, we should keep the item number correctly. -->
- <xsl:choose>
- <xsl:when test="ancestor::*[contains(@class, ' topic/ol ')]">
- <xsl:text disable-output-escaping="yes"><text:list text:continue-numbering="true" text:style-name="ordered_list_style"></xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text disable-output-escaping="yes"><text:list text:continue-numbering="true" text:style-name="list_style"></xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- <!-- render list item -->
- <xsl:text disable-output-escaping="yes"><text:list-item></xsl:text>
-
- <xsl:call-template name="create_items_for_list">
- <xsl:with-param name="depth" select="$depth - 1"/>
- <xsl:with-param name="order" select="$order"/>
- </xsl:call-template>
- </xsl:if>
-
- </xsl:template>
-
- <xsl:template name="set_align_value">
- <xsl:choose>
- <xsl:when test="parent::*[contains(@class, ' topic/entry ')]/@align = 'left'">
- <xsl:attribute name="text:style-name">left</xsl:attribute>
- </xsl:when>
- <xsl:when test="parent::*[contains(@class, ' topic/entry ')]/@align = 'right'">
- <xsl:attribute name="text:style-name">right</xsl:attribute>
- </xsl:when>
- <xsl:when test="parent::*[contains(@class, ' topic/entry ')]/@align = 'center'">
- <xsl:attribute name="text:style-name">center</xsl:attribute>
- </xsl:when>
- <xsl:when test="parent::*[contains(@class, ' topic/entry ')]/@align = 'justify'">
- <xsl:attribute name="text:style-name">justify</xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute name="text:style-name">left</xsl:attribute>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="render_simpletable">
- <xsl:variable name="dlentry_count_for_list" select="count(ancestor::*[contains(@class, ' topic/dlentry ')]) -
- count(ancestor::*[contains(@class, ' topic/li ')][1]/ancestor::*[contains(@class, ' topic/dlentry ')])"/>
-
- <xsl:variable name="fn_depth" select="count(ancestor::*[contains(@class, ' topic/fn ')][1]/ancestor::*)"/>
-
- <xsl:variable name="list_depth" select="count(ancestor::*[contains(@class, ' topic/li ')][1]/ancestor::*)"/>
-
- <xsl:variable name="dlist_depth" select="count(ancestor::*[contains(@class, ' topic/dlentry ')][1]/ancestor::*)"/>
-
- <xsl:variable name="table_depth" select="count(ancestor::*[contains(@class, ' topic/entry ')][1]/ancestor::*)"/>
-
- <xsl:variable name="stable_depth" select="count(ancestor::*[contains(@class, ' topic/stentry ')][1]/ancestor::*)"/>
-
- <xsl:variable name="max_depth" select="max(($fn_depth, $list_depth, $dlist_depth, $table_depth, $stable_depth))"/>
-
- <!-- if the table is under p(direct child) -->
- <xsl:choose>
- <!-- parent tag is body -->
- <xsl:when test="parent::*[contains(@class, ' topic/body ')]">
- <!-- start render table -->
- <xsl:call-template name="create_simpletable"/>
- </xsl:when>
- <!-- nested by list -->
- <xsl:when test="ancestor::*[contains(@class, ' topic/li ')] and $dlentry_count_for_list = 0">
-
- <xsl:choose>
- <!-- nearest tag is list -->
- <xsl:when test="$max_depth = $list_depth">
- <!-- caculate list depth -->
- <xsl:variable name="depth">
- <xsl:call-template name="calculate_list_depth"/>
- </xsl:variable>
- <!-- caculate span tag depth -->
- <xsl:variable name="span_depth">
- <xsl:call-template name="calculate_span_depth_for_tag">
- <xsl:with-param name="tag_class" select="' topic/li '"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- break span tags -->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- break first p tag if there are span tags -->
- <xsl:if test="$span_depth >= 0">
- <xsl:text disable-output-escaping="yes"></text:p></xsl:text>
- </xsl:if>
- <!-- break list tag -->
- <xsl:call-template name="create_items_for_list">
- <xsl:with-param name="depth" select="$depth"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- start render table -->
- <xsl:call-template name="create_simpletable"/>
- <!-- start list tag again -->
- <xsl:call-template name="create_items_for_list">
- <xsl:with-param name="depth" select="$depth"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- <!-- start p tag again if there are span tags-->
- <xsl:if test="$span_depth >= 0">
- <xsl:text disable-output-escaping="yes"><text:p></xsl:text>
- </xsl:if>
- <!-- start render span tags again-->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- </xsl:when>
- <!-- nearest tag is fn -->
- <xsl:when test="$max_depth = $fn_depth">
- <!-- normal process -->
- <xsl:variable name="span_depth">
- <xsl:call-template name="calculate_span_depth"/>
- </xsl:variable>
- <!-- break span tags -->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- break first p tag if there are span tags -->
- <xsl:text disable-output-escaping="yes"></text:p></xsl:text>
- <!-- start render table -->
- <xsl:call-template name="create_simpletable"/>
- <!-- start p tag again if there are span tags-->
- <xsl:text disable-output-escaping="yes"><text:p></xsl:text>
- <!-- start render span tags again-->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- </xsl:when>
- <!-- nearest tag is table -->
- <xsl:when test="$max_depth = $table_depth">
- <xsl:variable name="span_depth">
- <xsl:call-template name="calculate_span_depth_for_tag">
- <xsl:with-param name="tag_class" select="' topic/entry '"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- break span tags -->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- break first p tag if there are span tags -->
- <xsl:text disable-output-escaping="yes"></text:p></xsl:text>
- <!-- start render table -->
- <xsl:call-template name="create_simpletable"/>
- <!-- start p tag again if there are span tags-->
- <xsl:text disable-output-escaping="yes"><text:p></xsl:text>
- <!-- start render span tags again-->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- </xsl:when>
- <!-- nearest tag is simpletable -->
- <xsl:when test="$max_depth = $stable_depth">
- <xsl:variable name="span_depth">
- <xsl:call-template name="calculate_span_depth_for_tag">
- <xsl:with-param name="tag_class" select="' topic/stentry '"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- break span tags -->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- break first p tag if there are span tags -->
- <xsl:text disable-output-escaping="yes"></text:p></xsl:text>
- <!-- start render table -->
- <xsl:call-template name="create_simpletable"/>
- <!-- start p tag again if there are span tags-->
- <xsl:text disable-output-escaping="yes"><text:p></xsl:text>
- <!-- start render span tags again-->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
- </xsl:when>
- <!-- nested by dlist -->
- <xsl:when test="ancestor::*[contains(@class, ' topic/dlentry ')]">
-
- <xsl:choose>
- <!-- nearest tag is dlist -->
- <xsl:when test="$max_depth = $dlist_depth">
- <!-- caculate list depth -->
- <xsl:variable name="depth">
- <xsl:call-template name="calculate_list_depth">
- <xsl:with-param name="list_class" select="' topic/dlentry '"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- caculate span tag depth -->
- <xsl:variable name="span_depth">
- <xsl:call-template name="calculate_span_depth_for_tag">
- <xsl:with-param name="tag_class" select="' topic/dlentry '"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- break span tags -->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- break first p tag if there are span tags -->
- <xsl:if test="$span_depth >= 0">
- <xsl:text disable-output-escaping="yes"></text:p></xsl:text>
- </xsl:if>
- <!-- break list tag -->
- <xsl:call-template name="create_items_for_list">
- <xsl:with-param name="depth" select="$depth"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- start render table -->
- <xsl:call-template name="create_simpletable"/>
- <!-- start list tag again -->
- <xsl:call-template name="create_items_for_list">
- <xsl:with-param name="depth" select="$depth"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- <!-- start p tag again if there are span tags-->
- <xsl:if test="$span_depth >= 0">
- <xsl:text disable-output-escaping="yes"><text:p></xsl:text>
- </xsl:if>
- <!-- start render span tags again-->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- </xsl:when>
- <!-- nearest tag is fn -->
- <xsl:when test="$max_depth = $fn_depth">
- <!-- normal process -->
- <xsl:variable name="span_depth">
- <xsl:call-template name="calculate_span_depth"/>
- </xsl:variable>
- <!-- break span tags -->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- break first p tag if there are span tags -->
- <xsl:text disable-output-escaping="yes"></text:p></xsl:text>
- <!-- start render table -->
- <xsl:call-template name="create_simpletable"/>
- <!-- start p tag again if there are span tags-->
- <xsl:text disable-output-escaping="yes"><text:p></xsl:text>
- <!-- start render span tags again-->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- </xsl:when>
- <!-- nearest tag is simpletable -->
- <xsl:when test="$max_depth = $stable_depth">
- <xsl:variable name="span_depth">
- <xsl:call-template name="calculate_span_depth_for_tag">
- <xsl:with-param name="tag_class" select="' topic/stentry '"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- break span tags -->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- break first p tag if there are span tags -->
- <xsl:text disable-output-escaping="yes"></text:p></xsl:text>
- <!-- start render table -->
- <xsl:call-template name="create_simpletable"/>
- <!-- start p tag again if there are span tags-->
- <xsl:text disable-output-escaping="yes"><text:p></xsl:text>
- <!-- start render span tags again-->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- </xsl:when>
- <!-- nearest tag is table -->
- <xsl:when test="$max_depth = $table_depth">
- <xsl:variable name="span_depth">
- <xsl:call-template name="calculate_span_depth_for_tag">
- <xsl:with-param name="tag_class" select="' topic/entry '"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- break span tags -->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- break first p tag if there are span tags -->
- <xsl:text disable-output-escaping="yes"></text:p></xsl:text>
- <!-- start render table -->
- <xsl:call-template name="create_simpletable"/>
- <!-- start p tag again if there are span tags-->
- <xsl:text disable-output-escaping="yes"><text:p></xsl:text>
- <!-- start render span tags again-->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
- </xsl:when>
- <!-- nested by simpletable -->
- <xsl:when test="ancestor::*[contains(@class, ' topic/simpletable ')]">
- <xsl:variable name="span_depth">
- <xsl:call-template name="calculate_span_depth_for_tag">
- <xsl:with-param name="tag_class" select="' topic/stentry '"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- break span tags -->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- break first p tag if there are span tags -->
- <xsl:text disable-output-escaping="yes"></text:p></xsl:text>
- <!-- start render table -->
- <xsl:call-template name="create_simpletable"/>
- <!-- start p tag again if there are span tags-->
- <xsl:text disable-output-escaping="yes"><text:p></xsl:text>
- <!-- start render span tags again-->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- </xsl:when>
- <!-- nested by table -->
- <xsl:when test="ancestor::*[contains(@class, ' topic/table ')]">
- <xsl:variable name="span_depth">
- <xsl:call-template name="calculate_span_depth_for_tag">
- <xsl:with-param name="tag_class" select="' topic/entry '"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- break span tags -->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- break first p tag if there are span tags -->
- <xsl:text disable-output-escaping="yes"></text:p></xsl:text>
- <!-- start render table -->
- <xsl:call-template name="create_simpletable"/>
- <!-- start p tag again if there are span tags-->
- <xsl:text disable-output-escaping="yes"><text:p></xsl:text>
- <!-- start render span tags again-->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- </xsl:when>
-
- <xsl:otherwise>
- <!-- normal process -->
- <xsl:variable name="span_depth">
- <xsl:call-template name="calculate_span_depth"/>
- </xsl:variable>
- <!-- break span tags -->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- break first p tag if there are span tags -->
- <xsl:text disable-output-escaping="yes"></text:p></xsl:text>
- <!-- start render table -->
- <xsl:call-template name="create_simpletable"/>
- <!-- start p tag again if there are span tags-->
- <xsl:text disable-output-escaping="yes"><text:p></xsl:text>
- <!-- start render span tags again-->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
-
- </xsl:template>
-
-
- <xsl:template name="render_table">
- <xsl:variable name="dlentry_count_for_list" select="count(ancestor::*[contains(@class, ' topic/dlentry ')]) - count(ancestor::*[contains(@class, ' topic/li ')][1] /ancestor::*[contains(@class, ' topic/dlentry ')])"/>
-
- <xsl:variable name="fn_depth" select="count(ancestor::*[contains(@class, ' topic/fn ')][1]/ancestor::*)"/>
-
- <xsl:variable name="list_depth" select="count(ancestor::*[contains(@class, ' topic/li ')][1]/ancestor::*)"/>
-
- <xsl:variable name="dlist_depth" select="count(ancestor::*[contains(@class, ' topic/dlentry ')][1]/ancestor::*)"/>
-
- <xsl:variable name="table_depth" select="count(ancestor::*[contains(@class, ' topic/entry ')][1]/ancestor::*)"/>
-
- <xsl:variable name="stable_depth" select="count(ancestor::*[contains(@class, ' topic/stentry ')][1]/ancestor::*)"/>
-
- <xsl:variable name="max_depth" select="max(($fn_depth, $list_depth, $dlist_depth, $table_depth, $stable_depth))"/>
-
-
- <!-- if the table is under p(direct child) -->
- <xsl:choose>
- <!-- parent tag is body -->
- <xsl:when test="parent::*[contains(@class, ' topic/body ')]">
- <!-- start render table -->
- <xsl:apply-templates/>
- </xsl:when>
- <!-- nested by list -->
- <xsl:when test="ancestor::*[contains(@class, ' topic/li ')] and $dlentry_count_for_list = 0">
- <!-- nearest tag is list -->
- <xsl:choose>
- <xsl:when test="$max_depth = $list_depth">
- <!-- caculate list depth -->
- <xsl:variable name="depth">
- <xsl:call-template name="calculate_list_depth"/>
- </xsl:variable>
- <!-- caculate span tag depth -->
- <xsl:variable name="span_depth">
- <xsl:call-template name="calculate_span_depth_for_tag">
- <xsl:with-param name="tag_class" select="' topic/li '"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- break span tags -->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- break first p tag if there are span tags -->
- <xsl:if test="$span_depth >= 0">
- <xsl:text disable-output-escaping="yes"></text:p></xsl:text>
- </xsl:if>
- <!-- break list tag -->
- <xsl:call-template name="create_items_for_list">
- <xsl:with-param name="depth" select="$depth"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- start render table -->
- <xsl:apply-templates/>
- <!-- start list tag again -->
- <xsl:call-template name="create_items_for_list">
- <xsl:with-param name="depth" select="$depth"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- <!-- start p tag again if there are span tags-->
- <xsl:if test="$span_depth >= 0">
- <xsl:text disable-output-escaping="yes"><text:p></xsl:text>
- </xsl:if>
- <!-- start render span tags again-->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- </xsl:when>
- <!-- nearest tag is fn -->
- <xsl:when test="$max_depth = $fn_depth">
- <!-- normal process -->
- <xsl:variable name="span_depth">
- <xsl:call-template name="calculate_span_depth"/>
- </xsl:variable>
- <!-- break span tags -->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- break first p tag -->
- <xsl:text disable-output-escaping="yes"></text:p></xsl:text>
- <!-- start render table -->
- <xsl:apply-templates/>
- <!-- start first p tag again -->
- <xsl:text disable-output-escaping="yes"><text:p></xsl:text>
- <!-- start render span tags again-->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- </xsl:when>
- <!-- nearest tag is table -->
- <xsl:when test="$max_depth = $table_depth">
- <xsl:variable name="span_depth">
- <xsl:call-template name="calculate_span_depth_for_tag">
- <xsl:with-param name="tag_class" select="' topic/entry '"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- break span tags -->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- break first p tag if there are span tags -->
- <xsl:text disable-output-escaping="yes"></text:p></xsl:text>
- <!-- start render table -->
- <xsl:apply-templates/>
- <!-- start p tag again if there are span tags-->
- <xsl:text disable-output-escaping="yes"><text:p></xsl:text>
- <!-- start render span tags again-->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- </xsl:when>
- <!-- nearest tag is simpletable -->
- <xsl:when test="$max_depth = $stable_depth">
- <xsl:variable name="span_depth">
- <xsl:call-template name="calculate_span_depth_for_tag">
- <xsl:with-param name="tag_class" select="' topic/stentry '"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- break span tags -->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- break first p tag if there are span tags -->
- <xsl:text disable-output-escaping="yes"></text:p></xsl:text>
- <!-- start render table -->
- <xsl:apply-templates/>
- <!-- start p tag again if there are span tags-->
- <xsl:text disable-output-escaping="yes"><text:p></xsl:text>
- <!-- start render span tags again-->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
- </xsl:when>
-
- <!-- nested by dlist -->
- <xsl:when test="ancestor::*[contains(@class, ' topic/dlentry ')]">
-
- <!-- nearest tag is dlist -->
- <xsl:choose>
- <!-- nearest tag is dlist -->
- <xsl:when test="$max_depth > $dlist_depth">
- <!-- caculate list depth -->
- <xsl:variable name="depth">
- <xsl:call-template name="calculate_list_depth">
- <xsl:with-param name="list_class" select="' topic/dlentry '"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- caculate span tag depth -->
- <xsl:variable name="span_depth">
- <xsl:call-template name="calculate_span_depth_for_tag">
- <xsl:with-param name="tag_class" select="' topic/dlentry '"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- break span tags -->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- break first p tag if there are span tags -->
- <xsl:if test="$span_depth >= 0">
- <xsl:text disable-output-escaping="yes"></text:p></xsl:text>
- </xsl:if>
- <!-- break list tag -->
- <xsl:call-template name="create_items_for_list">
- <xsl:with-param name="depth" select="$depth"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- start render table -->
- <xsl:apply-templates/>
- <!-- start list tag again -->
- <xsl:call-template name="create_items_for_list">
- <xsl:with-param name="depth" select="$depth"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- <!-- start p tag again if there are span tags-->
- <xsl:if test="$span_depth >= 0">
- <xsl:text disable-output-escaping="yes"><text:p></xsl:text>
- </xsl:if>
- <!-- start render span tags again-->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- </xsl:when>
- <!-- nearest tag is fn -->
- <xsl:when test="$max_depth = $fn_depth">
- <!-- normal process -->
- <xsl:variable name="span_depth">
- <xsl:call-template name="calculate_span_depth"/>
- </xsl:variable>
- <!-- break span tags -->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- break first p tag -->
- <xsl:text disable-output-escaping="yes"></text:p></xsl:text>
- <!-- start render table -->
- <xsl:apply-templates/>
- <!-- start first p tag again -->
- <xsl:text disable-output-escaping="yes"><text:p></xsl:text>
- <!-- start render span tags again-->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- </xsl:when>
- <!-- nearest tag is table -->
- <xsl:when test="$max_depth = $table_depth">
- <xsl:variable name="span_depth">
- <xsl:call-template name="calculate_span_depth_for_tag">
- <xsl:with-param name="tag_class" select="' topic/entry '"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- break span tags -->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- break first p tag if there are span tags -->
- <xsl:text disable-output-escaping="yes"></text:p></xsl:text>
- <!-- start render table -->
- <xsl:apply-templates/>
- <!-- start p tag again if there are span tags-->
- <xsl:text disable-output-escaping="yes"><text:p></xsl:text>
- <!-- start render span tags again-->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- </xsl:when>
- <!-- nearst tag is simpletable -->
- <xsl:when test="$max_depth = $stable_depth">
- <xsl:variable name="span_depth">
- <xsl:call-template name="calculate_span_depth_for_tag">
- <xsl:with-param name="tag_class" select="' topic/stentry '"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- break span tags -->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- break first p tag if there are span tags -->
- <xsl:text disable-output-escaping="yes"></text:p></xsl:text>
- <!-- start render table -->
- <xsl:apply-templates/>
- <!-- start p tag again if there are span tags-->
- <xsl:text disable-output-escaping="yes"><text:p></xsl:text>
- <!-- start render span tags again-->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
-
- </xsl:when>
- <!-- nested by simpletable -->
- <xsl:when test="ancestor::*[contains(@class, ' topic/simpletable ')]">
- <xsl:variable name="span_depth">
- <xsl:call-template name="calculate_span_depth_for_tag">
- <xsl:with-param name="tag_class" select="' topic/stentry '"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- break span tags -->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- break first p tag if there are span tags -->
- <xsl:text disable-output-escaping="yes"></text:p></xsl:text>
- <!-- start render table -->
- <xsl:apply-templates/>
- <!-- start p tag again if there are span tags-->
- <xsl:text disable-output-escaping="yes"><text:p></xsl:text>
- <!-- start render span tags again-->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- </xsl:when>
- <!-- nested by table -->
- <xsl:when test="ancestor::*[contains(@class, ' topic/table ')]">
- <xsl:variable name="span_depth">
- <xsl:call-template name="calculate_span_depth_for_tag">
- <xsl:with-param name="tag_class" select="' topic/entry '"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- break span tags -->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- break first p tag if there are span tags -->
- <xsl:text disable-output-escaping="yes"></text:p></xsl:text>
- <!-- start render table -->
- <xsl:apply-templates/>
- <!-- start p tag again if there are span tags-->
- <xsl:text disable-output-escaping="yes"><text:p></xsl:text>
- <!-- start render span tags again-->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- </xsl:when>
-
- <xsl:otherwise>
- <!-- normal process -->
- <xsl:variable name="span_depth">
- <xsl:call-template name="calculate_span_depth"/>
- </xsl:variable>
- <!-- break span tags -->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- break first p tag -->
- <xsl:text disable-output-escaping="yes"></text:p></xsl:text>
- <!-- start render table -->
- <xsl:apply-templates/>
- <!-- start first p tag again -->
- <xsl:text disable-output-escaping="yes"><text:p></xsl:text>
- <!-- start render span tags again-->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
-
- </xsl:template>
-
- <xsl:template name="render_list">
- <xsl:param name="list_style"/>
- <xsl:variable name="li_count_for_table" select="count(ancestor::*[contains(@class, ' topic/li ')]) -
- count(ancestor::*[contains(@class, ' topic/entry ')][1]
- /ancestor::*[contains(@class, ' topic/li ')])"/>
-
- <xsl:variable name="li_count_for_simpletable" select="count(ancestor::*[contains(@class, ' topic/li ')]) -
- count(ancestor::*[contains(@class, ' topic/stentry ')][1]
- /ancestor::*[contains(@class, ' topic/li ')])"/>
-
- <xsl:variable name="dlentry_count_for_table" select="count(ancestor::*[contains(@class, ' topic/dlentry ')]) -
- count(ancestor::*[contains(@class, ' topic/entry ')][1]
- /ancestor::*[contains(@class, ' topic/dlentry ')])"/>
-
- <xsl:variable name="dlentry_count_for_simpletable" select="count(ancestor::*[contains(@class, ' topic/dlentry ')]) -
- count(ancestor::*[contains(@class, ' topic/stentry ')][1]
- /ancestor::*[contains(@class, ' topic/dlentry ')])"/>
-
- <xsl:variable name="dlentry_count_for_list" select="count(ancestor::*[contains(@class, ' topic/dlentry ')]) -
- count(ancestor::*[contains(@class, ' topic/li ')][1]
- /ancestor::*[contains(@class, ' topic/dlentry ')])"/>
-
-
- <xsl:choose>
- <!-- parent tag is body -->
- <xsl:when test="parent::*[contains(@class, ' topic/body ')]">
- <!-- start flagging -->
- <xsl:apply-templates select="." mode="start-add-odt-flags">
- <xsl:with-param name="family" select="'_list'"/>
- </xsl:apply-templates>
- <!-- start render list -->
- <text:list text:style-name="{$list_style}">
- <xsl:apply-templates/>
- </text:list>
- <!-- end flagging -->
- <xsl:apply-templates select="." mode="end-add-odt-flags">
- <xsl:with-param name="family" select="'_list'"/>
- </xsl:apply-templates>
- </xsl:when>
- <!-- parent by list -->
- <xsl:when test="parent::*[contains(@class, ' topic/li ')] or parent::*[contains(@class, ' topic/sli ')]">
- <!-- start flagging -->
- <xsl:apply-templates select="." mode="start-add-odt-flags">
- <xsl:with-param name="family" select="'_list'"/>
- </xsl:apply-templates>
- <!-- start render list -->
- <text:list text:style-name="{$list_style}">
- <xsl:apply-templates/>
- </text:list>
- <!-- end flagging -->
- <xsl:apply-templates select="." mode="end-add-odt-flags">
- <xsl:with-param name="family" select="'_list'"/>
- </xsl:apply-templates>
- </xsl:when>
- <!-- parent by entry-->
- <xsl:when test="parent::*[contains(@class, ' topic/entry ')]">
- <!-- start flagging -->
- <xsl:apply-templates select="." mode="start-add-odt-flags">
- <xsl:with-param name="family" select="'_list'"/>
- </xsl:apply-templates>
- <!-- start render list -->
- <text:list text:style-name="{$list_style}">
- <xsl:apply-templates/>
- </text:list>
- <!-- end flagging -->
- <xsl:apply-templates select="." mode="end-add-odt-flags">
- <xsl:with-param name="family" select="'_list'"/>
- </xsl:apply-templates>
- </xsl:when>
- <!-- parent by stentry-->
- <xsl:when test="parent::*[contains(@class, ' topic/stentry ')]">
- <!-- start flagging -->
- <xsl:apply-templates select="." mode="start-add-odt-flags">
- <xsl:with-param name="family" select="'_list'"/>
- </xsl:apply-templates>
- <!-- start render list -->
- <text:list text:style-name="{$list_style}">
- <xsl:apply-templates/>
- </text:list>
- <!-- end flagging -->
- <xsl:apply-templates select="." mode="end-add-odt-flags">
- <xsl:with-param name="family" select="'_list'"/>
- </xsl:apply-templates>
- </xsl:when>
- <!-- parent tag is fn -->
- <xsl:when test="parent::*[contains(@class, ' topic/fn ')]">
- <!-- break span tag(for flagging)-->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="1"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- break p tag -->
- <xsl:text disable-output-escaping="yes"></text:p></xsl:text>
- <!-- start flagging -->
- <xsl:apply-templates select="." mode="start-add-odt-flags">
- <xsl:with-param name="family" select="'_list'"/>
- </xsl:apply-templates>
- <!-- start render list -->
- <text:list text:style-name="{$list_style}">
- <xsl:apply-templates/>
- </text:list>
- <!-- end flagging -->
- <xsl:apply-templates select="." mode="end-add-odt-flags">
- <xsl:with-param name="family" select="'_list'"/>
- </xsl:apply-templates>
- <!-- start p tag again -->
- <xsl:text disable-output-escaping="yes"><text:p text:style-name="footnote"></xsl:text>
- <!-- start render span tags again-->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="1"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- </xsl:when>
-
- <!-- nearest ancestor tag is table -->
- <xsl:when test="ancestor::*[contains(@class, ' topic/entry ')] and $li_count_for_table = 0 and $dlentry_count_for_table = 0">
- <xsl:variable name="span_depth">
- <xsl:call-template name="calculate_span_depth_for_tag">
- <xsl:with-param name="tag_class" select="' topic/entry '"/>
- </xsl:call-template>
- </xsl:variable>
-
- <!-- break span tags -->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- break first p tag -->
- <xsl:text disable-output-escaping="yes"></text:p></xsl:text>
- <!-- start flagging -->
- <xsl:apply-templates select="." mode="start-add-odt-flags">
- <xsl:with-param name="family" select="'_list'"/>
- </xsl:apply-templates>
- <!-- start render list -->
- <text:list text:style-name="{$list_style}">
- <xsl:apply-templates/>
- </text:list>
- <!-- end flagging -->
- <xsl:apply-templates select="." mode="end-add-odt-flags">
- <xsl:with-param name="family" select="'_list'"/>
- </xsl:apply-templates>
- <!-- start first p tag again -->
- <xsl:text disable-output-escaping="yes"><text:p></xsl:text>
- <!-- start render span tags again-->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- </xsl:when>
-
- <!-- nearest ancestor tag is simpletable -->
- <xsl:when test="ancestor::*[contains(@class, ' topic/stentry ')] and $li_count_for_simpletable = 0
- and $dlentry_count_for_simpletable = 0">
- <xsl:variable name="span_depth">
- <xsl:call-template name="calculate_span_depth_for_tag">
- <xsl:with-param name="tag_class" select="' topic/stentry '"/>
- </xsl:call-template>
- </xsl:variable>
-
- <!-- break span tags -->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- break first p tag -->
- <xsl:text disable-output-escaping="yes"></text:p></xsl:text>
- <!-- start flagging -->
- <xsl:apply-templates select="." mode="start-add-odt-flags">
- <xsl:with-param name="family" select="'_list'"/>
- </xsl:apply-templates>
- <!-- start render list -->
- <text:list text:style-name="{$list_style}">
- <xsl:apply-templates/>
- </text:list>
- <!-- end flagging -->
- <xsl:apply-templates select="." mode="end-add-odt-flags">
- <xsl:with-param name="family" select="'_list'"/>
- </xsl:apply-templates>
- <!-- start first p tag again -->
- <xsl:text disable-output-escaping="yes"><text:p></xsl:text>
- <!-- start render span tags again-->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- </xsl:when>
-
- <!-- nearest ancestor tag is li -->
- <xsl:when test="ancestor::*[contains(@class, ' topic/li ')] and $dlentry_count_for_list = 0">
- <xsl:variable name="span_depth">
- <xsl:call-template name="calculate_span_depth_for_tag">
- <xsl:with-param name="tag_class" select="' topic/li '"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- break span tags -->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- break first p tag -->
- <xsl:text disable-output-escaping="yes"></text:p></xsl:text>
- <!-- start flagging -->
- <xsl:apply-templates select="." mode="start-add-odt-flags">
- <xsl:with-param name="family" select="'_list'"/>
- </xsl:apply-templates>
- <!-- start render list -->
- <text:list text:style-name="{$list_style}">
- <xsl:apply-templates/>
- </text:list>
- <!-- end flagging -->
- <xsl:apply-templates select="." mode="end-add-odt-flags">
- <xsl:with-param name="family" select="'_list'"/>
- </xsl:apply-templates>
- <!-- start first p tag again -->
- <xsl:text disable-output-escaping="yes"><text:p></xsl:text>
- <!-- start render span tags again-->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- </xsl:when>
-
- <!-- nearest ancestor tag is dlentry -->
- <xsl:when test="ancestor::*[contains(@class, ' topic/dlentry ')]">
- <xsl:variable name="span_depth">
- <xsl:call-template name="calculate_span_depth_for_tag">
- <xsl:with-param name="tag_class" select="' topic/dlentry '"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- break span tags -->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- break first p tag -->
- <xsl:text disable-output-escaping="yes"></text:p></xsl:text>
- <!-- start flagging -->
- <xsl:apply-templates select="." mode="start-add-odt-flags">
- <xsl:with-param name="family" select="'_list'"/>
- </xsl:apply-templates>
- <!-- start render list -->
- <text:list text:style-name="{$list_style}">
- <xsl:apply-templates/>
- </text:list>
- <!-- end flagging -->
- <xsl:apply-templates select="." mode="end-add-odt-flags">
- <xsl:with-param name="family" select="'_list'"/>
- </xsl:apply-templates>
- <!-- start first p tag again -->
- <xsl:text disable-output-escaping="yes"><text:p></xsl:text>
- <!-- start render span tags again-->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- </xsl:when>
- <!-- nearest ancestor tag is fn -->
- <xsl:when test="ancestor::*[contains(@class, ' topic/fn ')]">
- <xsl:variable name="span_depth">
- <xsl:call-template name="calculate_span_depth_for_tag"/>
- </xsl:variable>
- <!-- break span tags -->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- break first p tag -->
- <xsl:text disable-output-escaping="yes"></text:p></xsl:text>
- <!-- start flagging -->
- <xsl:apply-templates select="." mode="start-add-odt-flags">
- <xsl:with-param name="family" select="'_list'"/>
- </xsl:apply-templates>
- <!-- start render list -->
- <text:list text:style-name="{$list_style}">
- <xsl:apply-templates/>
- </text:list>
- <!-- end flagging -->
- <xsl:apply-templates select="." mode="end-add-odt-flags">
- <xsl:with-param name="family" select="'_list'"/>
- </xsl:apply-templates>
- <!-- start first p tag again -->
- <xsl:text disable-output-escaping="yes"><text:p text:style-name="footnote"></xsl:text>
- <!-- start render span tags again-->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- </xsl:when>
- <!-- nested by other tags. -->
- <xsl:otherwise>
- <xsl:variable name="span_depth">
- <xsl:call-template name="calculate_span_depth"/>
- </xsl:variable>
- <!-- break span tags -->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="0"/>
- </xsl:call-template>
- <!-- break first p tag -->
- <xsl:text disable-output-escaping="yes"></text:p></xsl:text>
- <!-- start flagging -->
- <xsl:apply-templates select="." mode="start-add-odt-flags">
- <xsl:with-param name="family" select="'_list'"/>
- </xsl:apply-templates>
- <!-- start render list -->
- <text:list text:style-name="{$list_style}">
- <xsl:apply-templates/>
- </text:list>
- <!-- end flagging -->
- <xsl:apply-templates select="." mode="end-add-odt-flags">
- <xsl:with-param name="family" select="'_list'"/>
- </xsl:apply-templates>
- <!-- start first p tag again -->
- <xsl:text disable-output-escaping="yes"><text:p></xsl:text>
- <!-- start render span tags again-->
- <xsl:call-template name="break_span_tags">
- <xsl:with-param name="depth" select="$span_depth"/>
- <xsl:with-param name="order" select="1"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!-- =========== FUNCTIONS FOR RELATED-LINKS =========== -->
- <!-- same file or not -->
- <xsl:template name="check_file_location">
- <xsl:choose>
- <xsl:when test="@href and starts-with(@href,'#')">
- <xsl:value-of select="'true'"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="'false'"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="format_href_value">
- <xsl:choose>
- <xsl:when test="@href and starts-with(@href,'#')">
- <xsl:choose>
- <!-- get element id -->
- <xsl:when test="contains(@href,'/')">
- <xsl:value-of select="concat('#', substring-after(@href,'/'))"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="@href"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:when test="@href and contains(@href,'#')">
- <xsl:value-of select="substring-before(@href,'#')"/>
- </xsl:when>
- <xsl:when test="@href and not(@href='')">
- <xsl:value-of select="@href"/>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
- <!-- create related links -->
- <xsl:template name="create_related_links">
- <xsl:param name="samefile"/>
- <xsl:param name="text"/>
- <xsl:param name="href-value"/>
-
- <xsl:choose>
- <xsl:when test="@href and not(@href='')">
- <text:a>
- <xsl:choose>
- <xsl:when test="$samefile='true'">
- <xsl:attribute name="xlink:href">
- <xsl:value-of select="$href-value"/>
- </xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <xsl:variable name="NORMAMLIZEDOUTPUT" select="translate($OUTPUTDIR, '\', '/')"/>
- <xsl:attribute name="xlink:href">
- <xsl:value-of select="concat($FILEREF, $NORMAMLIZEDOUTPUT, '/', $href-value)"/>
- </xsl:attribute>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:call-template name="gen-linktxt"/>
- <xsl:if test="contains(@class,' topic/link ')">
- <xsl:apply-templates select="*[contains(@class,' topic/desc ')]"/>
- <text:line-break/>
- </xsl:if>
- </text:a>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="output-message">
- <xsl:with-param name="id" select="'DOTX028E'"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="gen-linktxt">
- <xsl:choose>
- <xsl:when test="contains(@class,' topic/xref ')">
- <xsl:choose>
- <xsl:when test="text() or *">
- <xsl:apply-templates/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="@href"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:when test="contains(@class,' topic/link ')">
- <xsl:choose>
- <xsl:when test="*[contains(@class,' topic/linktext ')]">
- <xsl:value-of select="*[contains(@class,' topic/linktext ')]"/>
- </xsl:when>
- <xsl:when test="text()">
- <xsl:value-of select="text()"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="@href"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="*" mode="ditamsg:draft-comment-in-content">
- <xsl:call-template name="output-message">
- <xsl:with-param name="id" select="'DOTX040I'"/>
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template match="*" mode="ditamsg:required-cleanup-in-content">
- <xsl:call-template name="output-message">
- <xsl:with-param name="id" select="'DOTX039W'"/>
- </xsl:call-template>
- </xsl:template>
-
- </xsl:stylesheet>
|