| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979 |
- <?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. 2004, 2005 All Rights Reserved. -->
- <!-- 20090904 RDA: Add support for stepsection; combine duplicated logic
- for main steps and steps-unordered templates. -->
- <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:xs="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"
- xmlns:related-links="http://dita-ot.sourceforge.net/ns/200709/related-links"
- xmlns:dita2html="http://dita-ot.sourceforge.net/ns/200801/dita2html"
- xmlns:ditamsg="http://dita-ot.sourceforge.net/ns/200704/ditamsg"
- version="2.0"
- exclude-result-prefixes="xs related-links dita2html ditamsg">
- <xsl:output method="xml"/>
- <xsl:output indent="yes"/>
- <xsl:strip-space elements="*"/>
- <!-- Determines whether to generate titles for task sections. Values are YES and NO. -->
- <xsl:param name="GENERATE-TASK-LABELS" select="'NO'"/>
- <!-- == TASK UNIQUE SUBSTRUCTURES == -->
- <xsl:template match="*[contains(@class,' task/taskbody ')]" name="topic.task.taskbody">
- <!-- Added for DITA 1.1 "Shortdesc proposal" -->
- <!-- get the abstract para -->
- <xsl:apply-templates select="preceding-sibling::*[contains(@class,' topic/abstract ')]"
- mode="outofline"/>
- <!-- get the short descr para -->
- <xsl:apply-templates select="preceding-sibling::*[contains(@class,' topic/shortdesc ')]"
- mode="outofline"/>
- <!-- Insert pre-req links here, after shortdesc - unless there is a prereq section about -->
- <xsl:if test="not(*[contains(@class,' task/prereq ')])">
- <xsl:apply-templates select="following-sibling::*[contains(@class,' topic/related-links ')]"
- mode="prereqs"/>
- </xsl:if>
- <xsl:apply-templates/>
- </xsl:template>
- <xsl:template match="*[contains(@class,' task/prereq ')]" mode="get-output-class">p</xsl:template>
- <xsl:template match="*[contains(@class,' task/prereq ')]" name="topic.task.prereq">
-
- <xsl:apply-templates select="." mode="prereq-fmt"/>
- </xsl:template>
- <xsl:template match="*[contains(@class,' task/prereq ')]" mode="prereq-fmt">
-
- <!-- Title is not allowed now, but if we add it, make sure it is processed as in section -->
- <text:p>
- <text:span>
- <!-- start add rev flagging styles -->
- <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
-
- <xsl:apply-templates select="*[not(contains(@class,' topic/title '))] | text() | comment() | processing-instruction()"/>
-
- <!-- end add rev flagging styles -->
- <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
- </text:span>
- </text:p>
- <!-- Insert pre-req links - after prereq section -->
- <xsl:apply-templates select="../following-sibling::*[contains(@class,' topic/related-links ')]"
- mode="prereqs"/>
-
- </xsl:template>
- <xsl:template match="*" mode="make-steps-compact">
- <xsl:choose>
- <!-- expand the list when one of the steps has any of these: "*/*" = step context -->
- <xsl:when test="*/*[contains(@class,' task/info ')]">yes</xsl:when>
- <xsl:when test="*/*[contains(@class,' task/stepxmp ')]">yes</xsl:when>
- <xsl:when test="*/*[contains(@class,' task/tutorialinfo ')]">yes</xsl:when>
- <xsl:when test="*/*[contains(@class,' task/stepresult ')]">yes</xsl:when>
- <xsl:otherwise>no</xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="*[contains(@class,' task/steps ')]" name="topic.task.steps">
- <!-- If there's one of these elements somewhere in a step, expand the whole step list -->
- <xsl:variable name="step_expand">
- <!-- set & save step_expand=yes/no for expanding/compacting list items -->
- <xsl:apply-templates select="." mode="make-steps-compact"/>
- </xsl:variable>
-
- <!-- start flagging -->
- <xsl:apply-templates select="." mode="start-add-odt-flags">
- <xsl:with-param name="family" select="'_list'"/>
- </xsl:apply-templates>
- <xsl:apply-templates select="." mode="steps-fmt">
- <xsl:with-param name="step_expand" select="$step_expand"/>
- </xsl:apply-templates>
- <!-- end flagging -->
- <xsl:apply-templates select="." mode="end-add-odt-flags">
- <xsl:with-param name="family" select="'_list'"/>
- </xsl:apply-templates>
-
- </xsl:template>
- <xsl:template
- match="*[contains(@class,' task/steps ') or contains(@class,' task/steps-unordered ')]"
- mode="common-processing-within-steps">
- <xsl:param name="step_expand"/>
- <xsl:param name="list-type">
- <xsl:choose>
- <!-- ordered list -->
- <xsl:when test="contains(@class,' task/steps ')">ordered_list_style</xsl:when>
- <!-- unordered list -->
- <xsl:otherwise>list_style</xsl:otherwise>
- </xsl:choose>
- </xsl:param>
-
- <xsl:apply-templates select="." mode="generate-task-label">
- <xsl:with-param name="use-label">
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id">
- <xsl:choose>
- <xsl:when test="contains(@class,' task/steps ')">task_procedure</xsl:when>
- <xsl:otherwise>task_procedure_unordered</xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:with-param>
- </xsl:apply-templates>
- <xsl:choose>
- <xsl:when
- test="*[contains(@class,' task/step ')] and not(*[contains(@class,' task/step ')][2])">
- <!-- Single step. Process any stepsection before the step (cannot appear after). -->
- <xsl:apply-templates select="*[contains(@class,' task/stepsection ')]"/>
- <xsl:apply-templates select="*[contains(@class,' task/step ')]" mode="onestep">
- <xsl:with-param name="step_expand" select="$step_expand"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:when test="not(*[contains(@class,' task/stepsection ')])">
- <xsl:apply-templates select="." mode="step-elements-with-no-stepsection">
- <xsl:with-param name="step_expand" select="$step_expand"/>
- <xsl:with-param name="list-type" select="$list-type"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:when
- test="*[1][contains(@class,' task/stepsection ')] and not(*[contains(@class,' task/stepsection ')][2])">
- <!-- Stepsection is first, no other appearances -->
- <xsl:apply-templates select="*[contains(@class,' task/stepsection ')]"/>
- <xsl:apply-templates select="." mode="step-elements-with-no-stepsection">
- <xsl:with-param name="step_expand" select="$step_expand"/>
- <xsl:with-param name="list-type" select="$list-type"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:otherwise>
- <!-- Stepsection elements mixed in with steps -->
- <xsl:apply-templates select="." mode="step-elements-with-stepsection">
- <xsl:with-param name="step_expand" select="$step_expand"/>
- <xsl:with-param name="list-type" select="$list-type"/>
- </xsl:apply-templates>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!-- step-elements-with-no-stepsection -->
- <xsl:template match="*" mode="step-elements-with-no-stepsection">
- <xsl:param name="step_expand"/>
- <xsl:param name="list-type"/>
- <!--
- <xsl:call-template name="setaname"/>
- -->
- <text:list text:style-name="{$list-type}">
-
- <!--
- <xsl:call-template name="commonattributes"/>
- <xsl:call-template name="gen-style"/>
- <xsl:call-template name="setid"/>
- -->
- <xsl:apply-templates select="*[contains(@class,' task/step ')]" mode="steps">
- <xsl:with-param name="step_expand" select="$step_expand"/>
- </xsl:apply-templates>
- </text:list>
- </xsl:template>
-
- <!-- step-elements-with-stepsection -->
- <xsl:template match="*" mode="step-elements-with-stepsection">
- <xsl:param name="step_expand"/>
- <xsl:param name="list-type"/>
- <xsl:for-each select="*">
- <xsl:choose>
- <xsl:when test="contains(@class,' task/stepsection ')">
- <xsl:apply-templates select="."/>
- </xsl:when>
- <xsl:when
- test="contains(@class,' task/step ') and preceding-sibling::*[1][contains(@class,' task/step ')]">
- <!-- Do nothing, was pulled in through recursion -->
- </xsl:when>
- <xsl:otherwise>
- <!-- First step in a series of steps -->
- <text:list text:style-name="{$list-type}">
- <xsl:variable name="start-value">
- <xsl:if test="$list-type='ordered_list_style' and preceding-sibling::*[contains(@class,' task/step ')]">
- <!-- Restart numbering for ordered steps that were interrupted by stepsection.
- The start attribute is valid in XHTML 1.0 Transitional, but not for XHTML 1.0 Strict.
- It is possible (preferable) to keep stepsection within an <li> and use CSS to
- fix numbering, but with testing in March of 2009, this does not work in IE.
- It is possible in Firefox 3. -->
- <xsl:value-of select="count(preceding-sibling::*[contains(@class,' task/step ')])+1"/>
- </xsl:if>
- </xsl:variable>
- <xsl:apply-templates select="." mode="steps">
- <xsl:with-param name="step_expand" select="$step_expand"/>
- <xsl:with-param name="start-value" select="$start-value"/>
- </xsl:apply-templates>
- <xsl:apply-templates select="following-sibling::*[1][contains(@class,' task/step ')]"
- mode="sequence-of-steps">
- <xsl:with-param name="step_expand" select="$step_expand"/>
- </xsl:apply-templates>
- </text:list>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template match="*" mode="sequence-of-steps">
- <xsl:param name="step_expand"/>
- <xsl:apply-templates select="." mode="steps">
- <xsl:with-param name="step_expand" select="$step_expand"/>
- </xsl:apply-templates>
- <xsl:apply-templates select="following-sibling::*[1][contains(@class,' task/step ')]"
- mode="sequence-of-steps">
- <xsl:with-param name="step_expand" select="$step_expand"/>
- </xsl:apply-templates>
- </xsl:template>
- <xsl:template match="*[contains(@class,' task/stepsection ')]">
-
- <text:span>
- <!-- start add flagging styles -->
- <xsl:apply-templates select="." mode="start-add-odt-flags"/>
- <xsl:apply-templates/>
- <!-- end add flagging styles -->
- <xsl:apply-templates select="." mode="end-add-odt-flags"/>
- </text:span>
-
- </xsl:template>
- <xsl:template match="*[contains(@class,' task/steps-unordered ')]"
- name="topic.task.steps-unordered">
- <!-- If there's a block element somewhere in the step list, expand the whole list -->
- <xsl:variable name="step_expand">
- <!-- set & save step_expand=yes/no for expanding/compacting list items -->
- <xsl:apply-templates select="." mode="make-steps-compact"/>
- </xsl:variable>
-
- <!-- start flagging -->
- <xsl:apply-templates select="." mode="start-add-odt-flags">
- <xsl:with-param name="family" select="'_list'"/>
- </xsl:apply-templates>
- <!-- render list -->
- <xsl:apply-templates select="." mode="stepsunord-fmt">
- <xsl:with-param name="step_expand" select="$step_expand"/>
- </xsl:apply-templates>
- <!-- end flagging -->
- <xsl:apply-templates select="." mode="end-add-odt-flags">
- <xsl:with-param name="family" select="'_list'"/>
- </xsl:apply-templates>
-
- </xsl:template>
- <xsl:template match="*[contains(@class,' task/steps ')]" mode="steps-fmt">
- <xsl:param name="step_expand"/>
- <xsl:apply-templates select="." mode="common-processing-within-steps">
- <xsl:with-param name="step_expand" select="$step_expand"/>
- <xsl:with-param name="list-type" select="'ordered_list_style'"/>
- </xsl:apply-templates>
- </xsl:template>
- <xsl:template match="*[contains(@class,' task/steps-unordered ')]" mode="stepsunord-fmt">
- <xsl:param name="step_expand"/>
- <xsl:apply-templates select="." mode="common-processing-within-steps">
- <xsl:with-param name="step_expand" select="$step_expand"/>
- <xsl:with-param name="list-type" select="'list_style'"/>
- </xsl:apply-templates>
- </xsl:template>
- <!-- only 1 step - output as a para -->
- <xsl:template match="*[contains(@class,' task/step ')]" mode="onestep">
- <xsl:param name="step_expand"/>
- <xsl:apply-templates select="." mode="onestep-fmt">
- <xsl:with-param name="step_expand" select="$step_expand"/>
- </xsl:apply-templates>
- </xsl:template>
-
- <xsl:template match="*[contains(@class,' task/step ')]" mode="onestep-fmt">
- <xsl:param name="step_expand"/>
- <xsl:variable name="flagrules">
- <xsl:call-template name="getrules"/>
- </xsl:variable>
- <text:list text:style-name="list_style">
- <text:list-item>
- <xsl:if test="@importance='optional'">
- <text:p>
- <text:span text:style-name="bold">
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Optional'"/>
- </xsl:call-template>
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'ColonSymbol'"/>
- </xsl:call-template>
- <xsl:text> </xsl:text>
- </text:span>
- </text:p>
- </xsl:if>
-
- <xsl:if test="@importance='required'">
- <text:p>
- <text:span text:style-name="bold">
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Required'"/>
- </xsl:call-template>
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'ColonSymbol'"/>
- </xsl:call-template>
- <xsl:text> </xsl:text>
- </text:span>
- </text:p>
- </xsl:if>
- <xsl:apply-templates mode="create_list_item"/>
- </text:list-item>
- </text:list>
- </xsl:template>
- <!-- multiple steps - output as list items -->
- <xsl:template match="*[contains(@class,' task/step ')]" mode="steps">
- <xsl:param name="step_expand"/>
- <xsl:param name="start-value">0</xsl:param>
- <xsl:variable name="revtest" as="xs:integer?">
- <xsl:if test="@rev and not($FILTERFILE='') and ($DRAFT='yes')">
- <xsl:call-template name="find-active-rev-flag">
- <xsl:with-param name="allrevs" select="@rev"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:variable>
-
- <xsl:choose>
- <xsl:when test="$revtest=1">
- <!-- Rev is active - add the DIV -->
- <xsl:apply-templates select="." mode="steps-fmt">
- <xsl:with-param name="step_expand" select="$step_expand"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:otherwise>
- <!-- Rev wasn't active - process normally -->
- <xsl:apply-templates select="." mode="steps-fmt">
- <xsl:with-param name="step_expand" select="$step_expand"/>
- <xsl:with-param name="start-value" select="$start-value"/>
- </xsl:apply-templates>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="*[contains(@class,' task/step ')]" mode="steps-fmt">
- <xsl:param name="step_expand"/>
- <xsl:param name="start-value">0</xsl:param>
-
- <text:list-item>
- <xsl:if test="$start-value > 0">
- <xsl:attribute name="text:start-value">
- <xsl:value-of select="$start-value"/>
- </xsl:attribute>
- </xsl:if>
-
- <xsl:if test="@importance='optional'">
- <text:p>
- <text:span text:style-name="bold">
-
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Optional'"/>
- </xsl:call-template>
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'ColonSymbol'"/>
- </xsl:call-template>
- <xsl:text> </xsl:text>
- </text:span>
- </text:p>
- </xsl:if>
- <xsl:if test="@importance='required'">
- <text:p>
- <text:span text:style-name="bold">
-
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Required'"/>
- </xsl:call-template>
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'ColonSymbol'"/>
- </xsl:call-template>
- <xsl:text> </xsl:text>
- </text:span>
- </text:p>
- </xsl:if>
-
- <xsl:apply-templates mode="create_list_item"/>
- </text:list-item>
- </xsl:template>
- <!-- nested steps - 1 level of nesting only -->
- <xsl:template match="*[contains(@class,' task/substeps ')]" name="topic.task.substeps">
- <!-- If there's a block element somewhere in the step list, expand the whole list -->
- <xsl:variable name="sub_step_expand">
- <!-- set & save sub_step_expand=yes/no for expanding/compacting list items -->
- <xsl:apply-templates select="." mode="make-steps-compact"/>
- </xsl:variable>
-
- <xsl:apply-templates select="." mode="substeps-fmt">
- <xsl:with-param name="sub_step_expand" select="$sub_step_expand"/>
- </xsl:apply-templates>
-
- </xsl:template>
- <xsl:template match="*[contains(@class,' task/substeps ')]" mode="substeps-fmt">
- <xsl:param name="sub_step_expand"/>
- <xsl:variable name="flagrules">
- <xsl:call-template name="getrules"/>
- </xsl:variable>
- <!--
- <xsl:call-template name="setaname"/>
- -->
- <text:list text:style-name="ordered_list_style">
-
- <xsl:if test="parent::*/parent::*[contains(@class,' task/steps ')]">
- <!-- Is the grandparent an ordered step? -->
- <!--
- <xsl:attribute name="type">a</xsl:attribute>
- -->
- <!-- yup, letter these steps -->
- </xsl:if>
- <!-- otherwise, default to numbered -->
- <xsl:apply-templates>
- <xsl:with-param name="sub_step_expand" select="$sub_step_expand"/>
- </xsl:apply-templates>
- </text:list>
- </xsl:template>
- <!-- nested step -->
- <xsl:template match="*[contains(@class,' task/substep ')]" name="topic.task.substep">
- <xsl:param name="sub_step_expand"/>
- <xsl:variable name="revtest" as="xs:integer?">
- <xsl:if test="@rev and not($FILTERFILE='') and ($DRAFT='yes')">
- <!-- revision? -->
- <xsl:call-template name="find-active-rev-flag">
- <!-- active? (revtest will be 1 when active)-->
- <xsl:with-param name="allrevs" select="@rev"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$revtest=1">
- <!-- Rev is active - add the DIV -->
- <!--
- <span class="{@rev}">
- -->
- <xsl:apply-templates select="." mode="substep-fmt">
- <xsl:with-param name="sub_step_expand" select="$sub_step_expand"/>
- </xsl:apply-templates>
- <!--
- </span>
- -->
- </xsl:when>
- <xsl:otherwise>
- <!-- Rev wasn't active - process normally -->
- <xsl:apply-templates select="." mode="substep-fmt">
- <xsl:with-param name="sub_step_expand" select="$sub_step_expand"/>
- </xsl:apply-templates>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="*[contains(@class,' task/substep ')]" mode="substep-fmt">
- <xsl:param name="sub_step_expand"/>
- <xsl:variable name="flagrules">
- <xsl:call-template name="getrules"/>
- </xsl:variable>
- <text:list-item>
- <xsl:if test="$sub_step_expand='yes'">
- <!--
- <xsl:attribute name="class">substepexpand</xsl:attribute>
- -->
- </xsl:if>
- <!--
- <xsl:call-template name="commonattributes"/>
- <xsl:call-template name="gen-style">
- <xsl:with-param name="flagrules" select="$flagrules"/>
- </xsl:call-template>
- <xsl:call-template name="setidaname"/>
- <xsl:call-template name="start-flagit">
- <xsl:with-param name="flagrules" select="$flagrules"/>
- </xsl:call-template>
- <xsl:call-template name="start-revflag">
- <xsl:with-param name="flagrules" select="$flagrules"/>
- </xsl:call-template>
- -->
-
- <xsl:if test="@importance='optional'">
- <text:p>
- <text:span text:style-name="bold">
-
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Optional'"/>
- </xsl:call-template>
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'ColonSymbol'"/>
- </xsl:call-template>
- <xsl:text> </xsl:text>
- </text:span>
- </text:p>
- </xsl:if>
- <xsl:if test="@importance='required'">
- <text:p>
- <text:span text:style-name="bold">
-
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Required'"/>
- </xsl:call-template>
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'ColonSymbol'"/>
- </xsl:call-template>
- <xsl:text> </xsl:text>
- </text:span>
- </text:p>
- </xsl:if>
- <xsl:apply-templates mode="create_list_item"/>
- </text:list-item>
-
- <!--
- <xsl:call-template name="end-revflag">
- <xsl:with-param name="flagrules" select="$flagrules"/>
- </xsl:call-template>
- <xsl:call-template name="end-flagit">
- <xsl:with-param name="flagrules" select="$flagrules"/>
- </xsl:call-template>
- -->
- </xsl:template>
-
- <!-- choices contain choice items -->
- <xsl:template match="*[contains(@class,' task/choices ')]" name="topic.task.choices">
- <xsl:variable name="revtest" as="xs:integer?">
- <xsl:if test="@rev and not($FILTERFILE='') and ($DRAFT='yes')">
- <xsl:call-template name="find-active-rev-flag">
- <xsl:with-param name="allrevs" select="@rev"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$revtest=1"> <!-- Rev is active - add the DIV -->
- <xsl:apply-templates select="." mode="choices-fmt"/>
- </xsl:when>
- <xsl:otherwise> <!-- Rev wasn't active - process normally -->
- <xsl:apply-templates select="." mode="choices-fmt"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="*[contains(@class,' task/choices ')]" mode="choices-fmt">
- <xsl:variable name="flagrules">
- <xsl:call-template name="getrules"/>
- </xsl:variable>
-
- <text:list text:style-name="list_style">
-
- <xsl:apply-templates/>
- </text:list>
-
- </xsl:template>
- <!-- task choice table -->
- <xsl:template match="*[contains(@class, ' task/choicetable ')]">
- <xsl:choose>
- <!-- if the table is under p(direct child) -->
- <xsl:when test="parent::*[contains(@class, ' topic/p ')]">
- <!-- break p tag -->
- <xsl:text disable-output-escaping="yes"></text:p></xsl:text>
-
- <xsl:apply-templates/>
- <!-- start p tag again -->
- <xsl:text disable-output-escaping="yes"><text:p></xsl:text>
- </xsl:when>
- <!-- nested by list -->
- <xsl:when test="parent::*[contains(@class, ' topic/li ')] or parent::*[contains(@class, ' topic/sli ')]">
-
- <!-- 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>
- <!-- normal process -->
- <!-- start render table -->
- <xsl:variable name="tablenameId" select="generate-id(.)"/>
- <xsl:choose>
- <xsl:when test="not(./*[contains(@class,' task/chhead ')])">
- <!-- start flagging -->
- <xsl:apply-templates select="." mode="start-add-odt-flags">
- <xsl:with-param name="family" select="'_table'"/>
- </xsl:apply-templates>
- <table:table table:name="{concat('Table', $tablenameId)}">
-
- <!-- table background flagging -->
- <xsl:apply-templates select="." mode="start-add-odt-flags">
- <xsl:with-param name="family" select="'_table_attr'"/>
- </xsl:apply-templates>
- <xsl:variable name="colnumNum">
- <xsl:call-template name="count_columns_for_simpletable"/>
- </xsl:variable>
- <xsl:call-template name="create_columns_for_simpletable">
- <xsl:with-param name="column" select="$colnumNum"/>
- </xsl:call-template>
- <xsl:call-template name="create_head_for_choicetable"/>
- <xsl:apply-templates/>
- </table:table>
- <!-- end flagging -->
- <xsl:apply-templates select="." mode="end-add-odt-flags">
- <xsl:with-param name="family" select="'_table'"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="create_simpletable"/>
- </xsl:otherwise>
- </xsl:choose>
-
- <!-- 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>
- <!-- span tags 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:template>
- <!-- create choicetable header. -->
- <xsl:template name="create_head_for_choicetable">
- <table:table-header-rows>
- <table:table-row>
- <table:table-cell office:value-type="string" table:style-name="cell_style_1_task">
-
- <!-- Option is always 1nd column in the 1st row -->
-
- <text:p>
- <text:span text:style-name="bold">
-
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Option'"/>
- </xsl:call-template>
- </text:span>
- </text:p>
- </table:table-cell>
- <table:table-cell office:value-type="string" table:style-name="cell_style_2_task">
-
- <!-- Description is always 1nd column in the 1st row -->
-
- <text:p>
- <text:span text:style-name="bold">
-
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Description'"/>
- </xsl:call-template>
- </text:span>
- </text:p>
- </table:table-cell>
- </table:table-row>
- </table:table-header-rows>
- </xsl:template>
- <xsl:template match="*[contains(@class,' task/chrow ')]" priority="2">
- <xsl:param name="width-multiplier">0</xsl:param>
-
- <table:table-row>
- <xsl:apply-templates mode="emit-cell-style"/>
- </table:table-row>
- </xsl:template>
- <!-- for choption in choice table. -->
- <xsl:template match="*[contains(@class, ' task/choption ')]" mode="emit-cell-style">
- <table:table-cell office:value-type="string">
-
- <xsl:call-template name="create_style_stable"/>
- <text:p>
- <!-- choption should always bolded -->
- <text:span text:style-name="bold">
-
- <xsl:apply-templates select="text()" mode="txt_for_choicetable"/>
- </text:span>
- </text:p>
- <xsl:apply-templates select="*[@class]"/>
- </table:table-cell>
- </xsl:template>
-
- <xsl:template match="text()" mode="txt_for_choicetable">
-
- <xsl:call-template name="gen_txt_content"/>
-
- </xsl:template>
-
- <xsl:template match="*[contains(@class, ' task/cmd ')]">
- <text:p text:style-name="indent_paragraph_style">
-
- <text:span>
- <!-- start add rev flagging styles -->
- <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
- <xsl:apply-templates/>
- <!-- end add rev flagging styles -->
- <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
- </text:span>
- </text:p>
- </xsl:template>
- <xsl:template match="*[contains(@class, ' task/stepresult ')]">
-
-
- <text:p text:style-name="indent_paragraph_style">
-
- <text:span>
- <!-- start add rev flagging styles -->
- <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
-
- <xsl:apply-templates/>
-
- <!-- end add rev flagging styles -->
- <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
- </text:span>
- </text:p>
- </xsl:template>
-
- <xsl:template match="*[contains(@class,' task/info ')]" name="topic.task.info">
-
- <text:p text:style-name="indent_paragraph_style">
-
- <text:span>
- <!-- start add rev flagging styles -->
- <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
-
- <xsl:apply-templates/>
-
- <!-- end add rev flagging styles -->
- <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
- </text:span>
- </text:p>
- </xsl:template>
-
- <xsl:template match="*[contains(@class,' task/tutorialinfo ')]" name="topic.task.tutorialinfo">
-
- <text:p text:style-name="indent_paragraph_style">
-
- <text:span>
- <!-- start add rev flagging styles -->
- <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
-
- <xsl:apply-templates/>
-
- <!-- end add rev flagging styles -->
- <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
- </text:span>
- </text:p>
- </xsl:template>
-
-
-
- <!-- these para-like items need a leading space -->
- <xsl:template match="*[contains(@class,' task/stepxmp ')]" name="topic.task.stepxmp">
-
- <text:p text:style-name="indent_paragraph_style">
-
- <text:span>
- <!-- start add rev flagging styles -->
- <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
-
- <xsl:apply-templates/>
-
- <!-- end add rev flagging styles -->
- <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
- </text:span>
- </text:p>
- </xsl:template>
-
- <xsl:template match="*[contains(@class,' task/context ')]">
-
- <xsl:apply-templates select="." mode="generate-task-label">
- <xsl:with-param name="use-label">
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'task_context'"/>
- </xsl:call-template>
- </xsl:with-param>
- </xsl:apply-templates>
-
- <text:p text:style-name="indent_paragraph_style">
-
- <text:span>
- <!-- start add flagging styles -->
- <xsl:apply-templates select="." mode="start-add-odt-flags"/>
-
- <xsl:apply-templates/>
-
- <!-- end add flagging styles -->
- <xsl:apply-templates select="." mode="end-add-odt-flags"/>
- </text:span>
- </text:p>
- </xsl:template>
-
- <xsl:template match="*[contains(@class,' task/result ')]">
-
-
- <xsl:apply-templates select="." mode="generate-task-label">
- <xsl:with-param name="use-label">
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'task_results'"/>
- </xsl:call-template>
- </xsl:with-param>
- </xsl:apply-templates>
-
- <text:p>
- <text:span>
- <!-- start add flagging styles -->
- <xsl:apply-templates select="." mode="start-add-odt-flags"/>
-
- <xsl:apply-templates/>
-
- <!-- end add flagging styles -->
- <xsl:apply-templates select="." mode="end-add-odt-flags"/>
- </text:span>
- </text:p>
- </xsl:template>
-
- <xsl:template match="*[contains(@class,' task/postreq ')]">
-
-
- <xsl:apply-templates select="." mode="generate-task-label">
- <xsl:with-param name="use-label">
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'task_postreq'"/>
- </xsl:call-template>
- </xsl:with-param>
- </xsl:apply-templates>
-
- <text:p>
- <text:span>
- <!-- start add flagging styles -->
- <xsl:apply-templates select="." mode="start-add-odt-flags"/>
-
- <xsl:apply-templates/>
-
- <!-- end add flagging styles -->
- <xsl:apply-templates select="." mode="end-add-odt-flags"/>
-
- </text:span>
- </text:p>
-
- </xsl:template>
-
- <xsl:template match="*[contains(@class,' task/taskbody ')]/*[contains(@class,' topic/example ')][not(*[contains(@class,' topic/title ')])]">
- <xsl:apply-templates select="." mode="generate-task-label">
- <xsl:with-param name="use-label">
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'task_example'"/>
- </xsl:call-template>
- </xsl:with-param>
- </xsl:apply-templates>
-
- <text:p>
- <xsl:apply-templates/>
- </text:p>
- </xsl:template>
-
-
- <xsl:template match="*" mode="generate-task-label">
- <xsl:param name="use-label"/>
- <xsl:if test="$GENERATE-TASK-LABELS='YES'">
- <xsl:variable name="headLevel" select="count(ancestor::*[contains(@class,' topic/topic ')])+1"/>
- <text:p text:style-name="{concat('Heading_20_', $headLevel)}">
-
- <xsl:value-of select="$use-label"/>
- </text:p>
- <!--
- <div class="tasklabel">
- <xsl:element name="{$headLevel}">
- <xsl:attribute name="class">sectiontitle tasklabel</xsl:attribute>
- <xsl:value-of select="$use-label"/>
- </xsl:element>
- </div>
- -->
- </xsl:if>
- </xsl:template>
-
- <!-- Related links -->
- <!-- Tasks have their own group. -->
- <xsl:template match="*[contains(@class, ' topic/link ')][@type='task']" mode="related-links:get-group" name="related-links:group.task">
- <xsl:text>task</xsl:text>
- </xsl:template>
- <!-- Priority of task group. -->
- <xsl:template match="*[contains(@class, ' topic/link ')][@type='task']" mode="related-links:get-group-priority" name="related-links:group-priority.task">
- <xsl:value-of select="2"/>
- </xsl:template>
- <xsl:template match="*[contains(@class, ' topic/link ')][@type='task']" mode="related-links:result-group" name="related-links:result.task">
- <xsl:param name="links"/>
- <xsl:variable name="samefile">
- <xsl:call-template name="check_file_location"/>
- </xsl:variable>
- <xsl:variable name="href-value">
- <xsl:call-template name="format_href_value"/>
- </xsl:variable>
-
- <text:p>
- <text:span text:style-name="bold">
-
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Related tasks'"/>
- </xsl:call-template>
- </text:span>
- </text:p>
-
- <text:p>
- <xsl:call-template name="create_related_links">
- <xsl:with-param name="samefile" select="$samefile"/>
- <xsl:with-param name="href-value" select="$href-value"/>
- </xsl:call-template>
- </text:p>
- </xsl:template>
- </xsl:stylesheet>
|