dita2markdownImpl.xsl 101 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <xsl:stylesheet version="2.0"
  3. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  4. xmlns:xs="http://www.w3.org/2001/XMLSchema"
  5. xmlns:dita-ot="http://dita-ot.sourceforge.net/ns/201007/dita-ot"
  6. xmlns:dita2html="http://dita-ot.sourceforge.net/ns/200801/dita2html"
  7. xmlns:ditamsg="http://dita-ot.sourceforge.net/ns/200704/ditamsg"
  8. exclude-result-prefixes="xs dita-ot dita2html ditamsg">
  9. <!-- =========== OTHER STYLESHEET INCLUDES/IMPORTS =========== -->
  10. <xsl:import href="plugin:org.dita.base:xsl/common/output-message.xsl"/>
  11. <xsl:import href="plugin:org.dita.base:xsl/common/dita-utilities.xsl"/>
  12. <xsl:import href="plugin:org.dita.base:xsl/common/related-links.xsl"/>
  13. <xsl:import href="plugin:org.dita.base:xsl/common/dita-textonly.xsl"/>
  14. <xsl:include href="get-meta.xsl"/>
  15. <xsl:include href="rel-links.xsl"/>
  16. <xsl:include href="tables.xsl"/>
  17. <!-- =========== DEFAULT VALUES FOR EXTERNALLY MODIFIABLE PARAMETERS =========== -->
  18. <!-- Preserve DITA class ancestry in XHTML output; values are 'yes' or 'no' -->
  19. <xsl:param name="PRESERVE-DITA-CLASS" select="'no'"/>
  20. <!-- default "hide draft & cleanup content" processing parameter ('no' = hide them)-->
  21. <xsl:param name="DRAFT" select="'no'"/><!-- "no" and "yes" are valid values; non-'yes' is ignored -->
  22. <!-- default "hide index entries" processing parameter ('no' = hide them)-->
  23. <xsl:param name="INDEXSHOW" select="'no'"/><!-- "no" and "yes" are valid values; non-'yes' is ignored -->
  24. <!-- for now, disable breadcrumbs pending link group descision -->
  25. <xsl:param name="BREADCRUMBS" select="'no'"/> <!-- "no" and "yes" are valid values; non-'yes' is ignored -->
  26. <!-- the year for the copyright -->
  27. <xsl:param name="YEAR" select="format-date(current-date(), '[Y]')"/>
  28. <!-- default "output extension" processing parameter ('.html')-->
  29. <xsl:param name="OUTEXT" select="'.md'"/><!-- "htm" and "html" are valid values -->
  30. <!-- the working directory that contains the document being transformed.
  31. Needed as a directory prefix for the @conref "document()" function calls.
  32. default is '../doc/')-->
  33. <xsl:param name="WORKDIR">
  34. <xsl:apply-templates select="/processing-instruction('workdir-uri')[1]" mode="get-work-dir"/>
  35. </xsl:param>
  36. <!-- the path back to the project. Used for c.gif, delta.gif, css to allow user's to have
  37. these files in 1 location. -->
  38. <xsl:param name="PATH2PROJ">
  39. <xsl:apply-templates select="/processing-instruction('path2project-uri')[1]" mode="get-path2project"/>
  40. </xsl:param>
  41. <!-- the file name (file name and extension only - no path) of the document being transformed.
  42. Needed to help with debugging.
  43. default is 'myfile.xml')-->
  44. <xsl:param name="FILENAME"/>
  45. <xsl:param name="FILEDIR"/>
  46. <xsl:param name="CURRENTFILE" select="concat($FILEDIR, '/', $FILENAME)"/>
  47. <!-- the file name containing filter/flagging/revision information
  48. (file name and extension only - no path). - testfile: revflag.dita -->
  49. <!--xsl:param name="FILTERFILE"/-->
  50. <!-- Switch to enable or disable the generation of default meta message in html header -->
  51. <xsl:param name="genDefMeta" select="'no'"/>
  52. <xsl:param name="BASEDIR"/>
  53. <xsl:param name="OUTPUTDIR"/>
  54. <!-- get destination dir with BASEDIR and OUTPUTDIR-->
  55. <xsl:variable name="desDir">
  56. <xsl:choose>
  57. <xsl:when test="not($BASEDIR)"/> <!-- If no filterfile leave empty -->
  58. <xsl:when test="starts-with($BASEDIR, 'file:')">
  59. <xsl:value-of select="translate(concat($BASEDIR, '/', $OUTPUTDIR, '/'), '\', '/')"/>
  60. </xsl:when>
  61. <xsl:otherwise>
  62. <xsl:choose>
  63. <xsl:when test="contains($OUTPUTDIR, ':\') or contains($OUTPUTDIR, ':/')">
  64. <xsl:value-of select="'file:/'"/><xsl:value-of select="concat($OUTPUTDIR, '/')"/>
  65. </xsl:when>
  66. <xsl:when test="starts-with($OUTPUTDIR, '/')">
  67. <xsl:value-of select="'file://'"/><xsl:value-of select="concat($OUTPUTDIR, '/')"/>
  68. </xsl:when>
  69. <xsl:when test="starts-with($BASEDIR, '/')">
  70. <xsl:text>file://</xsl:text><xsl:value-of select="concat($BASEDIR, '/', $OUTPUTDIR, '/')"/>
  71. </xsl:when>
  72. <xsl:otherwise>
  73. <xsl:text>file:/</xsl:text><xsl:value-of select="translate(concat($BASEDIR, '/', $OUTPUTDIR, '/'), '\', '/')"/>
  74. </xsl:otherwise>
  75. </xsl:choose>
  76. </xsl:otherwise>
  77. </xsl:choose>
  78. </xsl:variable>
  79. <!-- Define the error message prefix identifier -->
  80. <xsl:variable name="msgprefix">DOTX</xsl:variable>
  81. <!-- these elements are never processed in a conventional presentation. can be overridden. -->
  82. <xsl:template match="*[contains(@class, ' topic/no-topic-nesting ')]"/>
  83. <!-- =========== ROOT RULE (just fall through; no side effects for new delivery contexts =========== -->
  84. <xsl:template match="/">
  85. <xsl:apply-templates/>
  86. </xsl:template>
  87. <!-- =========== NESTED TOPIC RULES =========== -->
  88. <!-- This first template rule generates the outer-level shell for a delivery context.
  89. In an override stylesheet, the same call to "chapter-setup" must be issued to
  90. maintain the consistency of overall look'n'feel of the output HTML.
  91. Match on the first DITA element -or- the first root 'topic' element. -->
  92. <xsl:template match="/dita | *[contains(@class, ' topic/topic ')]">
  93. <xsl:choose>
  94. <xsl:when test="not(parent::*)">
  95. <xsl:apply-templates select="." mode="root_element"/>
  96. </xsl:when>
  97. <xsl:otherwise>
  98. <xsl:apply-templates select="." mode="child.topic"/>
  99. </xsl:otherwise>
  100. </xsl:choose>
  101. </xsl:template>
  102. <!-- Matches /dita or a root topic -->
  103. <xsl:template match="*" mode="root_element" name="root_element">
  104. <xsl:call-template name="chapter-setup"/>
  105. </xsl:template>
  106. <!-- child topics get a div wrapper and fall through -->
  107. <xsl:template match="*[contains(@class, ' topic/topic ')]" mode="child.topic" name="child.topic">
  108. <div>
  109. <xsl:call-template name="gen-topic"/>
  110. </div>
  111. </xsl:template>
  112. <xsl:template name="gen-topic">
  113. <xsl:param name="nestlevel" as="xs:integer">
  114. <xsl:choose>
  115. <xsl:when test="count(ancestor::*[contains(@class, ' topic/topic ')]) > 9">9</xsl:when>
  116. <xsl:otherwise><xsl:sequence select="count(ancestor::*[contains(@class, ' topic/topic ')])"/></xsl:otherwise>
  117. </xsl:choose>
  118. </xsl:param>
  119. <xsl:choose>
  120. <xsl:when test="parent::dita and not(preceding-sibling::*)">
  121. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-startprop ')]/@outputclass" mode="add-ditaval-style"/>
  122. </xsl:when>
  123. <xsl:otherwise>
  124. <xsl:call-template name="commonattributes">
  125. <!--xsl:with-param name="default-output-class" select="concat('nested', $nestlevel)"/-->
  126. </xsl:call-template>
  127. </xsl:otherwise>
  128. </xsl:choose>
  129. <xsl:call-template name="gen-toc-id"/>
  130. <xsl:call-template name="setidaname"/>
  131. <xsl:apply-templates/>
  132. </xsl:template>
  133. <!-- NESTED TOPIC TITLES (sensitive to nesting depth, but are still processed for contained markup) -->
  134. <!-- 1st level - topic/title -->
  135. <!-- Condensed topic title into single template without priorities; use $headinglevel to set heading.
  136. If desired, somebody could pass in the value to manually set the heading level -->
  137. <xsl:template match="*[contains(@class, ' topic/topic ')]/*[contains(@class, ' topic/title ')]">
  138. <xsl:param name="headinglevel" as="xs:integer">
  139. <xsl:choose>
  140. <xsl:when test="count(ancestor::*[contains(@class, ' topic/topic ')]) > 6">6</xsl:when>
  141. <xsl:otherwise><xsl:sequence select="count(ancestor::*[contains(@class, ' topic/topic ')])"/></xsl:otherwise>
  142. </xsl:choose>
  143. </xsl:param>
  144. <header level="{$headinglevel}">
  145. <xsl:call-template name="commonattributes">
  146. <xsl:with-param name="default-output-class">
  147. <xsl:if test="$headinglevel eq 1 and name(..) ne 'topic'">
  148. <xsl:value-of select="name(..)"/>
  149. </xsl:if>
  150. </xsl:with-param>
  151. </xsl:call-template>
  152. <xsl:attribute name="id" select="../@id"/>
  153. <xsl:apply-templates/>
  154. </header>
  155. </xsl:template>
  156. <!-- Hide titlealts - they need to get pulled into the proper places -->
  157. <xsl:template match="*[contains(@class, ' topic/titlealts ')]"/>
  158. <!-- =========== BODY/SECTION (not sensitive to nesting depth) =========== -->
  159. <xsl:template match="*[contains(@class, ' topic/body ')]" name="topic.body">
  160. <div>
  161. <xsl:call-template name="commonattributes"/>
  162. <xsl:call-template name="setidaname"/>
  163. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-startprop ')]" mode="out-of-line"/>
  164. <xsl:apply-templates select="preceding-sibling::*[contains(@class, ' topic/abstract ')]" mode="outofline"/>
  165. <xsl:apply-templates select="preceding-sibling::*[contains(@class, ' topic/shortdesc ')]" mode="outofline"/>
  166. <xsl:apply-templates select="following-sibling::*[contains(@class, ' topic/related-links ')]" mode="prereqs"/>
  167. <xsl:apply-templates/>
  168. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-endprop ')]" mode="out-of-line"/>
  169. </div>
  170. </xsl:template>
  171. <xsl:template match="*[contains(@class, ' topic/abstract ')]">
  172. <xsl:if test="not(following-sibling::*[contains(@class, ' topic/body ')])">
  173. <xsl:apply-templates select="." mode="outofline"/>
  174. <xsl:apply-templates select="following-sibling::*[contains(@class, ' topic/related-links ')]" mode="prereqs"/>
  175. </xsl:if>
  176. </xsl:template>
  177. <xsl:template match="*[contains(@class, ' topic/abstract ')]" mode="outofline">
  178. <div>
  179. <xsl:call-template name="commonattributes"/>
  180. <xsl:apply-templates/>
  181. </div>
  182. </xsl:template>
  183. <xsl:template match="*[contains(@class, ' topic/shortdesc ')]">
  184. <xsl:choose>
  185. <xsl:when test="parent::*[contains(@class, ' topic/abstract ')]">
  186. <xsl:apply-templates select="." mode="outofline.abstract"/>
  187. </xsl:when>
  188. <xsl:when test="not(following-sibling::*[contains(@class, ' topic/body ')])">
  189. <xsl:apply-templates select="." mode="outofline"/>
  190. <xsl:apply-templates select="following-sibling::*[contains(@class, ' topic/related-links ')]" mode="prereqs"/>
  191. </xsl:when>
  192. </xsl:choose>
  193. </xsl:template>
  194. <!-- called shortdesc processing when it is in abstract -->
  195. <xsl:template match="*[contains(@class, ' topic/shortdesc ')]" mode="outofline.abstract">
  196. <xsl:choose>
  197. <xsl:when test="preceding-sibling::*[contains(@class, ' topic/p ') or contains(@class, ' topic/dl ') or
  198. contains(@class, ' topic/fig ') or contains(@class, ' topic/lines ') or
  199. contains(@class, ' topic/lq ') or contains(@class, ' topic/note ') or
  200. contains(@class, ' topic/ol ') or contains(@class, ' topic/pre ') or
  201. contains(@class, ' topic/simpletable ') or contains(@class, ' topic/sl ') or
  202. contains(@class, ' topic/table ') or contains(@class, ' topic/ul ')]">
  203. <div>
  204. <xsl:call-template name="commonattributes"/>
  205. <xsl:apply-templates/>
  206. </div>
  207. </xsl:when>
  208. <xsl:when test="following-sibling::*[contains(@class, ' topic/p ') or contains(@class, ' topic/dl ') or
  209. contains(@class, ' topic/fig ') or contains(@class, ' topic/lines ') or
  210. contains(@class, ' topic/lq ') or contains(@class, ' topic/note ') or
  211. contains(@class, ' topic/ol ') or contains(@class, ' topic/pre ') or
  212. contains(@class, ' topic/simpletable ') or contains(@class, ' topic/sl ') or
  213. contains(@class, ' topic/table ') or contains(@class, ' topic/ul ')]">
  214. <div>
  215. <xsl:call-template name="commonattributes"/>
  216. <xsl:apply-templates/>
  217. </div>
  218. </xsl:when>
  219. <xsl:otherwise>
  220. <xsl:if test="preceding-sibling::* | preceding-sibling::text()">
  221. <xsl:text> </xsl:text>
  222. </xsl:if>
  223. <span>
  224. <xsl:call-template name="commonattributes"/>
  225. <xsl:apply-templates/>
  226. </span>
  227. </xsl:otherwise>
  228. </xsl:choose>
  229. </xsl:template>
  230. <!-- called shortdesc processing - para at start of topic -->
  231. <xsl:template match="*[contains(@class, ' topic/shortdesc ')]" mode="outofline">
  232. <para>
  233. <xsl:call-template name="commonattributes"/>
  234. <xsl:apply-templates/>
  235. </para>
  236. </xsl:template>
  237. <!-- section processor - div with no generated title -->
  238. <xsl:template match="*[contains(@class, ' topic/section ')]" name="topic.section">
  239. <div>
  240. <xsl:call-template name="commonattributes">
  241. <xsl:with-param name="default-output-class">section</xsl:with-param>
  242. </xsl:call-template>
  243. <xsl:call-template name="gen-toc-id"/>
  244. <xsl:call-template name="setidaname"/>
  245. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-startprop ')]" mode="out-of-line"/>
  246. <xsl:apply-templates select="." mode="dita2html:section-heading"/>
  247. <xsl:apply-templates select="*[not(contains(@class, ' topic/title '))] | text() | comment() | processing-instruction()"/>
  248. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-endprop ')]" mode="out-of-line"/>
  249. </div>
  250. </xsl:template>
  251. <!-- example processor - div with no generated title -->
  252. <xsl:template match="*[contains(@class, ' topic/example ')]" name="topic.example">
  253. <div>
  254. <xsl:call-template name="commonattributes">
  255. <xsl:with-param name="default-output-class">example</xsl:with-param>
  256. </xsl:call-template>
  257. <xsl:call-template name="gen-toc-id"/>
  258. <xsl:call-template name="setidaname"/>
  259. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-startprop ')]" mode="out-of-line"/>
  260. <xsl:apply-templates select="." mode="dita2html:section-heading"/>
  261. <xsl:apply-templates select="*[not(contains(@class, ' topic/title '))] | text() | comment() | processing-instruction()"/>
  262. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-endprop ')]" mode="out-of-line"/>
  263. </div>
  264. </xsl:template>
  265. <!-- ===================================================================== -->
  266. <!-- =========== BASIC BODY ELEMENTS =========== -->
  267. <xsl:template match="*[contains(@class, ' topic/div ')]">
  268. <div>
  269. <xsl:call-template name="commonattributes"/>
  270. <xsl:call-template name="setid"/>
  271. <xsl:apply-templates/>
  272. </div>
  273. </xsl:template>
  274. <!-- paragraphs -->
  275. <xsl:template match="*[contains(@class, ' topic/p ')]" name="topic.p">
  276. <!-- To ensure XHTML validity, need to determine whether the DITA kids are block elements.
  277. If so, use div_class="p" instead of p -->
  278. <xsl:choose>
  279. <xsl:when test="descendant::*[contains(@class, ' topic/pre ')] or
  280. descendant::*[contains(@class, ' topic/ul ')] or
  281. descendant::*[contains(@class, ' topic/sl ')] or
  282. descendant::*[contains(@class, ' topic/ol ')] or
  283. descendant::*[contains(@class, ' topic/lq ')] or
  284. descendant::*[contains(@class, ' topic/dl ')] or
  285. descendant::*[contains(@class, ' topic/note ')] or
  286. descendant::*[contains(@class, ' topic/lines ')] or
  287. descendant::*[contains(@class, ' topic/fig ')] or
  288. descendant::*[contains(@class, ' topic/table ')] or
  289. descendant::*[contains(@class, ' topic/simpletable ')]">
  290. <div>
  291. <xsl:call-template name="commonattributes">
  292. <xsl:with-param name="default-output-class">p</xsl:with-param>
  293. </xsl:call-template>
  294. <xsl:call-template name="setid"/>
  295. <xsl:apply-templates/>
  296. </div>
  297. </xsl:when>
  298. <xsl:otherwise>
  299. <para>
  300. <xsl:call-template name="commonattributes"/>
  301. <xsl:call-template name="setid"/>
  302. <xsl:apply-templates/>
  303. </para>
  304. </xsl:otherwise>
  305. </xsl:choose>
  306. </xsl:template>
  307. <xsl:template match="*[contains(@class, ' topic/note ')]" name="topic.note">
  308. <xsl:call-template name="spec-title"/>
  309. <xsl:choose>
  310. <xsl:when test="@type = 'note'">
  311. <xsl:apply-templates select="." mode="process.note"/>
  312. </xsl:when>
  313. <xsl:when test="@type = 'tip'">
  314. <xsl:apply-templates select="." mode="process.note.tip"/>
  315. </xsl:when>
  316. <xsl:when test="@type = 'fastpath'">
  317. <xsl:apply-templates select="." mode="process.note.fastpath"/>
  318. </xsl:when>
  319. <xsl:when test="@type = 'important'">
  320. <xsl:apply-templates select="." mode="process.note.important"/>
  321. </xsl:when>
  322. <xsl:when test="@type = 'remember'">
  323. <xsl:apply-templates select="." mode="process.note.remember"/>
  324. </xsl:when>
  325. <xsl:when test="@type = 'restriction'">
  326. <xsl:apply-templates select="." mode="process.note.restriction"/>
  327. </xsl:when>
  328. <xsl:when test="@type = 'attention'">
  329. <xsl:apply-templates select="." mode="process.note.attention"/>
  330. </xsl:when>
  331. <xsl:when test="@type = 'caution'">
  332. <xsl:apply-templates select="." mode="process.note.caution"/>
  333. </xsl:when>
  334. <xsl:when test="@type = 'danger'">
  335. <xsl:apply-templates select="." mode="process.note.danger"/>
  336. </xsl:when>
  337. <xsl:when test="@type = 'warning'">
  338. <xsl:apply-templates select="." mode="process.note.warning"/>
  339. </xsl:when>
  340. <xsl:when test="@type = 'trouble'">
  341. <xsl:apply-templates select="." mode="process.note.trouble"/>
  342. </xsl:when>
  343. <xsl:when test="@type = 'other'">
  344. <xsl:apply-templates select="." mode="process.note.other"/>
  345. </xsl:when>
  346. <xsl:otherwise>
  347. <xsl:apply-templates select="." mode="process.note"/>
  348. </xsl:otherwise>
  349. </xsl:choose>
  350. </xsl:template>
  351. <xsl:template match="*" mode="process.note.common-processing">
  352. <xsl:param name="type" select="@type"/>
  353. <xsl:param name="title">
  354. <xsl:call-template name="getVariable">
  355. <xsl:with-param name="id" select="concat(upper-case(substring($type, 1, 1)),
  356. substring($type, 2))"/>
  357. </xsl:call-template>
  358. </xsl:param>
  359. <div>
  360. <xsl:call-template name="commonattributes">
  361. <xsl:with-param name="default-output-class" select="$type"/>
  362. </xsl:call-template>
  363. <xsl:call-template name="setidaname"/>
  364. <!-- Normal flags go before the generated title; revision flags only go on the content. -->
  365. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-startprop ')]/prop" mode="ditaval-outputflag"/>
  366. <strong>
  367. <xsl:value-of select="$title"/>
  368. <xsl:call-template name="getVariable">
  369. <xsl:with-param name="id" select="'ColonSymbol'"/>
  370. </xsl:call-template>
  371. </strong>
  372. <xsl:text> </xsl:text>
  373. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-startprop ')]/revprop" mode="ditaval-outputflag"/>
  374. <xsl:apply-templates/>
  375. <!-- Normal end flags and revision end flags both go out after the content. -->
  376. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-endprop ')]" mode="out-of-line"/>
  377. </div>
  378. </xsl:template>
  379. <xsl:template match="*" mode="process.note">
  380. <xsl:apply-templates select="." mode="process.note.common-processing">
  381. <!-- Force the type to note, in case new unrecognized values are added
  382. before translations exist (such as Warning) -->
  383. <xsl:with-param name="type" select="'note'"/>
  384. </xsl:apply-templates>
  385. </xsl:template>
  386. <xsl:template match="*" mode="process.note.tip">
  387. <xsl:apply-templates select="." mode="process.note.common-processing"/>
  388. </xsl:template>
  389. <xsl:template match="*" mode="process.note.fastpath">
  390. <xsl:apply-templates select="." mode="process.note.common-processing"/>
  391. </xsl:template>
  392. <xsl:template match="*" mode="process.note.important">
  393. <xsl:apply-templates select="." mode="process.note.common-processing"/>
  394. </xsl:template>
  395. <xsl:template match="*" mode="process.note.remember">
  396. <xsl:apply-templates select="." mode="process.note.common-processing"/>
  397. </xsl:template>
  398. <xsl:template match="*" mode="process.note.restriction">
  399. <xsl:apply-templates select="." mode="process.note.common-processing"/>
  400. </xsl:template>
  401. <xsl:template match="*" mode="process.note.warning">
  402. <xsl:apply-templates select="." mode="process.note.common-processing"/>
  403. </xsl:template>
  404. <xsl:template match="*" mode="process.note.attention">
  405. <xsl:apply-templates select="." mode="process.note.common-processing"/>
  406. </xsl:template>
  407. <xsl:template match="*" mode="process.note.trouble">
  408. <xsl:apply-templates select="." mode="process.note.common-processing"/>
  409. </xsl:template>
  410. <xsl:template match="*" mode="process.note.other">
  411. <xsl:choose>
  412. <xsl:when test="@othertype">
  413. <xsl:apply-templates select="." mode="process.note.common-processing">
  414. <xsl:with-param name="type" select="'note'"/>
  415. <xsl:with-param name="title" select="@othertype"/>
  416. </xsl:apply-templates>
  417. </xsl:when>
  418. <xsl:otherwise>
  419. <xsl:apply-templates select="." mode="process.note.common-processing">
  420. <xsl:with-param name="type" select="'note'"/>
  421. </xsl:apply-templates>
  422. </xsl:otherwise>
  423. </xsl:choose>
  424. </xsl:template>
  425. <!-- Caution and Danger both use a div for the title, so they do not
  426. use the common note processing template. -->
  427. <xsl:template match="*" mode="process.note.caution">
  428. <div>
  429. <xsl:call-template name="commonattributes">
  430. <xsl:with-param name="default-output-class">cautiontitle</xsl:with-param>
  431. </xsl:call-template>
  432. <xsl:call-template name="setidaname"/>
  433. <!-- Normal flags go before the generated title; revision flags only go on the content. -->
  434. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-startprop ')]/prop" mode="ditaval-outputflag"/>
  435. <xsl:call-template name="getVariable">
  436. <xsl:with-param name="id" select="'Caution'"/>
  437. </xsl:call-template>
  438. <xsl:call-template name="getVariable">
  439. <xsl:with-param name="id" select="'ColonSymbol'"/>
  440. </xsl:call-template>
  441. </div>
  442. <div>
  443. <xsl:call-template name="commonattributes">
  444. <xsl:with-param name="default-output-class">caution</xsl:with-param>
  445. </xsl:call-template>
  446. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-startprop ')]/revprop" mode="ditaval-outputflag"/>
  447. <xsl:apply-templates/>
  448. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-endprop ')]" mode="out-of-line"/>
  449. </div>
  450. </xsl:template>
  451. <xsl:template match="*" mode="process.note.danger">
  452. <div>
  453. <xsl:call-template name="commonattributes">
  454. <xsl:with-param name="default-output-class">dangertitle</xsl:with-param>
  455. </xsl:call-template>
  456. <xsl:call-template name="setidaname"/>
  457. <!-- Normal flags go before the generated title; revision flags only go on the content. -->
  458. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-startprop ')]/prop" mode="ditaval-outputflag"/>
  459. <xsl:call-template name="getVariable">
  460. <xsl:with-param name="id" select="'Danger'"/>
  461. </xsl:call-template>
  462. </div>
  463. <div>
  464. <xsl:call-template name="commonattributes">
  465. <xsl:with-param name="default-output-class">danger</xsl:with-param>
  466. </xsl:call-template>
  467. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-startprop ')]/revprop" mode="ditaval-outputflag"/>
  468. <xsl:apply-templates/>
  469. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-endprop ')]" mode="out-of-line"/>
  470. </div>
  471. </xsl:template>
  472. <!-- long quote (bibliographic association).
  473. @reftitle contains the citation for the excerpt.
  474. With a link if @href is used. -->
  475. <xsl:template match="*[contains(@class, ' topic/lq ')]" name="topic.lq">
  476. <blockquote>
  477. <xsl:call-template name="commonattributes"/>
  478. <xsl:call-template name="setidaname"/>
  479. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-startprop ')]" mode="out-of-line"/>
  480. <xsl:apply-templates/>
  481. <xsl:choose>
  482. <xsl:when test="@href">
  483. <div>
  484. <link>
  485. <xsl:attribute name="href">
  486. <xsl:call-template name="href"/>
  487. </xsl:attribute>
  488. <cite>
  489. <xsl:choose>
  490. <xsl:when test="@reftitle">
  491. <xsl:value-of select="@reftitle"/>
  492. </xsl:when>
  493. <xsl:otherwise>
  494. <xsl:value-of select="@href"/>
  495. </xsl:otherwise>
  496. </xsl:choose>
  497. </cite>
  498. </link>
  499. </div>
  500. </xsl:when>
  501. <xsl:when test="@reftitle"> <!-- Insert citation text -->
  502. <div>
  503. <cite>
  504. <xsl:value-of select="@reftitle"/>
  505. </cite>
  506. </div>
  507. </xsl:when>
  508. </xsl:choose>
  509. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-endprop ')]" mode="out-of-line"/>
  510. </blockquote>
  511. </xsl:template>
  512. <!-- =========== SINGLE PART LISTS =========== -->
  513. <!-- Unordered List -->
  514. <!-- handle all levels thru browser processing -->
  515. <xsl:template match="*[contains(@class, ' topic/ul ')]" name="topic.ul">
  516. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-startprop ')]" mode="out-of-line"/>
  517. <bulletlist>
  518. <xsl:call-template name="commonattributes"/>
  519. <xsl:apply-templates select="@compact"/>
  520. <xsl:call-template name="setid"/>
  521. <xsl:apply-templates/>
  522. </bulletlist>
  523. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-endprop ')]" mode="out-of-line"/>
  524. </xsl:template>
  525. <!-- Simple List -->
  526. <!-- handle all levels thru browser processing -->
  527. <xsl:template match="*[contains(@class, ' topic/sl ')]" name="topic.sl">
  528. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-startprop ')]" mode="out-of-line"/>
  529. <bulletlist class="simple">
  530. <xsl:call-template name="commonattributes">
  531. <xsl:with-param name="default-output-class" select="'simple'"/>
  532. </xsl:call-template>
  533. <xsl:apply-templates select="@compact"/>
  534. <xsl:call-template name="setid"/>
  535. <xsl:apply-templates/>
  536. </bulletlist>
  537. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-endprop ')]" mode="out-of-line"/>
  538. </xsl:template>
  539. <!-- Ordered List - 1st level - Handle levels 1 to 9 thru OL-TYPE attribution -->
  540. <!-- Updated to use a single template, use count and mod to set the list type -->
  541. <xsl:template match="*[contains(@class, ' topic/ol ')]" name="topic.ol">
  542. <xsl:variable name="olcount" select="count(ancestor-or-self::*[contains(@class, ' topic/ol ')])"/>
  543. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-startprop ')]" mode="out-of-line"/>
  544. <orderedlist>
  545. <xsl:call-template name="commonattributes"/>
  546. <xsl:apply-templates select="@compact"/>
  547. <xsl:choose>
  548. <xsl:when test="$olcount mod 3 = 1"/>
  549. <xsl:when test="$olcount mod 3 = 2"><xsl:attribute name="type">a</xsl:attribute></xsl:when>
  550. <xsl:otherwise><xsl:attribute name="type">i</xsl:attribute></xsl:otherwise>
  551. </xsl:choose>
  552. <xsl:call-template name="setid"/>
  553. <xsl:apply-templates/>
  554. </orderedlist>
  555. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-endprop ')]" mode="out-of-line"/>
  556. </xsl:template>
  557. <!-- list item -->
  558. <xsl:template match="*[contains(@class, ' topic/li ')]" name="topic.li">
  559. <li>
  560. <xsl:choose>
  561. <xsl:when test="parent::*/@compact = 'no'">
  562. <xsl:attribute name="class">liexpand</xsl:attribute>
  563. <!-- handle non-compact list items -->
  564. <xsl:call-template name="commonattributes">
  565. <xsl:with-param name="default-output-class" select="'liexpand'"/>
  566. </xsl:call-template>
  567. </xsl:when>
  568. <xsl:otherwise>
  569. <xsl:call-template name="commonattributes"/>
  570. </xsl:otherwise>
  571. </xsl:choose>
  572. <xsl:call-template name="setidaname"/>
  573. <xsl:apply-templates/>
  574. </li>
  575. </xsl:template>
  576. <!-- simple list item -->
  577. <xsl:template match="*[contains(@class, ' topic/sli ')]" name="topic.sli">
  578. <li>
  579. <xsl:choose>
  580. <xsl:when test="parent::*/@compact = 'no'">
  581. <xsl:attribute name="class">sliexpand</xsl:attribute>
  582. <!-- handle non-compact list items -->
  583. <xsl:call-template name="commonattributes">
  584. <xsl:with-param name="default-output-class" select="'sliexpand'"/>
  585. </xsl:call-template>
  586. </xsl:when>
  587. <xsl:otherwise>
  588. <xsl:call-template name="commonattributes"/>
  589. </xsl:otherwise>
  590. </xsl:choose>
  591. <xsl:call-template name="commonattributes"/>
  592. <xsl:call-template name="setidaname"/>
  593. <xsl:apply-templates/>
  594. </li>
  595. </xsl:template>
  596. <!-- special case of getting the number of a list item referenced by xref -->
  597. <xsl:template match="*[contains(@class, ' topic/li ')]" mode="xref">
  598. <xsl:number/>
  599. </xsl:template>
  600. <!-- list item section is like li/lq but without presentation (indent) -->
  601. <xsl:template match="*[contains(@class, ' topic/itemgroup ')]" name="topic.itemgroup">
  602. <!-- insert a space before all but the first itemgroups in a LI -->
  603. <xsl:variable name="itemgroupcount">
  604. <xsl:number count="*[contains(@class, ' topic/itemgroup ')]"/>
  605. </xsl:variable>
  606. <xsl:if test="$itemgroupcount > 1">
  607. <xsl:text> </xsl:text>
  608. </xsl:if>
  609. <xsl:choose>
  610. <xsl:when test="*[contains(@class, ' ditaot-d/ditaval-startprop ')]/revprop |
  611. *[contains(@class, ' ditaot-d/ditaval-startprop ')]/@outputclass">
  612. <span>
  613. <xsl:call-template name="commonattributes"/>
  614. <xsl:apply-templates/>
  615. </span>
  616. </xsl:when>
  617. <xsl:otherwise>
  618. <xsl:apply-templates/>
  619. </xsl:otherwise>
  620. </xsl:choose>
  621. </xsl:template>
  622. <!-- =========== DEFINITION LIST =========== -->
  623. <!-- DL -->
  624. <xsl:template match="*[contains(@class, ' topic/dl ')]" name="topic.dl">
  625. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-startprop ')]" mode="out-of-line"/>
  626. <definitionlist>
  627. <!-- handle DL compacting - default=yes -->
  628. <xsl:if test="@compact = 'no'">
  629. <xsl:attribute name="class">dlexpand</xsl:attribute>
  630. </xsl:if>
  631. <xsl:call-template name="commonattributes"/>
  632. <xsl:apply-templates select="@compact"/>
  633. <xsl:call-template name="setid"/>
  634. <xsl:apply-templates/>
  635. </definitionlist>
  636. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-endprop ')]" mode="out-of-line"/>
  637. </xsl:template>
  638. <!-- DL entry -->
  639. <xsl:template match="*[contains(@class, ' topic/dlentry ')]" name="topic.dlentry">
  640. <dlentry>
  641. <xsl:apply-templates/>
  642. </dlentry>
  643. </xsl:template>
  644. <!-- SF Patch 2185423: condensed code so that dt processing is not repeated for keyref or when $dtcount!=1
  645. Code could be reduced further by compressing the flagging templates. -->
  646. <xsl:template match="*[contains(@class, ' topic/dt ')]" mode="output-dt">
  647. <xsl:variable name="is-first-dt" select="empty(preceding-sibling::*[contains(@class, ' topic/dt ')])"/>
  648. <dt>
  649. <!-- Get xml:lang and ditaval styling from DLENTRY, then override with local -->
  650. <xsl:apply-templates select="../*[contains(@class, ' ditaot-d/ditaval-startprop ')]/@outputclass" mode="add-ditaval-style"/>
  651. <xsl:for-each select="..">
  652. <xsl:call-template name="commonattributes"/>
  653. </xsl:for-each>
  654. <xsl:call-template name="commonattributes">
  655. </xsl:call-template>
  656. <!-- handle ID on a DLENTRY -->
  657. <xsl:choose>
  658. <xsl:when test="$is-first-dt and exists(../@id) and exists(@id)">
  659. <xsl:call-template name="setidaname"/>
  660. <link id="{../@id}"/>
  661. </xsl:when>
  662. <xsl:when test="$is-first-dt and exists(../@id) and empty(@id)">
  663. <xsl:for-each select="..">
  664. <xsl:call-template name="setidaname"/>
  665. </xsl:for-each>
  666. </xsl:when>
  667. <xsl:otherwise>
  668. <xsl:call-template name="setidaname"/>
  669. </xsl:otherwise>
  670. </xsl:choose>
  671. <!-- Use flags from parent dlentry, if present -->
  672. <xsl:apply-templates select="../*[contains(@class, ' ditaot-d/ditaval-startprop ')]" mode="out-of-line"/>
  673. <xsl:apply-templates/>
  674. <xsl:apply-templates select="../*[contains(@class, ' ditaot-d/ditaval-endprop ')]" mode="out-of-line"/>
  675. </dt>
  676. </xsl:template>
  677. <!-- DL term -->
  678. <xsl:template match="*[contains(@class, ' topic/dt ')]" name="topic.dt">
  679. <xsl:choose>
  680. <xsl:when test="@keyref and @href">
  681. <link>
  682. <xsl:apply-templates select="." mode="add-linking-attributes"/>
  683. <xsl:apply-templates select="." mode="output-dt"/>
  684. </link>
  685. </xsl:when>
  686. <xsl:otherwise>
  687. <xsl:apply-templates select="." mode="output-dt"/>
  688. </xsl:otherwise>
  689. </xsl:choose>
  690. </xsl:template>
  691. <!-- DL description -->
  692. <xsl:template match="*[contains(@class, ' topic/dd ')]" name="topic.dd">
  693. <xsl:variable name="is-first-dd" select="empty(preceding-sibling::*[contains(@class, ' topic/dd ')])"/>
  694. <dd>
  695. <xsl:for-each select="..">
  696. <xsl:call-template name="commonattributes"/>
  697. </xsl:for-each>
  698. <xsl:call-template name="commonattributes">
  699. </xsl:call-template>
  700. <xsl:call-template name="setidaname"/>
  701. <xsl:apply-templates select="../*[contains(@class, ' ditaot-d/ditaval-startprop ')]" mode="out-of-line"/>
  702. <xsl:apply-templates/>
  703. <xsl:apply-templates select="../*[contains(@class, ' ditaot-d/ditaval-endprop ')]" mode="out-of-line"/>
  704. </dd>
  705. </xsl:template>
  706. <!-- DL heading -->
  707. <xsl:template match="*[contains(@class, ' topic/dlhead ')]" name="topic.dlhead">
  708. <xsl:apply-templates/>
  709. </xsl:template>
  710. <!-- DL heading, term -->
  711. <xsl:template match="*[contains(@class, ' topic/dthd ')]" name="topic.dthd">
  712. <dt>
  713. <!-- Get ditaval style and xml:lang from DLHEAD, then override with local -->
  714. <xsl:apply-templates select="../*[contains(@class, ' ditaot-d/ditaval-startprop ')]/@outputclass" mode="add-ditaval-style"/>
  715. <xsl:call-template name="commonattributes"/>
  716. <xsl:call-template name="setidaname"/>
  717. <xsl:apply-templates select="../*[contains(@class, ' ditaot-d/ditaval-startprop ')]" mode="out-of-line"/>
  718. <strong>
  719. <xsl:apply-templates/>
  720. </strong>
  721. <xsl:apply-templates select="../*[contains(@class, ' ditaot-d/ditaval-endprop ')]" mode="out-of-line"/>
  722. </dt>
  723. </xsl:template>
  724. <!-- DL heading, description -->
  725. <xsl:template match="*[contains(@class, ' topic/ddhd ')]" name="topic.ddhd">
  726. <dd>
  727. <!-- Get ditaval style and xml:lang from DLHEAD, then override with local -->
  728. <xsl:apply-templates select="../*[contains(@class, ' ditaot-d/ditaval-startprop ')]/@outputclass" mode="add-ditaval-style"/>
  729. <xsl:call-template name="commonattributes"/>
  730. <xsl:call-template name="setidaname"/>
  731. <xsl:apply-templates select="../*[contains(@class, ' ditaot-d/ditaval-startprop ')]" mode="out-of-line"/>
  732. <strong>
  733. <xsl:apply-templates/>
  734. </strong>
  735. <xsl:apply-templates select="../*[contains(@class, ' ditaot-d/ditaval-endprop ')]" mode="out-of-line"/>
  736. </dd>
  737. </xsl:template>
  738. <!-- =========== PHRASES =========== -->
  739. <!-- phrase presentational style - have to use a low priority otherwise topic/ph always wins -->
  740. <!-- should not need priority, default is low enough -->
  741. <xsl:template match="*[contains(@class, ' topic/ph ')]" name="topic.ph">
  742. <xsl:choose>
  743. <xsl:when test="@keyref and @href">
  744. <xsl:apply-templates select="." mode="turning-to-link">
  745. <xsl:with-param name="type" select="'ph'"/>
  746. </xsl:apply-templates>
  747. </xsl:when>
  748. <xsl:otherwise>
  749. <span>
  750. <xsl:call-template name="commonattributes"/>
  751. <xsl:call-template name="setidaname"/>
  752. <xsl:apply-templates/>
  753. </span>
  754. </xsl:otherwise>
  755. </xsl:choose>
  756. </xsl:template>
  757. <!-- keyword presentational style - have to use priority else topic/keyword always wins -->
  758. <!-- should not need priority, default is low enough -->
  759. <xsl:template match="*[contains(@class, ' topic/keyword ')]" name="topic.keyword">
  760. <xsl:choose>
  761. <xsl:when test="@keyref and @href">
  762. <xsl:apply-templates select="." mode="turning-to-link">
  763. <xsl:with-param name="type" select="'keyword'"/>
  764. </xsl:apply-templates>
  765. </xsl:when>
  766. <xsl:otherwise>
  767. <span class="keyword">
  768. <xsl:call-template name="commonattributes"/>
  769. <xsl:call-template name="setidaname"/>
  770. <xsl:apply-templates/>
  771. </span>
  772. </xsl:otherwise>
  773. </xsl:choose>
  774. </xsl:template>
  775. <!-- trademarks -->
  776. <!-- prepare a key for each trademark tag -->
  777. <xsl:key name="tm" match="*[contains(@class, ' topic/tm ')]" use="."/>
  778. <!-- process the TM tag -->
  779. <!-- removed priority 1 : should not be needed -->
  780. <xsl:template match="*[contains(@class, ' topic/tm ')]" name="topic.tm">
  781. <xsl:param name="root" select="root()" as="document-node()" tunnel="yes"/>
  782. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-startprop ')]" mode="out-of-line"/>
  783. <xsl:apply-templates/> <!-- output the TM content -->
  784. <!-- Test for TM area's language -->
  785. <xsl:variable name="tmtest">
  786. <xsl:apply-templates select="." mode="mark-tm-in-this-area"/>
  787. </xsl:variable>
  788. <!-- If this language should get trademark markers, continue... -->
  789. <xsl:if test="$tmtest = 'tm'">
  790. <xsl:variable name="tmvalue" select="@trademark"/>
  791. <!-- Determine if this is in a title, and should be marked -->
  792. <!-- TODO: should return boolean -->
  793. <xsl:variable name="usetitle">
  794. <xsl:if test="ancestor::*[contains(@class, ' topic/title ')]/parent::*[contains(@class, ' topic/topic ')]">
  795. <xsl:choose>
  796. <!-- Not the first one in a title -->
  797. <xsl:when test="generate-id(.) != generate-id($root/key('tm', .)[1])">skip</xsl:when>
  798. <!-- First one in the topic, BUT it appears in a shortdesc or body -->
  799. <xsl:when test="//*[contains(@class, ' topic/shortdesc ') or contains(@class, ' topic/body ')]//*[contains(@class, ' topic/tm ')][@trademark = $tmvalue]">skip</xsl:when>
  800. <xsl:otherwise>use</xsl:otherwise>
  801. </xsl:choose>
  802. </xsl:if>
  803. </xsl:variable>
  804. <!-- Determine if this is in a body, and should be marked -->
  805. <!-- TODO: should return boolean -->
  806. <xsl:variable name="usebody">
  807. <xsl:choose>
  808. <!-- If in a title or prolog, skip -->
  809. <xsl:when test="ancestor::*[contains(@class, ' topic/title ') or contains(@class, ' topic/prolog ')]/parent::*[contains(@class, ' topic/topic ')]">skip</xsl:when>
  810. <!-- If first in the document, use it -->
  811. <xsl:when test="generate-id(.) = generate-id($root/key('tm', .)[1])">use</xsl:when>
  812. <!-- If there is another before this that is in the body or shortdesc, skip -->
  813. <xsl:when test="preceding::*[contains(@class, ' topic/tm ')][@trademark = $tmvalue][ancestor::*[contains(@class, ' topic/body ') or contains(@class, ' topic/shortdesc ')]]">skip</xsl:when>
  814. <!-- Otherwise, any before this must be in a title or ignored section -->
  815. <xsl:otherwise>use</xsl:otherwise>
  816. </xsl:choose>
  817. </xsl:variable>
  818. <!-- If it should be used in a title or used in the body, output your favorite TM marker based on the attributes -->
  819. <xsl:if test="$usetitle = 'use' or $usebody = 'use'">
  820. <xsl:choose> <!-- ignore @tmtype=service or anything else -->
  821. <xsl:when test="@tmtype = 'tm'">&#x2122;</xsl:when>
  822. <xsl:when test="@tmtype = 'reg'">&#174;</xsl:when>
  823. <xsl:when test="@tmtype = 'service'">&#8480;</xsl:when>
  824. <xsl:otherwise/>
  825. </xsl:choose>
  826. </xsl:if>
  827. </xsl:if>
  828. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-endprop ')]" mode="out-of-line"/>
  829. </xsl:template>
  830. <!-- TODO: this should return boolean, not "tm" or something else -->
  831. <xsl:template match="*" mode="mark-tm-in-this-area" as="xs:string">
  832. <xsl:text>tm</xsl:text>
  833. </xsl:template>
  834. <!-- phrase "semantic" classes -->
  835. <!-- citations -->
  836. <xsl:template match="*[contains(@class, ' topic/cite ')]" name="topic.cite">
  837. <xsl:choose>
  838. <xsl:when test="@keyref and @href">
  839. <xsl:apply-templates select="." mode="turning-to-link">
  840. <xsl:with-param name="type" select="'cite'"/>
  841. </xsl:apply-templates>
  842. </xsl:when>
  843. <xsl:otherwise>
  844. <cite>
  845. <xsl:call-template name="commonattributes"/>
  846. <xsl:call-template name="setidaname"/>
  847. <xsl:apply-templates/>
  848. </cite>
  849. </xsl:otherwise>
  850. </xsl:choose>
  851. </xsl:template>
  852. <!-- quotes - only do 1 level, no flip-flopping -->
  853. <xsl:template match="*[contains(@class, ' topic/q ')]" name="topic.q">
  854. <span>
  855. <xsl:call-template name="commonattributes">
  856. <xsl:with-param name="default-output-class">q</xsl:with-param>
  857. </xsl:call-template>
  858. <xsl:call-template name="getVariable">
  859. <xsl:with-param name="id" select="'OpenQuote'"/>
  860. </xsl:call-template>
  861. <xsl:apply-templates/>
  862. <xsl:call-template name="getVariable">
  863. <xsl:with-param name="id" select="'CloseQuote'"/>
  864. </xsl:call-template>
  865. </span>
  866. </xsl:template>
  867. <xsl:template match="*[contains(@class, ' topic/term ')]" mode="output-term">
  868. <!-- Deprecated since 2.1 -->
  869. <xsl:param name="displaytext"/>
  870. <span>
  871. <xsl:call-template name="commonattributes">
  872. <xsl:with-param name="default-output-class">term</xsl:with-param>
  873. </xsl:call-template>
  874. <xsl:call-template name="setidaname"/>
  875. <xsl:choose>
  876. <xsl:when test="normalize-space($displaytext)">
  877. <xsl:value-of select="$displaytext"/>
  878. </xsl:when>
  879. <xsl:otherwise>
  880. <xsl:apply-templates/>
  881. </xsl:otherwise>
  882. </xsl:choose>
  883. </span>
  884. </xsl:template>
  885. <!-- Templates for internal usage in terms/abbreviation resolving -->
  886. <xsl:template name="getMatchingTarget" as="element()?">
  887. <xsl:param name="m_glossid" select="''" as="xs:string"/>
  888. <xsl:param name="m_entry-file-contents" as="document-node()?"/>
  889. <xsl:param name="m_reflang" select="'en-US'" as="xs:string"/>
  890. <xsl:variable name="glossentries" select="$m_entry-file-contents//*[contains(@class, ' glossentry/glossentry ')]" as="element()*"/>
  891. <xsl:choose>
  892. <xsl:when test="$m_glossid = '' and $glossentries[lang($m_reflang)]">
  893. <xsl:sequence select="$glossentries[lang($m_reflang)]"/>
  894. </xsl:when>
  895. <xsl:when test="not($m_glossid = '') and $glossentries[@id = $m_glossid][lang($m_reflang)]">
  896. <xsl:sequence select="$glossentries[@id = $m_glossid][lang($m_reflang)]"/>
  897. </xsl:when>
  898. <xsl:when test="$m_glossid = '' and $glossentries[lang($DEFAULTLANG)]">
  899. <xsl:sequence select="$glossentries[lang($DEFAULTLANG)]"/>
  900. </xsl:when>
  901. <xsl:when test="not($m_glossid = '') and $glossentries[@id = $m_glossid][lang($DEFAULTLANG)]">
  902. <xsl:sequence select="$glossentries[@id = $m_glossid][lang($DEFAULTLANG)]"/>
  903. </xsl:when>
  904. <xsl:when test="$m_glossid = '' and $glossentries[not(@xml:lang) or normalize-space(@xml:lang) = '']">
  905. <xsl:sequence select="$glossentries[not(@xml:lang) or normalize-space(@xml:lang) = ''][1]"/>
  906. </xsl:when>
  907. <xsl:when test="not($m_glossid = '') and $glossentries[@id = $m_glossid][not(@xml:lang) or normalize-space(@xml:lang) = '']">
  908. <xsl:sequence select="$glossentries[@id = $m_glossid][not(@xml:lang) or normalize-space(@xml:lang) = ''][1]"/>
  909. </xsl:when>
  910. <!--xsl:otherwise>
  911. <xsl:value-of select="'#none#'"/>
  912. </xsl:otherwise-->
  913. </xsl:choose>
  914. </xsl:template>
  915. <xsl:template match="*" mode="getMatchingSurfaceForm">
  916. <xsl:param name="m_matched-target" as="element()?"/>
  917. <xsl:param name="m_keys"/>
  918. <xsl:choose>
  919. <xsl:when test="exists($m_matched-target)">
  920. <xsl:variable name="glossentry" select="$m_matched-target"/>
  921. <xsl:choose>
  922. <xsl:when test="$glossentry//*[contains(@class, ' glossentry/glossSurfaceForm ')][normalize-space(.) != '']">
  923. <xsl:apply-templates select="$glossentry//*[contains(@class, ' glossentry/glossSurfaceForm ')][normalize-space(.) != '']" mode="dita-ot:text-only"/>
  924. </xsl:when>
  925. <xsl:otherwise>
  926. <xsl:apply-templates select="$glossentry//*[contains(@class, ' glossentry/glossterm ')]" mode="dita-ot:text-only"/>
  927. </xsl:otherwise>
  928. </xsl:choose>
  929. </xsl:when>
  930. <xsl:otherwise>
  931. <xsl:apply-templates select="." mode="ditamsg:no-glossentry-for-key">
  932. <xsl:with-param name="matching-keys" select="$m_keys"/>
  933. </xsl:apply-templates>
  934. </xsl:otherwise>
  935. </xsl:choose>
  936. </xsl:template>
  937. <xsl:template match="*" mode="getMatchingGlossdef">
  938. <xsl:param name="m_matched-target" as="element()?"/>
  939. <xsl:param name="m_keys"/>
  940. <xsl:choose>
  941. <xsl:when test="exists($m_matched-target)">
  942. <xsl:variable name="glossentry" select="$m_matched-target" as="element()?"/>
  943. <xsl:choose>
  944. <xsl:when test="$glossentry/*[contains(@class, ' glossentry/glossdef ')]">
  945. <xsl:apply-templates select="$glossentry/*[contains(@class, ' glossentry/glossdef ')]" mode="dita-ot:text-only"/>
  946. </xsl:when>
  947. <xsl:when test="$glossentry//*[contains(@class, ' glossentry/glossSurfaceForm ')][normalize-space(.) != '']">
  948. <!-- Second choice: surface form, as it may contain *slightly* more information than the original term -->
  949. <xsl:apply-templates select="$glossentry//*[contains(@class, ' glossentry/glossSurfaceForm ')][normalize-space(.) != '']" mode="dita-ot:text-only"/>
  950. </xsl:when>
  951. <xsl:otherwise>
  952. <!-- Fall back to term if there is no definition and no surface form -->
  953. <xsl:apply-templates select="$glossentry//*[contains(@class, ' glossentry/glossterm ')]" mode="dita-ot:text-only"/>
  954. </xsl:otherwise>
  955. </xsl:choose>
  956. </xsl:when>
  957. <xsl:when test="normalize-space(.) = '' and
  958. (boolean(ancestor::*[contains(@class, ' topic/copyright ')]) or generate-id(.) = generate-id(key('keyref', @keyref)[1]))">
  959. <!-- Already generating a message when looking for the term, do not generate a "missing glossentry" message here too -->
  960. </xsl:when>
  961. <xsl:when test="boolean(ancestor::*[contains(@class, ' topic/copyright ')]) or generate-id(.) = generate-id(key('keyref', @keyref)[1])">
  962. <!-- Didn't look up term because it was specified, but this is the first occurrence
  963. and the glossentry was not found, so generate "missing glossentry" message -->
  964. <xsl:apply-templates select="." mode="ditamsg:no-glossentry-for-key">
  965. <xsl:with-param name="matching-keys" select="$m_keys"/>
  966. </xsl:apply-templates>
  967. </xsl:when>
  968. </xsl:choose>
  969. </xsl:template>
  970. <xsl:template match="*" mode="getMatchingAcronym">
  971. <xsl:param name="m_matched-target" as="element()?"/>
  972. <xsl:param name="m_keys"/>
  973. <xsl:choose>
  974. <xsl:when test="exists($m_matched-target)">
  975. <xsl:variable name="glossentry" select="$m_matched-target"/>
  976. <xsl:choose>
  977. <xsl:when test="$glossentry//*[contains(@class, ' glossentry/glossStatus ')][@value = 'preferred'][1]/preceding-sibling::*[contains(@class, ' glossentry/glossAcronym ') or contains(@class, ' glossentry/glossAbbreviation ')][normalize-space(.) != '']">
  978. <xsl:apply-templates select="$glossentry//*[contains(@class, ' glossentry/glossStatus ')][@value = 'preferred'][1]/preceding-sibling::*[contains(@class, ' glossentry/glossAcronym ') or contains(@class, ' glossentry/glossAbbreviation ')][normalize-space(.) != '']" mode="dita-ot:text-only"/>
  979. </xsl:when>
  980. <xsl:when test="$glossentry//*[contains(@class, ' glossentry/glossStatus ')][@value != 'prohibited' and @value != 'obsolete'][1]/preceding-sibling::*[contains(@class, ' glossentry/glossAcronym ') or contains(@class, ' glossentry/glossAbbreviation ')][normalize-space(.) != '']">
  981. <xsl:apply-templates select="$glossentry//*[contains(@class, ' glossentry/glossStatus ')][@value != 'prohibited' and @value != 'obsolete'][1]/preceding-sibling::*[contains(@class, ' glossentry/glossAcronym ') or contains(@class, ' glossentry/glossAbbreviation ')][normalize-space(.) != '']" mode="dita-ot:text-only"/>
  982. </xsl:when>
  983. <xsl:when test="$glossentry//*[contains(@class, ' glossentry/glossAlt ')][1]/*[contains(@class, ' glossentry/glossAcronym ') or contains(@class, ' glossentry/glossAbbreviation ')][not(following-sibling::glossStatus)][normalize-space(.) != '']">
  984. <xsl:apply-templates select="$glossentry//*[contains(@class, ' glossentry/glossAlt ')][1]/*[contains(@class, ' glossentry/glossAcronym ') or contains(@class, ' glossentry/glossAbbreviation ')][count(following-sibling::glossStatus) = 0][normalize-space(.) != '']" mode="dita-ot:text-only"/>
  985. </xsl:when>
  986. <xsl:otherwise>
  987. <xsl:apply-templates select="$glossentry/*[contains(@class, ' glossentry/glossterm ')]" mode="dita-ot:text-only"/>
  988. </xsl:otherwise>
  989. </xsl:choose>
  990. </xsl:when>
  991. <xsl:otherwise>
  992. <!-- No matching entries found with reference language or default language. -->
  993. <xsl:apply-templates select="." mode="ditamsg:no-glossentry-for-key">
  994. <xsl:with-param name="matching-keys" select="$m_keys"/>
  995. </xsl:apply-templates>
  996. </xsl:otherwise>
  997. </xsl:choose>
  998. </xsl:template>
  999. <!-- Note: processing for the term specialization abbreviated-form is located in abbrev-d.xsl. -->
  1000. <xsl:key name="keyref" match="*[contains(@class, ' topic/term ')]" use="@keyref"/>
  1001. <!-- terms and abbreviated-forms -->
  1002. <xsl:template match="*[contains(@class, ' topic/term ')]" name="topic.term">
  1003. <xsl:variable name="keys" select="@keyref" as="attribute()?"/>
  1004. <xsl:choose>
  1005. <xsl:when test="@keyref and @href">
  1006. <xsl:variable name="updatedTarget" as="xs:string">
  1007. <xsl:apply-templates select="." mode="find-keyref-target"/>
  1008. </xsl:variable>
  1009. <xsl:variable name="entry-file-contents" as="document-node()?">
  1010. <xsl:if test="empty(@scope) or @scope = 'local'">
  1011. <xsl:variable name="entry-file-uri" select="concat($WORKDIR, $PATH2PROJ, @href)"/>
  1012. <xsl:sequence select="document($entry-file-uri, /)"/>
  1013. </xsl:if>
  1014. </xsl:variable>
  1015. <!-- Glossary id defined in <glossentry> -->
  1016. <xsl:variable name="glossid" select="substring-after($updatedTarget, '#')" as="xs:string"/>
  1017. <!--
  1018. Language preference.
  1019. NOTE: glossid overrides language preference.
  1020. -->
  1021. <xsl:variable name="reflang" as="xs:string?">
  1022. <xsl:call-template name="getLowerCaseLang"/>
  1023. </xsl:variable>
  1024. <xsl:variable name="matched-target" as="element()?">
  1025. <xsl:call-template name="getMatchingTarget">
  1026. <xsl:with-param name="m_entry-file-contents" select="$entry-file-contents"/>
  1027. <xsl:with-param name="m_glossid" select="$glossid"/>
  1028. <xsl:with-param name="m_reflang" select="$reflang"/>
  1029. </xsl:call-template>
  1030. </xsl:variable>
  1031. <!-- End: Language preference. -->
  1032. <!-- Text should be displayed -->
  1033. <xsl:variable name="displaytext">
  1034. <xsl:choose>
  1035. <xsl:when test="normalize-space(.) != '' and empty(processing-instruction('ditaot')[. = 'gentext'])">
  1036. <xsl:apply-templates mode="dita-ot:text-only"/>
  1037. </xsl:when>
  1038. <xsl:when test="exists(ancestor::*[contains(@class, ' topic/copyright ')]) or generate-id(.) = generate-id(key('keyref', @keyref)[1])">
  1039. <xsl:apply-templates select="." mode="getMatchingSurfaceForm">
  1040. <xsl:with-param name="m_matched-target" select="$matched-target"/>
  1041. <xsl:with-param name="m_keys" select="$keys"/>
  1042. </xsl:apply-templates>
  1043. </xsl:when>
  1044. <xsl:otherwise>
  1045. <xsl:apply-templates select="." mode="getMatchingAcronym">
  1046. <xsl:with-param name="m_matched-target" select="$matched-target"/>
  1047. <xsl:with-param name="m_keys" select="$keys"/>
  1048. </xsl:apply-templates>
  1049. </xsl:otherwise>
  1050. </xsl:choose>
  1051. </xsl:variable>
  1052. <!-- End of displaytext -->
  1053. <!-- hovertip text -->
  1054. <xsl:variable name="hovertext">
  1055. <xsl:apply-templates select="." mode="getMatchingGlossdef">
  1056. <xsl:with-param name="m_matched-target" select="$matched-target"/>
  1057. <xsl:with-param name="m_keys" select="$keys"/>
  1058. </xsl:apply-templates>
  1059. </xsl:variable>
  1060. <!-- End of hovertip text -->
  1061. <link>
  1062. <xsl:apply-templates select="." mode="add-linking-attributes"/>
  1063. <xsl:apply-templates select="." mode="add-desc-as-hoverhelp">
  1064. <xsl:with-param name="hovertext" select="$hovertext">
  1065. </xsl:with-param>
  1066. </xsl:apply-templates>
  1067. <xsl:apply-templates select="." mode="output-term">
  1068. <xsl:with-param name="displaytext" select="normalize-space($displaytext)"/>
  1069. </xsl:apply-templates>
  1070. </link>
  1071. </xsl:when>
  1072. <xsl:otherwise>
  1073. <xsl:apply-templates select="." mode="output-term">
  1074. <xsl:with-param name="displaytext">
  1075. <xsl:apply-templates select="." mode="dita-ot:text-only"/>
  1076. </xsl:with-param>
  1077. </xsl:apply-templates>
  1078. </xsl:otherwise>
  1079. </xsl:choose>
  1080. </xsl:template>
  1081. <!-- =========== BOOLEAN-STATE DATA TYPES =========== -->
  1082. <!-- Use color to indicate these types for now -->
  1083. <!-- output the tag & it's state -->
  1084. <xsl:template match="*[contains(@class, ' topic/boolean ')]" name="topic.boolean">
  1085. <span>
  1086. <xsl:call-template name="commonattributes">
  1087. <xsl:with-param name="default-output-class">boolean</xsl:with-param>
  1088. </xsl:call-template>
  1089. <xsl:call-template name="setidaname"/>
  1090. <xsl:value-of select="name()"/>
  1091. <xsl:text>: </xsl:text>
  1092. <xsl:value-of select="@state"/>
  1093. </span>
  1094. </xsl:template>
  1095. <!-- output the tag, it's name & value -->
  1096. <xsl:template match="*[contains(@class, ' topic/state ')]" name="topic.state">
  1097. <span>
  1098. <xsl:call-template name="commonattributes">
  1099. <xsl:with-param name="default-output-class">state</xsl:with-param>
  1100. </xsl:call-template>
  1101. <xsl:call-template name="setidaname"/>
  1102. <xsl:value-of select="name()"/>
  1103. <xsl:text>: </xsl:text>
  1104. <xsl:value-of select="@name"/>
  1105. <xsl:text>=</xsl:text>
  1106. <xsl:value-of select="@value"/>
  1107. </span>
  1108. </xsl:template>
  1109. <!-- =========== RECORD END RESPECTING DATA =========== -->
  1110. <!-- PRE -->
  1111. <xsl:template match="*[contains(@class, ' topic/pre ')]" name="topic.pre">
  1112. <xsl:if test="contains(@frame, 'top')">
  1113. <horizontalrule/>
  1114. </xsl:if>
  1115. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-startprop ')]" mode="out-of-line"/>
  1116. <xsl:call-template name="spec-title-nospace"/>
  1117. <codeblock>
  1118. <xsl:attribute name="xml:space">preserve</xsl:attribute>
  1119. <xsl:call-template name="commonattributes"/>
  1120. <xsl:call-template name="setscale"/>
  1121. <xsl:call-template name="setidaname"/>
  1122. <xsl:apply-templates/>
  1123. </codeblock>
  1124. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-endprop ')]" mode="out-of-line"/>
  1125. <xsl:if test="contains(@frame, 'bot')">
  1126. <horizontalrule/>
  1127. </xsl:if>
  1128. </xsl:template>
  1129. <!-- lines - body font -->
  1130. <xsl:template match="*[contains(@class, ' topic/lines ')]" name="topic.lines">
  1131. <xsl:if test="contains(@frame, 'top')">
  1132. <horizontalrule/>
  1133. </xsl:if>
  1134. <xsl:call-template name="spec-title-nospace"/>
  1135. <para>
  1136. <xsl:call-template name="commonattributes"/>
  1137. <xsl:call-template name="setscale"/>
  1138. <xsl:call-template name="setidaname"/>
  1139. <xsl:apply-templates/>
  1140. </para>
  1141. <xsl:if test="contains(@frame, 'bot')">
  1142. <horizontalrule/>
  1143. </xsl:if>
  1144. </xsl:template>
  1145. <xsl:template match="*[contains(@class, ' topic/lines ')]//text()">
  1146. <xsl:variable name="linetext" select="."/>
  1147. <xsl:variable name="linetext2">
  1148. <xsl:call-template name="sp-replace"><xsl:with-param name="sptext" select="$linetext"/></xsl:call-template>
  1149. </xsl:variable>
  1150. <xsl:call-template name="br-replace">
  1151. <xsl:with-param name="brtext" select="$linetext2"/>
  1152. </xsl:call-template>
  1153. </xsl:template>
  1154. <!-- =========== FIGURE =========== -->
  1155. <xsl:template match="*[contains(@class, ' topic/fig ')]" name="topic.fig">
  1156. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-startprop ')]" mode="out-of-line"/>
  1157. <para>
  1158. <!--xsl:call-template name="commonattributes"/>
  1159. <xsl:call-template name="setscale"/>
  1160. <xsl:call-template name="setidaname"/>
  1161. <xsl:call-template name="place-fig-lbl"/-->
  1162. <xsl:apply-templates select="node() except *[contains(@class, ' topic/title ') or contains(@class, ' topic/desc ')]"/>
  1163. </para>
  1164. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-endprop ')]" mode="out-of-line"/>
  1165. </xsl:template>
  1166. <!-- should not need priority, default is low enough; was set to 1 -->
  1167. <xsl:template match="*[contains(@class, ' topic/figgroup ')]" name="topic.figgroup">
  1168. <!-- Figgroup can contain blocks, maybe this should be a div? -->
  1169. <span>
  1170. <xsl:call-template name="commonattributes"/>
  1171. <xsl:call-template name="setidaname"/>
  1172. <!-- Allow title to fallthrough -->
  1173. <xsl:apply-templates/>
  1174. </span>
  1175. </xsl:template>
  1176. <!-- =========== IMAGE/OBJECT =========== -->
  1177. <xsl:template match="*[contains(@class, ' topic/image ')]" name="topic.image">
  1178. <xsl:choose>
  1179. <xsl:when test="@placement = 'break'"><!--Align only works for break-->
  1180. <para>
  1181. <xsl:call-template name="topic-image"/>
  1182. </para>
  1183. </xsl:when>
  1184. <xsl:otherwise>
  1185. <xsl:call-template name="topic-image"/>
  1186. </xsl:otherwise>
  1187. </xsl:choose>
  1188. </xsl:template>
  1189. <xsl:template name="topic-image">
  1190. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-startprop ')]" mode="out-of-line"/>
  1191. <image>
  1192. <xsl:call-template name="commonattributes"/>
  1193. <xsl:copy-of select="@keyref"/>
  1194. <xsl:call-template name="setid"/>
  1195. <xsl:choose>
  1196. <xsl:when test="*[contains(@class, ' topic/longdescref ')]">
  1197. <xsl:apply-templates select="*[contains(@class, ' topic/longdescref ')]"/>
  1198. </xsl:when>
  1199. <xsl:otherwise>
  1200. <xsl:apply-templates select="@longdescref"/>
  1201. </xsl:otherwise>
  1202. </xsl:choose>
  1203. <xsl:apply-templates select="@href|@height|@width"/>
  1204. <xsl:apply-templates select="@scale"/>
  1205. <xsl:choose>
  1206. <xsl:when test="*[contains(@class, ' topic/alt ')]">
  1207. <xsl:variable name="alt-content"><xsl:apply-templates select="*[contains(@class, ' topic/alt ')]" mode="text-only"/></xsl:variable>
  1208. <xsl:attribute name="alt" select="normalize-space($alt-content)"/>
  1209. </xsl:when>
  1210. <xsl:when test="@alt">
  1211. <xsl:attribute name="alt" select="@alt"/>
  1212. </xsl:when>
  1213. </xsl:choose>
  1214. <xsl:for-each select="parent::*[contains(@class, ' topic/fig ')]/*[contains(@class, ' topic/title ')]">
  1215. <xsl:attribute name="title">
  1216. <xsl:apply-templates select="." mode="text-only"/>
  1217. </xsl:attribute>
  1218. </xsl:for-each>
  1219. </image>
  1220. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-endprop ')]" mode="out-of-line"/>
  1221. </xsl:template>
  1222. <xsl:template match="*[contains(@class, ' topic/alt ')]">
  1223. <xsl:apply-templates select="." mode="text-only"/>
  1224. </xsl:template>
  1225. <xsl:template match="*[contains(@class, ' topic/image ')]/@href">
  1226. <xsl:attribute name="href" select="."/>
  1227. </xsl:template>
  1228. <xsl:template match="*[contains(@class, ' topic/image ')]/@scale">
  1229. <xsl:variable name="width" select="../@dita-ot:image-width"/>
  1230. <xsl:variable name="height" select="../@dita-ot:image-height"/>
  1231. <xsl:if test="not(../@width) and not(../@height)">
  1232. <xsl:attribute name="height" select="floor(number($height) * number(.) div 100)"/>
  1233. <xsl:attribute name="width" select="floor(number($width) * number(.) div 100)"/>
  1234. </xsl:if>
  1235. </xsl:template>
  1236. <xsl:template match="*[contains(@class, ' topic/image ')]/@height">
  1237. <xsl:variable name="height-in-pixel">
  1238. <xsl:call-template name="length-to-pixels">
  1239. <xsl:with-param name="dimen" select="."/>
  1240. </xsl:call-template>
  1241. </xsl:variable>
  1242. <xsl:if test="not($height-in-pixel = '100%')">
  1243. <xsl:attribute name="height">
  1244. <xsl:value-of select="number($height-in-pixel)"/>
  1245. </xsl:attribute>
  1246. </xsl:if>
  1247. </xsl:template>
  1248. <xsl:template match="*[contains(@class, ' topic/image ')]/@width">
  1249. <xsl:variable name="width-in-pixel">
  1250. <xsl:call-template name="length-to-pixels">
  1251. <xsl:with-param name="dimen" select="."/>
  1252. </xsl:call-template>
  1253. </xsl:variable>
  1254. <xsl:if test="not($width-in-pixel = '100%')">
  1255. <xsl:attribute name="width">
  1256. <xsl:value-of select="number($width-in-pixel)"/>
  1257. </xsl:attribute>
  1258. </xsl:if>
  1259. </xsl:template>
  1260. <xsl:template match="*[contains(@class, ' topic/image ')]/@longdescref">
  1261. <xsl:attribute name="longdesc">
  1262. <xsl:choose>
  1263. <!-- Guess whether link target is a DITA topic or something else -->
  1264. <xsl:when test="contains(., '.dita') or contains(., '.xml')">
  1265. <xsl:call-template name="replace-extension">
  1266. <xsl:with-param name="filename" select="."/>
  1267. <xsl:with-param name="extension" select="$OUTEXT"/>
  1268. </xsl:call-template>
  1269. </xsl:when>
  1270. <xsl:otherwise>
  1271. <xsl:value-of select="."/>
  1272. </xsl:otherwise>
  1273. </xsl:choose>
  1274. </xsl:attribute>
  1275. </xsl:template>
  1276. <xsl:template match="*[contains(@class, ' topic/image ')]/*[contains(@class, ' topic/longdescref ')]">
  1277. <xsl:if test="@href and not (@href = '')">
  1278. <xsl:attribute name="longdesc">
  1279. <xsl:choose>
  1280. <xsl:when test="not(@format) or @format = 'dita'">
  1281. <xsl:call-template name="replace-extension">
  1282. <xsl:with-param name="filename" select="@href"/>
  1283. <xsl:with-param name="extension" select="$OUTEXT"/>
  1284. </xsl:call-template>
  1285. </xsl:when>
  1286. <xsl:otherwise>
  1287. <xsl:value-of select="@href"/>
  1288. </xsl:otherwise>
  1289. </xsl:choose>
  1290. </xsl:attribute>
  1291. </xsl:if>
  1292. </xsl:template>
  1293. <!-- object, desc, & param -->
  1294. <xsl:template match="*[contains(@class, ' topic/object ')]" name="topic.object">
  1295. <object>
  1296. <xsl:copy-of select="@id | @declare | @codebase | @type | @archive | @height | @usemap | @tabindex | @classid | @data | @codetype | @standby | @width | @name"/>
  1297. <xsl:if test="@longdescref or *[contains(@class, ' topic/longdescref ')]">
  1298. <xsl:apply-templates select="." mode="ditamsg:longdescref-on-object"/>
  1299. </xsl:if>
  1300. <xsl:apply-templates/>
  1301. <!-- Test for Flash movie; include EMBED statement for non-IE browsers -->
  1302. <xsl:if test="contains(@codebase, 'swflash.cab')">
  1303. <embed>
  1304. <xsl:if test="@id"><xsl:attribute name="name" select="@id"/></xsl:if>
  1305. <xsl:copy-of select="@height | @width"/>
  1306. <xsl:attribute name="type"><xsl:text>application/x-shockwave-flash</xsl:text></xsl:attribute>
  1307. <xsl:attribute name="pluginspage"><xsl:text>http://www.macromedia.com/go/getflashplayer</xsl:text></xsl:attribute>
  1308. <xsl:if test="*[contains(@class, ' topic/param ')]/@name = 'movie'">
  1309. <xsl:attribute name="src" select="*[contains(@class, ' topic/param ')][@name = 'movie']/@value"/>
  1310. </xsl:if>
  1311. <xsl:if test="*[contains(@class, ' topic/param ')]/@name = 'quality'">
  1312. <xsl:attribute name="quality" select="*[contains(@class, ' topic/param ')][@name = 'quality']/@value"/>
  1313. </xsl:if>
  1314. <xsl:if test="*[contains(@class, ' topic/param ')]/@name = 'bgcolor'">
  1315. <xsl:attribute name="bgcolor" select="*[contains(@class, ' topic/param ')][@name = 'bgcolor']/@value"/>
  1316. </xsl:if>
  1317. </embed>
  1318. </xsl:if>
  1319. </object>
  1320. </xsl:template>
  1321. <xsl:template match="*[contains(@class, ' topic/param ')]" name="topic.param">
  1322. <param>
  1323. <xsl:copy-of select="@name | @id | @value"/>
  1324. </param>
  1325. </xsl:template>
  1326. <!-- need to add test for object/desc to avoid conflicts -->
  1327. <xsl:template match="*[contains(@class, ' topic/object ')]/*[contains(@class, ' topic/desc ')]" name="topic.object_desc">
  1328. <span>
  1329. <xsl:copy-of select="@name | @id | value"/>
  1330. <xsl:apply-templates/>
  1331. </span>
  1332. </xsl:template>
  1333. <!-- =========== FOOTNOTE =========== -->
  1334. <xsl:template match="*[contains(@class, ' topic/fn ')]" name="topic.fn">
  1335. <xsl:param name="xref"/>
  1336. <!-- when FN has an ID, it can only be referenced, otherwise, output an a-name & a counter -->
  1337. <xsl:if test="not(@id) or $xref = 'yes'">
  1338. <xsl:variable name="fnid"><xsl:number from="/" level="any"/></xsl:variable>
  1339. <xsl:variable name="callout" select="@callout"/>
  1340. <xsl:variable name="convergedcallout" select="if (string-length($callout)> 0) then $callout else $fnid"/>
  1341. <link name="fnsrc_{$fnid}" href="#fntarg_{$fnid}">
  1342. <superscript>
  1343. <xsl:value-of select="$convergedcallout"/>
  1344. </superscript>
  1345. </link>
  1346. </xsl:if>
  1347. </xsl:template>
  1348. <!-- =========== REQUIRED CLEANUP and REVIEW COMMENT =========== -->
  1349. <xsl:template match="*[contains(@class, ' topic/required-cleanup ')]" name="topic.required-cleanup">
  1350. <xsl:if test="$DRAFT = 'yes'">
  1351. <xsl:apply-templates select="." mode="ditamsg:required-cleanup-in-content"/>
  1352. <div>
  1353. <xsl:call-template name="commonattributes"/>
  1354. <xsl:call-template name="setidaname"/>
  1355. <strong>
  1356. <xsl:call-template name="getVariable">
  1357. <xsl:with-param name="id" select="'Required cleanup'"/>
  1358. </xsl:call-template>
  1359. <xsl:call-template name="getVariable">
  1360. <xsl:with-param name="id" select="'ColonSymbol'"/>
  1361. </xsl:call-template>
  1362. <xsl:text> </xsl:text>
  1363. </strong>
  1364. <xsl:if test="@remap">[<xsl:value-of select="@remap"/>] </xsl:if>
  1365. <xsl:apply-templates/>
  1366. </div>
  1367. </xsl:if>
  1368. </xsl:template>
  1369. <xsl:template match="*[contains(@class, ' topic/draft-comment ')]" name="topic.draft-comment">
  1370. <xsl:if test="$DRAFT = 'yes'">
  1371. <xsl:apply-templates select="." mode="ditamsg:draft-comment-in-content"/>
  1372. <div>
  1373. <xsl:call-template name="commonattributes"/>
  1374. <xsl:call-template name="setidaname"/>
  1375. <strong>
  1376. <xsl:call-template name="getVariable">
  1377. <xsl:with-param name="id" select="'Draft comment'"/>
  1378. </xsl:call-template>
  1379. <xsl:call-template name="getVariable">
  1380. <xsl:with-param name="id" select="'ColonSymbol'"/>
  1381. </xsl:call-template>
  1382. <xsl:text> </xsl:text>
  1383. </strong>
  1384. <xsl:if test="@author"><xsl:value-of select="@author"/><xsl:text> </xsl:text></xsl:if>
  1385. <xsl:if test="@disposition"><xsl:value-of select="@disposition"/><xsl:text> </xsl:text></xsl:if>
  1386. <xsl:if test="@time"><xsl:value-of select="@time"/></xsl:if>
  1387. <linebreak/>
  1388. <xsl:apply-templates/>
  1389. </div>
  1390. </xsl:if>
  1391. </xsl:template>
  1392. <!--Dita comment passthru-->
  1393. <xsl:template match="processing-instruction()">
  1394. <xsl:if test="name()='dita-comment'"><xsl:comment><xsl:value-of select="."/></xsl:comment></xsl:if>
  1395. </xsl:template>
  1396. <!-- =========== INDEX =========== -->
  1397. <!-- TBD: this needs practical implementation. currently the support merely
  1398. echoes the content back, indicating any nesting. Useful view for authoring!-->
  1399. <xsl:template match="*[contains(@class, ' topic/indexterm ')]" name="topic.indexterm">
  1400. <xsl:if test="$INDEXSHOW = 'yes'">
  1401. <xsl:choose>
  1402. <xsl:when test="@keyref and @href">
  1403. <link>
  1404. <xsl:apply-templates select="." mode="add-linking-attributes"/>
  1405. <span style="margin: 1pt; background-color: #ffddff; border: 1pt black solid;">
  1406. <xsl:call-template name="commonattributes"/>
  1407. <xsl:apply-templates/>
  1408. </span>
  1409. </link>
  1410. </xsl:when>
  1411. <xsl:otherwise>
  1412. <span style="margin: 1pt; background-color: #ffddff; border: 1pt black solid;">
  1413. <xsl:call-template name="commonattributes"/>
  1414. <xsl:apply-templates/>
  1415. </span>
  1416. </xsl:otherwise>
  1417. </xsl:choose>
  1418. </xsl:if>
  1419. </xsl:template>
  1420. <xsl:template match="*[contains(@class, ' topic/indextermref ')]"/>
  1421. <!-- ===================================================================== -->
  1422. <!-- =========== PROLOG =========== -->
  1423. <!-- all handled in get-meta.xsl -->
  1424. <xsl:template match="*[contains(@class, ' topic/prolog ')]"/>
  1425. <!-- ===================================================================== -->
  1426. <!-- ================= COMMON ATTRIBUTE PROCESSORS ====================== -->
  1427. <xsl:function name="dita-ot:generate-html-id" as="xs:string">
  1428. <xsl:param name="element" as="element()"/>
  1429. <xsl:sequence
  1430. select="if (exists($element/@id))
  1431. then $element/@id
  1432. else generate-id($element)"/>
  1433. </xsl:function>
  1434. <!-- If the element has an ID, set it as an ID and anchor-->
  1435. <!-- Set ID and output A-name -->
  1436. <xsl:template name="setidaname">
  1437. <xsl:if test="@id">
  1438. <xsl:call-template name="setidattr">
  1439. <xsl:with-param name="idvalue" select="@id"/>
  1440. </xsl:call-template>
  1441. </xsl:if>
  1442. </xsl:template>
  1443. <!-- Set ID only -->
  1444. <xsl:template name="setid">
  1445. <xsl:if test="@id">
  1446. <xsl:call-template name="setidattr">
  1447. <xsl:with-param name="idvalue" select="@id"/>
  1448. </xsl:call-template>
  1449. </xsl:if>
  1450. </xsl:template>
  1451. <!-- Set the ID attr for IE -->
  1452. <xsl:template name="setidattr">
  1453. <xsl:param name="idvalue"/>
  1454. <xsl:attribute name="id" select="$idvalue"/>
  1455. </xsl:template>
  1456. <!-- Create & insert an ID for the generated table of contents -->
  1457. <xsl:template name="gen-toc-id">
  1458. </xsl:template>
  1459. <!-- Process standard attributes that may appear anywhere. Previously this was "setclass" -->
  1460. <xsl:template name="commonattributes">
  1461. <xsl:param name="default-output-class"/>
  1462. <!--xsl:apply-templates select="@xml:lang"/>
  1463. <xsl:apply-templates select="@dir"/-->
  1464. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-startprop ')]/@outputclass" mode="add-ditaval-style"/>
  1465. <xsl:apply-templates select="." mode="set-output-class">
  1466. <xsl:with-param name="default" select="$default-output-class"/>
  1467. </xsl:apply-templates>
  1468. </xsl:template>
  1469. <!-- Set the class attribute on the resulting output element. The default for a class of elements
  1470. may be passed in with $default, but that default can be overridden with mode="get-output-class". -->
  1471. <xsl:template match="*" mode="set-output-class">
  1472. <xsl:param name="default"/>
  1473. <xsl:variable name="output-class">
  1474. <xsl:apply-templates select="." mode="get-output-class"/>
  1475. </xsl:variable>
  1476. <xsl:variable name="draft-revs">
  1477. <!-- If draft is on, add revisions to default class. Simplifies processing in DITA-OT 1.6 and earlier
  1478. that created an extra div or span around revised content, just to hold @class with revs. -->
  1479. <xsl:if test="$DRAFT = 'yes'">
  1480. <xsl:for-each select="*[contains(@class, ' ditaot-d/ditaval-startprop ')]/revprop">
  1481. <xsl:value-of select="@val"/>
  1482. <xsl:text> </xsl:text>
  1483. </xsl:for-each>
  1484. </xsl:if>
  1485. </xsl:variable>
  1486. <xsl:variable name="using-output-class">
  1487. <xsl:choose>
  1488. <xsl:when test="string-length(normalize-space($output-class)) > 0"><xsl:value-of select="$output-class"/></xsl:when>
  1489. <xsl:when test="string-length(normalize-space($default)) > 0"><xsl:value-of select="$default"/></xsl:when>
  1490. </xsl:choose>
  1491. <xsl:if test="$draft-revs != ''">
  1492. <xsl:text> </xsl:text>
  1493. <xsl:value-of select="normalize-space($draft-revs)"/>
  1494. </xsl:if>
  1495. </xsl:variable>
  1496. <xsl:variable name="outputclass-attribute">
  1497. <xsl:apply-templates select="@outputclass" mode="get-value-for-class"/>
  1498. </xsl:variable>
  1499. <xsl:if test="string-length(normalize-space(concat($outputclass-attribute, $using-output-class))) > 0">
  1500. <xsl:attribute name="class">
  1501. <xsl:value-of select="normalize-space($using-output-class)"/>
  1502. <xsl:if test="string-length(normalize-space($using-output-class)) > 0 and
  1503. string-length(normalize-space($outputclass-attribute)) > 0"><xsl:text> </xsl:text></xsl:if>
  1504. <xsl:value-of select="$outputclass-attribute"/>
  1505. </xsl:attribute>
  1506. </xsl:if>
  1507. </xsl:template>
  1508. <!-- If an element has @outputclass, create a class value -->
  1509. <xsl:template match="@outputclass">
  1510. <xsl:attribute name="class" select="."/>
  1511. </xsl:template>
  1512. <!-- Determine what @outputclass value goes into XHTML's @class. If the value should
  1513. NOT fall through, override this template to remove it. -->
  1514. <xsl:template match="@outputclass" mode="get-value-for-class">
  1515. <xsl:value-of select="."/>
  1516. </xsl:template>
  1517. <!-- Most elements don't get a class attribute. -->
  1518. <xsl:template match="*" mode="get-output-class"/>
  1519. <!-- if the element has a compact=yes attribute, assert it in XHTML form -->
  1520. <xsl:template match="@compact">
  1521. <xsl:if test=". = 'yes'">
  1522. <xsl:attribute name="compact">compact</xsl:attribute><!-- assumes that no compaction is default -->
  1523. </xsl:if>
  1524. </xsl:template>
  1525. <xsl:template name="setscale">
  1526. </xsl:template>
  1527. <!-- ===================================================================== -->
  1528. <!-- ========== GENERAL SUPPORT/DOC CONTENT MANAGEMENT ========== -->
  1529. <!-- ===================================================================== -->
  1530. <!-- =========== CATCH UNDEFINED ELEMENTS (for stylesheet maintainers) =========== -->
  1531. <!-- (this rule should NOT produce output in production setting) -->
  1532. <xsl:template match="*" name="topic.undefined_element">
  1533. <span style="background-color: yellow;">
  1534. <span style="font-weight: bold">
  1535. <xsl:text>[</xsl:text>
  1536. <xsl:for-each select="ancestor-or-self::*">
  1537. <xsl:text>/</xsl:text>
  1538. <xsl:value-of select="name()" />
  1539. </xsl:for-each>
  1540. {"<xsl:value-of select="@class"/>"}<xsl:text>) </xsl:text>
  1541. </span>
  1542. <xsl:apply-templates/>
  1543. <span style="font-weight: bold">
  1544. <xsl:text> (</xsl:text><xsl:value-of select="name()"/><xsl:text>]</xsl:text>
  1545. </span>
  1546. </span>
  1547. </xsl:template>
  1548. <!-- ========= NAMED TEMPLATES (call by name, only) ========== -->
  1549. <!-- named templates that can be used anywhere -->
  1550. <!-- Process spectitle attribute - if one exists - needs to be called on tags that allow it -->
  1551. <xsl:template name="spec-title">
  1552. <xsl:if test="@spectitle"><div style="margin-top: 1em;"><strong><xsl:value-of select="@spectitle"/></strong></div></xsl:if>
  1553. </xsl:template>
  1554. <xsl:template name="spec-title-nospace">
  1555. <xsl:if test="@spectitle"><div style="margin-bottom: 0;"><strong><xsl:value-of select="@spectitle"/></strong></div></xsl:if>
  1556. </xsl:template>
  1557. <xsl:template name="spec-title-cell"> <!-- not used - was a cell 'title' -->
  1558. <xsl:if test="@specentry"><xsl:value-of select="@specentry"/><xsl:text> </xsl:text></xsl:if>
  1559. </xsl:template>
  1560. <xsl:variable name="cr" as="xs:string"><xsl:text>
  1561. </xsl:text></xsl:variable>
  1562. <!-- Break replace - used for LINES -->
  1563. <!-- this replaces newlines with the BR element. Forces breaks. -->
  1564. <xsl:template name="br-replace">
  1565. <xsl:param name="brtext"/>
  1566. <!-- capture an actual newline within the xsl:text element -->
  1567. <xsl:choose>
  1568. <xsl:when test="contains($brtext, $cr)">
  1569. <xsl:value-of select="substring-before($brtext, $cr)"/>
  1570. <linebreak/>
  1571. <xsl:value-of select="$cr"/>
  1572. <xsl:call-template name="br-replace"> <!-- call again to get remaining CRs -->
  1573. <xsl:with-param name="brtext" select="substring-after($brtext, $cr)"/>
  1574. </xsl:call-template>
  1575. </xsl:when>
  1576. <xsl:otherwise>
  1577. <xsl:value-of select="$brtext"/> <!-- No CRs, just output -->
  1578. </xsl:otherwise>
  1579. </xsl:choose>
  1580. </xsl:template>
  1581. <!-- Space replace - used for LINES -->
  1582. <!-- add checks for repeating leading blanks & converts them to &nbsp;&nbsp; -->
  1583. <!-- this replaces newlines with the BR element. Forces breaks. -->
  1584. <xsl:template name="sp-replace">
  1585. <xsl:param name="sptext"/>
  1586. <!-- capture 2 spaces -->
  1587. <xsl:choose>
  1588. <xsl:when test="contains($sptext, ' ')">
  1589. <xsl:value-of select="substring-before($sptext, ' ')"/>
  1590. <xsl:text>&#xA0;&#xA0;</xsl:text>
  1591. <xsl:call-template name="sp-replace"> <!-- call again to get remaining spaces -->
  1592. <xsl:with-param name="sptext" select="substring-after($sptext, ' ')"/>
  1593. </xsl:call-template>
  1594. </xsl:when>
  1595. <xsl:otherwise>
  1596. <xsl:value-of select="$sptext"/> <!-- No spaces, just output -->
  1597. </xsl:otherwise>
  1598. </xsl:choose>
  1599. </xsl:template>
  1600. <!-- diagnostic: call this to generate a path-like view of an element's ancestry -->
  1601. <xsl:template name="breadcrumbs">
  1602. <xsl:variable name="full-path">
  1603. <xsl:for-each select="ancestor-or-self::*">
  1604. <xsl:value-of select="concat('/', name())"/>
  1605. </xsl:for-each>
  1606. </xsl:variable>
  1607. <para>
  1608. <strong>
  1609. <xsl:value-of select="$full-path"/>
  1610. </strong>
  1611. </para>
  1612. </xsl:template>
  1613. <!-- the following named templates generate inline content for the delivery context -->
  1614. <!-- named templates for labels and titles related to topic structures -->
  1615. <!-- test processors for HTML title element -->
  1616. <xsl:template match="*|text()|processing-instruction()" mode="text-only">
  1617. <!-- Redirect to common dita-ot module -->
  1618. <xsl:apply-templates select="." mode="dita-ot:text-only"/>
  1619. </xsl:template>
  1620. <!-- Process a section heading - H4 based on: 1) title element 2) @spectitle attr -->
  1621. <xsl:template name="sect-heading">
  1622. <xsl:param name="defaulttitle"/> <!-- get param by reference -->
  1623. <xsl:call-template name="output-message">
  1624. <xsl:with-param name="id">DOTX066W</xsl:with-param>
  1625. <xsl:with-param name="msgparams">%1=sect-heading</xsl:with-param>
  1626. </xsl:call-template>
  1627. <xsl:apply-templates select="." mode="dita2html:section-heading">
  1628. <xsl:with-param name="defaulttitle" select="$defaulttitle"/>
  1629. </xsl:apply-templates>
  1630. </xsl:template>
  1631. <xsl:template match="*" mode="dita2html:section-heading">
  1632. <xsl:param name="defaulttitle"/> <!-- get param by reference -->
  1633. <xsl:variable name="heading">
  1634. <xsl:choose>
  1635. <xsl:when test="*[contains(@class, ' topic/title ')]">
  1636. <xsl:apply-templates select="*[contains(@class, ' topic/title ')][1]" mode="text-only"/>
  1637. <xsl:if test="*[contains(@class, ' topic/title ')][2]">
  1638. <xsl:apply-templates select="." mode="ditamsg:section-with-multiple-titles"/>
  1639. </xsl:if>
  1640. </xsl:when>
  1641. <xsl:when test="@spectitle">
  1642. <xsl:value-of select="@spectitle"/>
  1643. </xsl:when>
  1644. <xsl:otherwise/>
  1645. </xsl:choose>
  1646. </xsl:variable>
  1647. <xsl:variable name="headCount" select="count(ancestor::*[contains(@class, ' topic/topic ')]) + 1"/>
  1648. <xsl:variable name="headLevel">
  1649. <xsl:choose>
  1650. <xsl:when test="$headCount > 6">6</xsl:when>
  1651. <xsl:otherwise><xsl:value-of select="$headCount"/></xsl:otherwise>
  1652. </xsl:choose>
  1653. </xsl:variable>
  1654. <!-- based on graceful defaults, build an appropriate section-level heading -->
  1655. <xsl:choose>
  1656. <xsl:when test="not($heading = '')">
  1657. <xsl:if test="normalize-space($heading) = ''">
  1658. <!-- hack: a title with whitespace ALWAYS overrides as null -->
  1659. <xsl:comment>no heading</xsl:comment>
  1660. </xsl:if>
  1661. <xsl:apply-templates select="*[contains(@class, ' topic/title ')][1]">
  1662. <xsl:with-param name="headLevel" select="$headLevel"/>
  1663. </xsl:apply-templates>
  1664. <xsl:if test="@spectitle and not(*[contains(@class, ' topic/title ')])">
  1665. <header level="{$headLevel}">
  1666. <xsl:for-each select="..">
  1667. <xsl:call-template name="commonattributes"/>
  1668. </xsl:for-each>
  1669. <xsl:value-of select="@spectitle"/>
  1670. </header>
  1671. </xsl:if>
  1672. </xsl:when>
  1673. <xsl:when test="$defaulttitle">
  1674. <header level="{$headLevel}">
  1675. <xsl:for-each select="..">
  1676. <xsl:call-template name="commonattributes"/>
  1677. </xsl:for-each>
  1678. <xsl:value-of select="$defaulttitle"/>
  1679. </header>
  1680. </xsl:when>
  1681. </xsl:choose>
  1682. </xsl:template>
  1683. <xsl:template match="*[contains(@class, ' topic/section ')]/*[contains(@class, ' topic/title ')] |
  1684. *[contains(@class, ' topic/example ')]/*[contains(@class, ' topic/title ')]" name="topic.section_title">
  1685. <xsl:param name="headLevel" as="xs:integer">
  1686. <xsl:variable name="headCount" select="count(ancestor::*[contains(@class, ' topic/topic ')]) + 1"/>
  1687. <xsl:choose>
  1688. <xsl:when test="$headCount > 6">6</xsl:when>
  1689. <xsl:otherwise><xsl:value-of select="$headCount"/></xsl:otherwise>
  1690. </xsl:choose>
  1691. </xsl:param>
  1692. <header level="{$headLevel}">
  1693. <xsl:call-template name="commonattributes">
  1694. <xsl:with-param name="default-output-class" select="name(..)"/>
  1695. </xsl:call-template>
  1696. <xsl:copy-of select="../@id"/>
  1697. <xsl:apply-templates/>
  1698. </header>
  1699. </xsl:template>
  1700. <!-- Test for in BIDI area: returns "bidi" when parent's @xml:lang is a bidi language;
  1701. Otherwise, leave blank -->
  1702. <xsl:template name="bidi-area" as="xs:boolean">
  1703. <xsl:param name="parentlang">
  1704. <xsl:call-template name="getLowerCaseLang"/>
  1705. </xsl:param>
  1706. <xsl:variable name="direction">
  1707. <xsl:apply-templates select="." mode="get-render-direction">
  1708. <xsl:with-param name="lang" select="$parentlang"/>
  1709. </xsl:apply-templates>
  1710. </xsl:variable>
  1711. <xsl:sequence select="$direction = 'rtl'"/>
  1712. </xsl:template>
  1713. <!-- Test for URL: returns "url" when the content starts with a URL;
  1714. Otherwise, leave blank -->
  1715. <xsl:template name="url-string" as="xs:boolean">
  1716. <xsl:param name="urltext"/>
  1717. <xsl:sequence select="contains($urltext, 'http://') or contains($urltext, 'https://')"/>
  1718. </xsl:template>
  1719. <!-- ========== Section-like generated content =========== -->
  1720. <!-- render any contained footnotes as endnotes. Links back to reference point -->
  1721. <xsl:template name="gen-endnotes">
  1722. <!-- Skip any footnotes that are in draft elements when draft = no -->
  1723. <xsl:apply-templates select="//*[contains(@class, ' topic/fn ')][not( (ancestor::*[contains(@class, ' topic/draft-comment ')] or ancestor::*[contains(@class, ' topic/required-cleanup ')]) and $DRAFT = 'no')]" mode="genEndnote"/>
  1724. </xsl:template>
  1725. <!-- Catch footnotes that should appear at the end of the topic, and output them. -->
  1726. <xsl:template match="*[contains(@class, ' topic/fn ')]" mode="genEndnote">
  1727. <note>
  1728. <xsl:variable name="fnid"><xsl:number from="/" level="any"/></xsl:variable>
  1729. <xsl:variable name="callout" select="@callout"/>
  1730. <xsl:variable name="convergedcallout" select="if (string-length($callout) > 0) then $callout else $fnid"/>
  1731. <xsl:call-template name="commonattributes"/>
  1732. <xsl:choose>
  1733. <xsl:when test="@id and not(@id = '')">
  1734. <xsl:variable name="topicid" select="ancestor::*[contains(@class, ' topic/topic ')][1]/@id"/>
  1735. <xsl:variable name="refid" select="concat($topicid, '/', @id)"/>
  1736. <xsl:choose>
  1737. <xsl:when test="key('xref', $refid)">
  1738. <link>
  1739. <xsl:call-template name="setid"/>
  1740. <superscript>
  1741. <xsl:value-of select="$convergedcallout"/>
  1742. </superscript>
  1743. </link>
  1744. <xsl:text> </xsl:text>
  1745. </xsl:when>
  1746. <xsl:otherwise>
  1747. <superscript>
  1748. <xsl:value-of select="$convergedcallout"/>
  1749. </superscript>
  1750. <xsl:text> </xsl:text>
  1751. </xsl:otherwise>
  1752. </xsl:choose>
  1753. </xsl:when>
  1754. <xsl:otherwise>
  1755. <link>
  1756. <xsl:attribute name="name" select="concat('fntarg_', $fnid)"/>
  1757. <xsl:attribute name="href" select="concat('#fnsrc_', $fnid)"/>
  1758. <superscript>
  1759. <xsl:value-of select="$convergedcallout"/>
  1760. </superscript>
  1761. </link>
  1762. <xsl:text> </xsl:text>
  1763. </xsl:otherwise>
  1764. </xsl:choose>
  1765. <xsl:apply-templates/>
  1766. </note>
  1767. </xsl:template>
  1768. <!-- listing of topics from calling context only; can be expanded for nesting -->
  1769. <xsl:template name="gen-toc">
  1770. <div>
  1771. <header class="sectiontitle">
  1772. <xsl:call-template name="getVariable">
  1773. <xsl:with-param name="id" select="'Contents'"/>
  1774. </xsl:call-template>
  1775. </header>
  1776. <bulletlist>
  1777. <xsl:for-each select="//topic/title">
  1778. <li>
  1779. <!-- this directive provides a "depth" indicator without doing recursive nesting -->
  1780. <xsl:value-of select="substring('------', 1, count(ancestor::*))"/>
  1781. <link>
  1782. <xsl:attribute name="href">#<xsl:value-of select="generate-id()"/></xsl:attribute>
  1783. <xsl:value-of select="."/>
  1784. </link>
  1785. <!--recursive call for subtopics here"/-->
  1786. </li>
  1787. </xsl:for-each>
  1788. </bulletlist>
  1789. </div>
  1790. </xsl:template>
  1791. <!-- ========== SETTINGS ========== -->
  1792. <xsl:variable name="trace">no</xsl:variable> <!--set string to 'yes' to turn on trace -->
  1793. <!-- set up keys based on xref's "type" attribute: %info-types;|hd|fig|table|li|fn -->
  1794. <xsl:key name="topic" match="*[contains(@class, ' topic/topic ')]" use="@id"/> <!-- uses "title" -->
  1795. <xsl:key name="fig" match="*[contains(@class, ' topic/fig ')]" use="@id"/> <!-- uses "title" -->
  1796. <xsl:key name="table" match="*[contains(@class, ' topic/table ')]" use="@id"/> <!-- uses "title" -->
  1797. <xsl:key name="li" match="*[contains(@class, ' topic/li ')]" use="@id"/> <!-- uses "?" -->
  1798. <xsl:key name="fn" match="*[contains(@class, ' topic/fn ')]" use="@id"/> <!-- uses "callout?" -->
  1799. <xsl:key name="xref" match="*[contains(@class, ' topic/xref ')]" use="substring-after(@href, '#')"/> <!-- find xref which refers to footnote. -->
  1800. <!-- ========== FORMATTER DECLARATIONS AND GLOBALS ========== -->
  1801. <!-- ========== "FORMAT" GLOBAL DECLARATIONS ========== -->
  1802. <xsl:variable name="link-top-section">no</xsl:variable><!-- values: yes, no (or any not "yes") -->
  1803. <!-- ========== "FORMAT" MACROS - Table title, figure title, InfoNavGraphic ========== -->
  1804. <!--
  1805. | These macros support globally-defined formatting constants for
  1806. | document content. Some elements have attributes that permit local
  1807. | control of formatting; such logic is part of the pertinent template rule.
  1808. +-->
  1809. <xsl:template name="place-tbl-width">
  1810. <xsl:variable name="twidth-fixed">100%</xsl:variable>
  1811. <xsl:if test="$twidth-fixed != ''">
  1812. <xsl:attribute name="width" select="$twidth-fixed"/>
  1813. </xsl:if>
  1814. </xsl:template>
  1815. <!-- table caption -->
  1816. <xsl:template name="place-tbl-lbl">
  1817. <xsl:param name="id"/>
  1818. <!-- Number of table/title's before this one -->
  1819. <xsl:variable name="tbl-count-actual" select="count(preceding::*[contains(@class, ' topic/table ')]/*[contains(@class, ' topic/title ')])+1"/>
  1820. <!-- normally: "Table 1. " -->
  1821. <xsl:variable name="ancestorlang">
  1822. <xsl:call-template name="getLowerCaseLang"/>
  1823. </xsl:variable>
  1824. <xsl:choose>
  1825. <!-- title -or- title & desc -->
  1826. <xsl:when test="*[contains(@class, ' topic/title ')]">
  1827. <caption>
  1828. <span class="tablecap">
  1829. <xsl:choose> <!-- Hungarian: "1. Table " -->
  1830. <xsl:when test="$ancestorlang = ('hu', 'hu-hu')">
  1831. <xsl:value-of select="$tbl-count-actual"/>
  1832. <xsl:text>. </xsl:text>
  1833. <xsl:call-template name="getVariable">
  1834. <xsl:with-param name="id" select="'Table'"/>
  1835. </xsl:call-template>
  1836. <xsl:text> </xsl:text>
  1837. </xsl:when>
  1838. <xsl:otherwise>
  1839. <xsl:call-template name="getVariable">
  1840. <xsl:with-param name="id" select="'Table'"/>
  1841. </xsl:call-template>
  1842. <xsl:text> </xsl:text>
  1843. <xsl:value-of select="$tbl-count-actual"/>
  1844. <xsl:text>. </xsl:text>
  1845. </xsl:otherwise>
  1846. </xsl:choose>
  1847. <xsl:apply-templates select="*[contains(@class, ' topic/title ')]" mode="tabletitle"/>
  1848. <xsl:if test="*[contains(@class, ' topic/desc ')]">
  1849. <xsl:text>. </xsl:text>
  1850. </xsl:if>
  1851. </span>
  1852. <xsl:for-each select="*[contains(@class, ' topic/desc ')]">
  1853. <span class="tabledesc">
  1854. <xsl:call-template name="commonattributes"/>
  1855. <xsl:apply-templates select="." mode="tabledesc"/>
  1856. </span>
  1857. </xsl:for-each>
  1858. </caption>
  1859. </xsl:when>
  1860. <!-- desc -->
  1861. <xsl:when test="*[contains(@class, ' topic/desc ')]">
  1862. <xsl:for-each select="*[contains(@class, ' topic/desc ')]">
  1863. <span class="tabledesc">
  1864. <xsl:call-template name="commonattributes"/>
  1865. <xsl:apply-templates select="." mode="tabledesc"/>
  1866. </span>
  1867. </xsl:for-each>
  1868. </xsl:when>
  1869. </xsl:choose>
  1870. </xsl:template>
  1871. <xsl:template match="*[contains(@class, ' topic/table ')]/*[contains(@class, ' topic/title ')]" mode="tabletitle">
  1872. <xsl:apply-templates/>
  1873. </xsl:template>
  1874. <xsl:template match="*[contains(@class, ' topic/table ')]/*[contains(@class, ' topic/desc ')]" mode="tabledesc">
  1875. <xsl:apply-templates/>
  1876. </xsl:template>
  1877. <xsl:template match="*[contains(@class, ' topic/table ')]/*[contains(@class, ' topic/desc ')]" mode="get-output-class">tabledesc</xsl:template>
  1878. <!-- These 2 rules are not actually used, but could be picked up by an override -->
  1879. <xsl:template match="*[contains(@class, ' topic/table ')]/*[contains(@class, ' topic/title ')]" name="topic.table_title">
  1880. <span><xsl:apply-templates/></span>
  1881. </xsl:template>
  1882. <!-- These rules are not actually used, but could be picked up by an override -->
  1883. <xsl:template match="*[contains(@class, ' topic/table ')]/*[contains(@class, ' topic/desc ')]" name="topic.table_desc">
  1884. <span><xsl:apply-templates/></span>
  1885. </xsl:template>
  1886. <!-- Figure caption -->
  1887. <xsl:template name="place-fig-lbl">
  1888. <xsl:param name="id"/>
  1889. <!-- Number of fig/title's including this one -->
  1890. <xsl:variable name="fig-count-actual" select="count(preceding::*[contains(@class, ' topic/fig ')]/*[contains(@class, ' topic/title ')])+1"/>
  1891. <xsl:variable name="ancestorlang">
  1892. <xsl:call-template name="getLowerCaseLang"/>
  1893. </xsl:variable>
  1894. <xsl:choose>
  1895. <!-- title -or- title & desc -->
  1896. <xsl:when test="*[contains(@class, ' topic/title ')]">
  1897. <span class="figcap">
  1898. <xsl:choose> <!-- Hungarian: "1. Figure " -->
  1899. <xsl:when test="$ancestorlang = ('hu', 'hu-hu')">
  1900. <xsl:value-of select="$fig-count-actual"/>
  1901. <xsl:text>. </xsl:text>
  1902. <xsl:call-template name="getVariable">
  1903. <xsl:with-param name="id" select="'Figure'"/>
  1904. </xsl:call-template>
  1905. <xsl:text> </xsl:text>
  1906. </xsl:when>
  1907. <xsl:otherwise>
  1908. <xsl:call-template name="getVariable">
  1909. <xsl:with-param name="id" select="'Figure'"/>
  1910. </xsl:call-template>
  1911. <xsl:text> </xsl:text>
  1912. <xsl:value-of select="$fig-count-actual"/>
  1913. <xsl:text>. </xsl:text>
  1914. </xsl:otherwise>
  1915. </xsl:choose>
  1916. <xsl:apply-templates select="*[contains(@class, ' topic/title ')]" mode="figtitle"/>
  1917. <xsl:if test="*[contains(@class, ' topic/desc ')]">
  1918. <xsl:text>. </xsl:text>
  1919. </xsl:if>
  1920. </span>
  1921. <xsl:for-each select="*[contains(@class, ' topic/desc ')]">
  1922. <span class="figdesc">
  1923. <xsl:call-template name="commonattributes"/>
  1924. <xsl:apply-templates select="." mode="figdesc"/>
  1925. </span>
  1926. </xsl:for-each>
  1927. </xsl:when>
  1928. <!-- desc -->
  1929. <xsl:when test="*[contains(@class, ' topic/desc ')]">
  1930. <xsl:for-each select="*[contains(@class, ' topic/desc ')]">
  1931. <span class="figdesc">
  1932. <xsl:call-template name="commonattributes"/>
  1933. <xsl:apply-templates select="." mode="figdesc"/>
  1934. </span>
  1935. </xsl:for-each>
  1936. </xsl:when>
  1937. </xsl:choose>
  1938. </xsl:template>
  1939. <xsl:template match="*[contains(@class, ' topic/fig ')]/*[contains(@class, ' topic/title ')]" mode="figtitle">
  1940. <xsl:apply-templates/>
  1941. </xsl:template>
  1942. <xsl:template match="*[contains(@class, ' topic/fig ')]/*[contains(@class, ' topic/desc ')]" mode="figdesc">
  1943. <xsl:apply-templates/>
  1944. </xsl:template>
  1945. <xsl:template match="*[contains(@class, ' topic/fig ')]/*[contains(@class, ' topic/desc ')]" mode="get-output-class">figdesc</xsl:template>
  1946. <!-- These 2 rules are not actually used, but could be picked up by an override -->
  1947. <xsl:template match="*[contains(@class, ' topic/fig ')]/*[contains(@class, ' topic/title ')]" name="topic.fig_title">
  1948. <span><xsl:apply-templates/></span>
  1949. </xsl:template>
  1950. <!-- These rules are not actually used, but could be picked up by an override -->
  1951. <xsl:template match="*[contains(@class, ' topic/fig ')]/*[contains(@class, ' topic/desc ')]" name="topic.fig_desc">
  1952. <span><xsl:apply-templates/></span>
  1953. </xsl:template>
  1954. <xsl:template match="*[contains(@class, ' topic/figgroup ')]/*[contains(@class, ' topic/title ')]" name="topic.figgroup_title">
  1955. <xsl:apply-templates/>
  1956. </xsl:template>
  1957. <!-- ===================================================================== -->
  1958. <!-- ========== STUBS FOR USER PROVIDED OVERRIDE EXTENSIONS ========== -->
  1959. <xsl:template name="gen-user-external-link">
  1960. <xsl:apply-templates select="." mode="gen-user-external-link"/>
  1961. </xsl:template>
  1962. <xsl:template match="/|node()|@*" mode="gen-user-external-link">
  1963. <!-- to customize: copy this to your override transform, add the content you want. -->
  1964. <!-- It will be placed after an external LINK or XREF -->
  1965. </xsl:template>
  1966. <xsl:template name="gen-user-panel-title-pfx">
  1967. <xsl:apply-templates select="." mode="gen-user-panel-title-pfx"/>
  1968. </xsl:template>
  1969. <xsl:template match="/|node()|@*" mode="gen-user-panel-title-pfx">
  1970. <!-- to customize: copy this to your override transform, add the content you want. -->
  1971. <!-- It will be placed immediately after TITLE tag, in the title -->
  1972. </xsl:template>
  1973. <!-- ===================================================================== -->
  1974. <!-- ========== DEFAULT PAGE LAYOUT ========== -->
  1975. <xsl:template name="chapter-setup">
  1976. <pandoc>
  1977. <xsl:apply-templates select="." mode="chapterHead"/>
  1978. <xsl:apply-templates select="." mode="chapterBody"/>
  1979. </pandoc>
  1980. </xsl:template>
  1981. <xsl:template match="*" mode="chapterHead">
  1982. <!--xsl:call-template name="getMeta"/-->
  1983. </xsl:template>
  1984. <xsl:template match="*" mode="chapterBody">
  1985. <xsl:apply-templates select="." mode="addContentToHtmlBodyElement"/>
  1986. </xsl:template>
  1987. <!-- Add all attributes. To add your own additional attributes, use mode="addAttributesToBody". -->
  1988. <xsl:template match="*" mode="addAttributesToHtmlBodyElement">
  1989. <!-- Already put xml:lang on <html>; do not copy to body with commonattributes -->
  1990. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-startprop ')]/@outputclass" mode="add-ditaval-style"/>
  1991. <!--output parent or first "topic" tag's outputclass as class -->
  1992. <xsl:if test="@outputclass">
  1993. <xsl:attribute name="class" select="@outputclass"/>
  1994. </xsl:if>
  1995. <xsl:if test="self::dita">
  1996. <xsl:if test="*[contains(@class, ' topic/topic ')][1]/@outputclass">
  1997. <xsl:attribute name="class" select="*[contains(@class, ' topic/topic ')][1]/@outputclass"/>
  1998. </xsl:if>
  1999. </xsl:if>
  2000. <xsl:call-template name="setid"/>
  2001. </xsl:template>
  2002. <xsl:template match="*" mode="addContentToHtmlBodyElement">
  2003. <div>
  2004. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-startprop ')]" mode="out-of-line"/>
  2005. <xsl:apply-templates/>
  2006. <xsl:call-template name="gen-endnotes"/>
  2007. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-endprop ')]" mode="out-of-line"/>
  2008. </div>
  2009. </xsl:template>
  2010. <xsl:template name="get-file-name">
  2011. <xsl:param name="file-path"/>
  2012. <xsl:choose>
  2013. <xsl:when test="contains($file-path, '\')">
  2014. <xsl:call-template name="get-file-name">
  2015. <xsl:with-param name="file-path" select="substring-after($file-path, '\')"/>
  2016. </xsl:call-template>
  2017. </xsl:when>
  2018. <xsl:when test="contains($file-path, '/')">
  2019. <xsl:call-template name="get-file-name">
  2020. <xsl:with-param name="file-path" select="substring-after($file-path, '/')"/>
  2021. </xsl:call-template>
  2022. </xsl:when>
  2023. <xsl:otherwise>
  2024. <xsl:value-of select="$file-path"/>
  2025. </xsl:otherwise>
  2026. </xsl:choose>
  2027. </xsl:template>
  2028. <!-- Add for "New <data> element (#9)" in DITA 1.1 -->
  2029. <xsl:template match="*[contains(@class, ' topic/data ')]" />
  2030. <!-- Add for "Support foreign content vocabularies such as
  2031. MathML and SVG with <unknown> (#35) " in DITA 1.1 -->
  2032. <xsl:template match="*[contains(@class, ' topic/foreign ') or contains(@class, ' topic/unknown ')]"/>
  2033. <!-- Add for index-base element. This template is used to prevent
  2034. any processing applied on index-base element -->
  2035. <xsl:template match="*[contains(@class, ' topic/index-base ')]"/>
  2036. <!-- Add for text element. -->
  2037. <xsl:template match="*[contains(@class, ' topic/text ')]">
  2038. <xsl:apply-templates/>
  2039. </xsl:template>
  2040. <!-- By default, ignore desc and force pull-processing -->
  2041. <xsl:template match="*[contains(@class, ' topic/desc ')]" name="topic.desc" priority="-10"/>
  2042. <!-- Add for bodydiv and sectiondiv-->
  2043. <xsl:template match="*[contains(@class, ' topic/bodydiv ') or contains(@class, ' topic/sectiondiv ')]">
  2044. <div>
  2045. <xsl:call-template name="commonattributes"/>
  2046. <xsl:call-template name="setid"/>
  2047. <xsl:apply-templates/>
  2048. </div>
  2049. </xsl:template>
  2050. <!-- Function to look up a target in the keyref file -->
  2051. <xsl:template match="*" mode="find-keyref-target">
  2052. <!-- Deprecated since 2.1 -->
  2053. <xsl:param name="keys" select="@keyref"/>
  2054. <!-- Deprecated since 2.1 -->
  2055. <xsl:param name="target" select="@href"/>
  2056. <xsl:choose>
  2057. <xsl:when test="contains($target, '://')">
  2058. <xsl:value-of select="$target"/>
  2059. </xsl:when>
  2060. <!-- edited on 2010-12-17 for keyref bug:3114411 start-->
  2061. <xsl:when test="contains($target, '#')">
  2062. <xsl:value-of select="concat($PATH2PROJ, substring-before(substring-before($target, '#'), '.'), $OUTEXT, '#', substring-after($target, '#'))"/>
  2063. </xsl:when>
  2064. <xsl:when test="$target = ''">
  2065. <xsl:value-of select="$OUTEXT"/>
  2066. </xsl:when>
  2067. <xsl:otherwise>
  2068. <xsl:value-of select="concat($PATH2PROJ, substring-before($target, '.'), $OUTEXT)"/>
  2069. </xsl:otherwise>
  2070. <!-- edited on 2010-12-17 for keyref bug:3114411 end-->
  2071. </xsl:choose>
  2072. </xsl:template>
  2073. <!-- This template converts phrase-like elements into links based on keyref. -->
  2074. <!-- 20090331: Update to ensure cite with keyref continues to use <cite>,
  2075. plus move common code to single template -->
  2076. <xsl:template match="*" mode="turning-to-link">
  2077. <xsl:param name="keys" select="@keyref" as="xs:string?"/>
  2078. <xsl:param name="type" select="name()" as="xs:string"/>
  2079. <xsl:variable name="elementName" as="xs:string">
  2080. <xsl:choose>
  2081. <xsl:when test="$type = 'cite'">cite</xsl:when>
  2082. <xsl:otherwise>span</xsl:otherwise>
  2083. </xsl:choose>
  2084. </xsl:variable>
  2085. <link>
  2086. <xsl:apply-templates select="." mode="add-linking-attributes"/>
  2087. <xsl:apply-templates select="." mode="add-desc-as-hoverhelp"/>
  2088. <xsl:element name="{$elementName}">
  2089. <xsl:call-template name="commonattributes">
  2090. <xsl:with-param name="default-output-class">
  2091. <xsl:if test="normalize-space($type) != name()">
  2092. <xsl:value-of select="$type"/>
  2093. </xsl:if>
  2094. </xsl:with-param>
  2095. </xsl:call-template>
  2096. <xsl:apply-templates/>
  2097. </xsl:element>
  2098. </link>
  2099. </xsl:template>
  2100. <!-- Deprecated since 2.1 -->
  2101. <xsl:template match="*" mode="common-processing-phrase-within-link">
  2102. <xsl:param name="type"/>
  2103. <xsl:call-template name="commonattributes">
  2104. <xsl:with-param name="default-output-class">
  2105. <xsl:if test="normalize-space($type) != name()">
  2106. <xsl:value-of select="$type"/>
  2107. </xsl:if>
  2108. </xsl:with-param>
  2109. </xsl:call-template>
  2110. <xsl:call-template name="setidaname"/>
  2111. <xsl:apply-templates/>
  2112. </xsl:template>
  2113. <!-- MESSAGES: Refactoring places each message in a moded template, so that users
  2114. may more easily override a message for one or all cases. -->
  2115. <xsl:template match="*" mode="ditamsg:no-glossentry-for-key">
  2116. <xsl:param name="matching-keys"/>
  2117. <xsl:call-template name="output-message">
  2118. <xsl:with-param name="id">DOTX058W</xsl:with-param>
  2119. <xsl:with-param name="msgparams">%1=<xsl:value-of select="$matching-keys"/>;%2=<xsl:value-of select="name()"/></xsl:with-param>
  2120. </xsl:call-template>
  2121. </xsl:template>
  2122. <xsl:template match="*" mode="ditamsg:no-title-for-topic">
  2123. <xsl:call-template name="output-message">
  2124. <xsl:with-param name="id">DOTX037W</xsl:with-param>
  2125. </xsl:call-template>
  2126. </xsl:template>
  2127. <xsl:template match="*" mode="ditamsg:longdescref-on-object">
  2128. <xsl:call-template name="output-message">
  2129. <xsl:with-param name="id">DOTX038I</xsl:with-param>
  2130. <xsl:with-param name="msgparams">%1=<xsl:value-of select="name(.)"/></xsl:with-param>
  2131. </xsl:call-template>
  2132. </xsl:template>
  2133. <xsl:template match="*" mode="ditamsg:required-cleanup-in-content">
  2134. <xsl:call-template name="output-message">
  2135. <xsl:with-param name="id">DOTX039W</xsl:with-param>
  2136. </xsl:call-template>
  2137. </xsl:template>
  2138. <xsl:template match="*" mode="ditamsg:draft-comment-in-content">
  2139. <xsl:call-template name="output-message">
  2140. <xsl:with-param name="id">DOTX040I</xsl:with-param>
  2141. </xsl:call-template>
  2142. </xsl:template>
  2143. <xsl:template match="*" mode="ditamsg:section-with-multiple-titles">
  2144. <xsl:call-template name="output-message">
  2145. <xsl:with-param name="id">DOTX041W</xsl:with-param>
  2146. </xsl:call-template>
  2147. </xsl:template>
  2148. </xsl:stylesheet>