| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813 |
- <?xml version="1.0" encoding="utf-8" ?>
- <!-- This file is part of the DITA Open Toolkit project hosted on
- Sourceforge.net. See the accompanying license.txt file for
- applicable licenses.-->
- <!-- (c) Copyright IBM Corp. 2004, 2005 All Rights Reserved. -->
- <xsl:stylesheet version="2.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - TOPIC ORGANIZATION
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
- <xsl:template match="*[contains(@class,' topic/topic ')]">
- <xsl:param name="childrefs"/>
- <xsl:param name="element" select="'section'"/>
- <xsl:element name="{$element}">
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'tpc'"/>
- </xsl:call-template>
- <xsl:apply-templates select="*[contains(@class,' topic/prolog ')]">
- <xsl:with-param name="contextType" select="$element"/>
- </xsl:apply-templates>
- <xsl:apply-templates select="*[not(contains(@class,' topic/prolog '))]"/>
- <xsl:if test="$childrefs">
- <xsl:apply-templates select="$childrefs"/>
- </xsl:if>
- </xsl:element>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/title ')]">
- <xsl:param name="element" select="'title'"/>
- <xsl:param name="IDPrefix" select="'ttl'"/>
- <xsl:element name="{$element}">
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="$IDPrefix"/>
- </xsl:call-template>
- <xsl:apply-templates/>
- </xsl:element>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/titlealts ')]">
- <xsl:apply-templates select="*[contains(@class,' topic/searchtitle ')]"/>
- <xsl:apply-templates select="*[contains(@class,' topic/navtitle ')]"/>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/navtitle ')]">
- <xsl:param name="element" select="'titleabbrev'"/>
- <xsl:param name="IDPrefix" select="'ttlabbrv'"/>
- <xsl:element name="{$element}">
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="$IDPrefix"/>
- </xsl:call-template>
- <xsl:apply-templates/>
- </xsl:element>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/searchtitle ')]">
- <xsl:param name="element" select="'subtitle'"/>
- <xsl:param name="IDPrefix" select="'sbttl'"/>
- <xsl:element name="{$element}">
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="$IDPrefix"/>
- </xsl:call-template>
- <xsl:apply-templates/>
- </xsl:element>
- </xsl:template>
- <!-- Added for DITA 1.1 "Shortdesc proposal" -->
- <xsl:template match="*[contains(@class,' topic/abstract ')]" mode="abstract">
- <abstract>
- <xsl:call-template name="makePara">
- <xsl:with-param name="IDPrefix" select="'shrtdsc'"/>
- </xsl:call-template>
- </abstract>
- </xsl:template>
- <!-- Added for DITA 1.1 "Shortdesc proposal" -->
- <xsl:template match="*[contains(@class,' topic/abstract ')]">
- <xsl:call-template name="makePara">
- <xsl:with-param name="IDPrefix" select="'para'"/>
- </xsl:call-template>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/shortdesc ')]" mode="abstract">
- <abstract>
- <xsl:call-template name="makePara">
- <xsl:with-param name="IDPrefix" select="'shrtdsc'"/>
- </xsl:call-template>
- </abstract>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/shortdesc ')]">
- <xsl:call-template name="makePara">
- <xsl:with-param name="IDPrefix" select="'para'"/>
- </xsl:call-template>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/body ')]">
- <xsl:apply-templates select="." mode="deflate">
- <xsl:with-param name="descendentsOkay" select="true()"/>
- </xsl:apply-templates>
- </xsl:template>
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - META INFORMATION
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
- <xsl:template match="*[contains(@class,' topic/prolog ')]">
- <xsl:param name="contextType" select="'section'"/>
- <xsl:variable name="shortDescNode"
- select="../*[contains(@class,' topic/shortdesc ') or contains(@class, ' topic/abstract ')]"/>
- <xsl:variable name="prologNodes" select="*"/>
- <xsl:if test="$shortDescNode or $prologNodes">
- <xsl:variable name="elementName">
- <xsl:choose>
- <xsl:when test="$contextType='article'">artheader</xsl:when>
- <xsl:when test="$contextType='appendix'">docinfo</xsl:when>
- <xsl:when test="$contextType='book'">bookinfo</xsl:when>
- <xsl:when test="$contextType='chapter'">chapterinfo</xsl:when>
- <xsl:when test="$contextType='glossary'">docinfo</xsl:when>
- <xsl:when test="$contextType='part'">docinfo</xsl:when>
- <xsl:when test="$contextType='section'">sectioninfo</xsl:when>
- <xsl:otherwise>
- <xsl:message>
- <xsl:text>Unknown context type </xsl:text>
- <xsl:value-of select="$contextType"/>
- </xsl:message>
- <xsl:text>sectioninfo</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:element name="{$elementName}">
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'prlg'"/>
- </xsl:call-template>
- <xsl:apply-templates select="$shortDescNode" mode="abstract"/>
- <xsl:apply-templates select="$prologNodes"/>
- </xsl:element>
- </xsl:if>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/author ')]">
- <author>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'athr'"/>
- </xsl:call-template>
- <othername>
- <xsl:apply-templates/>
- </othername>
- </author>
- </xsl:template>
- <!-- to do -->
- <xsl:template match="*[contains(@class,' topic/source ')]"/>
- <xsl:template match="*[contains(@class,' topic/publisher ')]">
- <publisher>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'pblshr'"/>
- </xsl:call-template>
- <!-- dhjohnso: publisher must be inside publishername -->
- <publishername>
- <xsl:apply-templates/>
- </publishername>
- </publisher>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/copyright ')]">
- <copyright>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'cprght'"/>
- </xsl:call-template>
- <xsl:apply-templates/>
- </copyright>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/copyrdate ')]">
- <year>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'cprdt'"/>
- </xsl:call-template>
- <xsl:apply-templates/>
- </year>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/copyrholder ')]">
- <holder>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'cprhldr'"/>
- </xsl:call-template>
- <xsl:apply-templates/>
- </holder>
- </xsl:template>
- <!-- dhjohnso: template added for missing year element -->
- <xsl:template match="*[contains(@class,' topic/copyryear ')]">
- <year>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'cpryear'"/>
- </xsl:call-template>
- <xsl:value-of select="@year" />
- </year>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/critdates ')]">
- <revhistory>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'crtdts'"/>
- </xsl:call-template>
- <xsl:apply-templates/>
- </revhistory>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/created ')]">
- <xsl:apply-templates select="@date|@expiry|@golive"/>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/revised ')]">
- <xsl:apply-templates select="@expiry|@golive|@modified"/>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/created ')]/@date |
- *[contains(@class,' topic/created ')]/@expiry |
- *[contains(@class,' topic/created ')]/@golive |
- *[contains(@class,' topic/revised ')]/@expiry |
- *[contains(@class,' topic/revised ')]/@golive |
- *[contains(@class,' topic/revised ')]/@modified">
- <revision>
- <revnumber/>
- <date>
- <xsl:value-of select="../@date"/>
- </date>
- <revremark>
- <xsl:choose>
- <xsl:when test="parent::*[contains(@class,' topic/created ')] and
- local-name(.)='date'">
- <xsl:text>created</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="local-name(.)"/>
- </xsl:otherwise>
- </xsl:choose>
- </revremark>
- </revision>
- </xsl:template>
- <!-- to do -->
- <xsl:template match="*[contains(@class,' topic/permissions ')]"/>
- <xsl:template match="*[contains(@class,' topic/metadata ')]">
- <xsl:variable name="categoryNodes"
- select="*[contains(@class,' topic/category ')]"/>
- <xsl:if test="$categoryNodes">
- <subjectset>
- <xsl:apply-templates select="$categoryNodes" mode="metadata"/>
- </subjectset>
- </xsl:if>
- <xsl:apply-templates select="." mode="deflate">
- <xsl:with-param name="descendentsOkay" select="true()"/>
- </xsl:apply-templates>
- </xsl:template>
- <!-- to do -->
- <xsl:template match="*[contains(@class,' topic/audience ')]"/>
- <xsl:template match="*[contains(@class,' topic/category ')]"/>
- <xsl:template match="*[contains(@class,' topic/category ')]" mode="metadata">
- <subject>
- <subjectterm>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'ctgry'"/>
- </xsl:call-template>
- <xsl:apply-templates/>
- </subjectterm>
- </subject>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/keywords ')]">
- <xsl:variable name="keywordNodes"
- select="*[contains(@class,' topic/keyword ')]"/>
- <xsl:variable name="indextermNodes"
- select="*[contains(@class,' topic/indexterm ')]"/>
- <xsl:if test="$keywordNodes">
- <keywordset>
- <xsl:apply-templates select="$keywordNodes" mode="metadata"/>
- </keywordset>
- </xsl:if>
- <xsl:if test="$indextermNodes">
- <itermset>
- <xsl:apply-templates select="$indextermNodes"/>
- </itermset>
- </xsl:if>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/keyword ')]" mode="metadata">
- <keyword>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'kywrd'"/>
- </xsl:call-template>
- <xsl:value-of select="."/>
- </keyword>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/prodinfo ')]">
- <xsl:apply-templates select="." mode="deflate">
- <xsl:with-param name="descendentsOkay" select="true()"/>
- </xsl:apply-templates>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/prodname ')]">
- <productname>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'prdnm'"/>
- </xsl:call-template>
- <xsl:apply-templates/>
- </productname>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/vrmlist ')]">
- <xsl:apply-templates select="." mode="deflate">
- <xsl:with-param name="descendentsOkay" select="true()"/>
- </xsl:apply-templates>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/vrm ')]">
- <productnumber>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'vrm'"/>
- </xsl:call-template>
- <xsl:apply-templates select="@version"/>
- <xsl:if test="@version and @release">
- <xsl:text>-</xsl:text>
- </xsl:if>
- <xsl:apply-templates select="@release"/>
- <xsl:if test="(@version or @release) and @modification">
- <xsl:text>-</xsl:text>
- </xsl:if>
- <xsl:apply-templates select="@modification"/>
- </productnumber>
- </xsl:template>
- <!-- to do -->
- <xsl:template match="*[contains(@class,' topic/brand ')]"/>
- <xsl:template match="*[contains(@class,' topic/series ')]"/>
- <xsl:template match="*[contains(@class,' topic/platform ')]"/>
- <xsl:template match="*[contains(@class,' topic/prognum ')]"/>
- <xsl:template match="*[contains(@class,' topic/featnum ')]"/>
- <xsl:template match="*[contains(@class,' topic/component ')]"/>
- <!-- to do -->
- <xsl:template match="*[contains(@class,' topic/othermeta ')]"/>
- <!-- to do -->
- <xsl:template match="*[contains(@class,' topic/resourceid ')]"/>
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - RELATIONSHIPS
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
- <xsl:template match="*[contains(@class,' topic/related-links ')]">
- <itemizedlist>
- <title>Related links</title>
- <xsl:apply-templates/>
- </itemizedlist>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/linkpool ')]">
- <xsl:apply-templates/>
- </xsl:template>
- <!-- ??? should handle title and linkinfo and desc -->
- <xsl:template match="*[contains(@class,' topic/linklist ')]">
- <xsl:apply-templates select="*[contains(@class,' topic/desc ')]"/>
- <listitem>
- <itemizedlist>
- <xsl:apply-templates select="*[contains(@class,' topic/linklist ') or
- contains(@class,' topic/link ')]"/>
- </itemizedlist>
- <xsl:apply-templates select="*[contains(@class,' topic/linkinfo ')]"/>
- </listitem>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/link ')]">
- <listitem>
- <para>
- <xsl:choose>
- <xsl:when test="(not(@format) or @format='dita') and
- (not(@scope) or @scope='local') and
- @href and (
- substring(@href, string-length(@href) - 4) = '.dita' or
- contains(@href,'.dita#') or
- substring(@href, string-length(@href) - 3) = '.xml' or
- contains(@href,'.xml#'))">
- <xsl:apply-templates select="." mode="make-xref-from-link"/>
- </xsl:when>
- <xsl:when test="((@format and @format != 'dita') or
- (@scope and @scope!='local') or
- (@href and
- substring(@href, string-length(@href) - 4) != '.dita' and
- not (contains(@href,'.dita#')) and
- substring(@href, string-length(@href) - 3) != '.xml') and
- not (contains(@href,'.xml#')))">
- <xsl:apply-templates select="." mode="make-ulink-from-link"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="." mode="make-ulink-from-link"/>
- </xsl:otherwise>
- </xsl:choose>
- </para>
- <xsl:apply-templates select="*[contains(@class,' topic/desc ')]"/>
- </listitem>
- </xsl:template>
- <xsl:template match="*" mode="make-ulink-from-link">
- <ulink url="{@href}">
- <xsl:apply-templates select="*[contains(@class,' topic/linktext ')]"/>
- </ulink>
- </xsl:template>
- <xsl:template match="*" mode="make-xref-from-link">
- <xsl:variable name="linkID">
- <xsl:call-template name="getLinkID"/>
- </xsl:variable>
- <xref linkend="{$linkID}">
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'xref'"/>
- </xsl:call-template>
- </xref>
- </xsl:template>
- <!-- Provided by Erik Hennum and dcramer in SF bug report 1385654.
- For use with targets already identified as DITA.
- Does not yet support linking to sub-topic elements; all links go to topic. -->
- <xsl:template name="getLinkID">
- <xsl:param name="href" select="@href"/>
- <xsl:variable name="hasID" select="contains($href,'#')"/>
- <xsl:choose>
- <xsl:when test="contains($href,'#') and contains(substring-after($href,'#'),'/')">
- <xsl:value-of select="substring-before(substring-after(@href,'#'),'/')"/>
- </xsl:when>
- <xsl:when test="contains($href,'#')">
- <xsl:value-of select="substring-after(@href,'#')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of
- select="document($href, /)/*[contains(@class,' topic/topic ')]/@id"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - SECTIONS
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
- <xsl:template match="*[contains(@class,' topic/section ')]">
- <xsl:call-template name="makeBlockCont">
- <xsl:with-param name="IDPrefix" select="'sctn'"/>
- </xsl:call-template>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/example ')]">
- <xsl:choose>
- <xsl:when test="title">
- <example>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'xmp'"/>
- </xsl:call-template>
- <xsl:apply-templates/>
- </example>
- </xsl:when>
- <xsl:otherwise>
- <informalexample>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'xmp'"/>
- </xsl:call-template>
- <xsl:apply-templates/>
- </informalexample>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - LISTS
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
- <xsl:template match="*[contains(@class,' topic/ul ')]">
- <itemizedlist>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'ul'"/>
- </xsl:call-template>
- <xsl:apply-templates select="@compact" mode="deflate"/>
- <xsl:apply-templates/>
- </itemizedlist>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/ol ')]">
- <orderedlist>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'ol'"/>
- </xsl:call-template>
- <xsl:apply-templates select="@compact" mode="deflate"/>
- <xsl:apply-templates/>
- </orderedlist>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/li ')]">
- <listitem>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'li'"/>
- </xsl:call-template>
- <xsl:call-template name="makeBlock"/>
- </listitem>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/itemgroup ')]">
- <xsl:variable name="element" select="local-name(.)" />
- <xsl:variable name="id" select="concat('elem', generate-id())" />
- <xsl:call-template name="deflateElementStart">
- <xsl:with-param name="id" select="$id" />
- <xsl:with-param name="element" select="$element" />
- <xsl:with-param name="parentID" select="''" />
- </xsl:call-template>
- <xsl:call-template name="makeBlock" />
- <xsl:call-template name="deflateElementEnd">
- <xsl:with-param name="id" select="$id" />
- <xsl:with-param name="element" select="$element" />
- </xsl:call-template>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/dl ')]">
- <variablelist>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'dl'"/>
- </xsl:call-template>
- <xsl:apply-templates select="@compact" mode="deflate"/>
- <xsl:if test="@title">
- <title>
- <xsl:value-of select="@title"/>
- </title>
- </xsl:if>
- <xsl:apply-templates/>
- </variablelist>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/dlhead ')]">
- <varlistentry>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'dlhd'"/>
- </xsl:call-template>
- <xsl:variable name="dtheads" select="*[contains(@class,' topic/dthd ')]"/>
- <xsl:variable name="ddheads" select="*[contains(@class,' topic/ddhd ')]"/>
- <xsl:choose>
- <xsl:when test="$dtheads">
- <xsl:apply-templates select="$dtheads"/>
- </xsl:when>
- <xsl:otherwise>
- <term/>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="$ddheads">
- <xsl:apply-templates select="$ddheads"/>
- </xsl:when>
- <xsl:otherwise>
- <listitem/>
- </xsl:otherwise>
- </xsl:choose>
- </varlistentry>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/dthd ')]">
- <term>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'dthd'"/>
- </xsl:call-template>
- <xsl:apply-templates/>
- </term>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/ddhd ')]">
- <listitem>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'ddhd'"/>
- </xsl:call-template>
- <xsl:call-template name="makeBlock"/>
- </listitem>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/dlentry ')]">
- <varlistentry>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'dle'"/>
- </xsl:call-template>
- <xsl:choose>
- <xsl:when test="*[contains(@class,' topic/dd ')][2]">
- <xsl:apply-templates select="*[contains(@class,' topic/dt ')]"/>
- <listitem>
- <xsl:for-each select="*[contains(@class,' topic/dd ')]">
- <orderedlist>
- <listitem>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'dd'"/>
- </xsl:call-template>
- <xsl:call-template name="makeBlock"/>
- </listitem>
- </orderedlist>
- </xsl:for-each>
- </listitem>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates/>
- </xsl:otherwise>
- </xsl:choose>
- </varlistentry>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/dt ')]">
- <term>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'dt'"/>
- </xsl:call-template>
- <xsl:apply-templates/>
- </term>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/dd ')]">
- <listitem>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'dd'"/>
- </xsl:call-template>
- <xsl:call-template name="makeBlock"/>
- </listitem>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/sl ')]">
- <simplelist columns="1" type="vert">
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'sl'"/>
- </xsl:call-template>
- <xsl:apply-templates select="@compact" mode="deflate"/>
- <xsl:apply-templates/>
- </simplelist>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/sli ')]">
- <member>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'sli'"/>
- </xsl:call-template>
- <xsl:apply-templates/>
- </member>
- </xsl:template>
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - VERBATIM BLOCKS
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
- <xsl:template match="*[contains(@class,' topic/pre ')]">
- <xsl:call-template name="wrapTitle">
- <xsl:with-param name="wrapElem" select="'example'"/>
- <xsl:with-param name="coreElem" select="'programlisting'"/>
- <xsl:with-param name="IDPrefix" select="'pre'"/>
- </xsl:call-template>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/lines ')]">
- <xsl:call-template name="wrapLiteralTitle">
- <xsl:with-param name="classAttr" select="'normal'"/>
- <xsl:with-param name="IDPrefix" select="'lns'"/>
- </xsl:call-template>
- </xsl:template>
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - FORMATTING BLOCKS
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
- <xsl:template match="*[contains(@class,' topic/p ')]">
- <xsl:call-template name="makePara">
- <xsl:with-param name="IDPrefix" select="'para'"/>
- </xsl:call-template>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/lq ')]">
- <blockquote>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'lq'"/>
- </xsl:call-template>
- <xsl:call-template name="makeBlock"/>
- </blockquote>
- </xsl:template>
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - ADMONITION / PERIL BLOCKS
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
- <xsl:template match="*[contains(@class,' topic/note ') and
- (@type='attention' or @type='important' or @type='restriction')]">
- <important>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'important'"/>
- </xsl:call-template>
- <xsl:call-template name="makeBlock"/>
- </important>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/note ') and
- (@type='caution' or @type='remember')]">
- <caution>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'caution'"/>
- </xsl:call-template>
- <xsl:call-template name="makeBlock"/>
- </caution>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/note ') and @type='danger']">
- <warning>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'warning'"/>
- </xsl:call-template>
- <xsl:call-template name="makeBlock"/>
- </warning>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/note ') and
- (@type='tip' or @type='fastpath')]">
- <tip>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'warning'"/>
- </xsl:call-template>
- <xsl:call-template name="makeBlock"/>
- </tip>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/note ') and not(@type)]">
- <note>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'note'"/>
- </xsl:call-template>
- <xsl:if test="@title">
- <title>
- <xsl:value-of select="@title"/>
- </title>
- </xsl:if>
- <xsl:call-template name="makeBlock"/>
- </note>
- </xsl:template>
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - SEMANTIC PHRASES
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
- <xsl:template match="*[contains(@class,' topic/ph ')]" name="phrase">
- <xsl:param name="IDPrefix" select="'phrs'"/>
- <xsl:param name="role" select="''"/>
- <phrase>
- <xsl:if test="$role!=''">
- <xsl:attribute name="role">
- <xsl:value-of select="$role"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="$IDPrefix"/>
- </xsl:call-template>
- <xsl:apply-templates/>
- </phrase>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/keyword ')]">
- <xsl:call-template name="phrase">
- <xsl:with-param name="IDPrefix" select="'kywrd'"/>
- </xsl:call-template>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/q ')]">
- <quote>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'quote'"/>
- </xsl:call-template>
- <xsl:apply-templates/>
- </quote>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/term ')]">
- <glossterm>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'quote'"/>
- </xsl:call-template>
- <xsl:apply-templates/>
- </glossterm>
- </xsl:template>
- <!--
- DATA-TYPE PHRASES: date time currency char num bin oct dec hex ???
- -->
- <xsl:template match="*[contains(@class,' topic/boolean ')]"/>
- <xsl:template match="*[contains(@class,' topic/state ')]"/>
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - LINKING PHRASES
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
- <xsl:template match="*[contains(@class,' topic/xref ')]">
- <xsl:choose>
- <xsl:when test="(not(@format) or @format='dita') and
- (not(@scope) or @scope='local') and
- @href and (
- substring(@href, string-length(@href) - 4) = '.dita' or
- contains(@href,'.dita#') or
- substring(@href, string-length(@href) - 3) = '.xml' or
- contains(@href,'.xml#'))">
- <xsl:apply-templates select="." mode="make-xref-from-xref"/>
- </xsl:when>
- <xsl:when test="((@format and @format != 'dita') or
- (@scope and @scope!='local') or
- (@href and
- substring(@href, string-length(@href) - 4) != '.dita' and
- not (contains(@href,'.dita#')) and
- substring(@href, string-length(@href) - 3) != '.xml' and
- not (contains(@href,'.xml#')) ))">
- <xsl:apply-templates select="." mode="make-ulink-from-xref"/>
- </xsl:when>
- <xsl:otherwise>
- <!-- Unable to handle at this time -->
- <xsl:apply-templates select="." mode="deflate"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <!--<xsl:template match="*[contains(@class,' topic/xref ') and (
- (@format and @format != 'dita') or
- (@scope and @scope!='local') or
- (@href and
- substring(@href, string-length(@href) - 5) != '.dita' and
- substring(@href, string-length(@href) - 4) != '.xml'))]">-->
- <xsl:template match="*" mode="make-ulink-from-xref">
- <ulink url="{@href}" type="{@type}">
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'link'"/>
- </xsl:call-template>
- <xsl:apply-templates/>
- </ulink>
- </xsl:template>
- <!--<xsl:template match="*[contains(@class,' topic/xref ') and
- (not(@format) or @format='dita') and
- (not(@scope) or @scope='local') and
- @href and (
- substring(@href, string-length(@href) - 5) = '.dita' or
- substring(@href, string-length(@href) - 4) = '.xml')]">-->
- <xsl:template match="*" mode="make-xref-from-xref">
- <xsl:variable name="linkID">
- <xsl:call-template name="getLinkID"/>
- </xsl:variable>
- <xref linkend="{$linkID}">
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'xref'"/>
- </xsl:call-template>
- </xref>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/fn ')]" name="footnote">
- <xsl:param name="IDPrefix" select="'fn'"/>
- <footnote>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="$IDPrefix"/>
- </xsl:call-template>
- <xsl:call-template name="makeBlock"/>
- </footnote>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/cite ')]">
- <xsl:choose>
- <xsl:when test="@ref">
- <xref role="cite" linkend="{@ref}">
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'cite'"/>
- </xsl:call-template>
- </xref>
- </xsl:when>
- <xsl:otherwise>
- <citation>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'cite'"/>
- </xsl:call-template>
- <xsl:apply-templates/>
- </citation>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/indexterm ')]">
- <indexterm>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'indxtrm'"/>
- </xsl:call-template>
- <primary>
- <xsl:apply-templates select="text()"/>
- </primary>
- <xsl:apply-templates select="*" mode="secondary"/>
- </indexterm>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/indexterm ')]" mode="secondary">
- <secondary>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'indxtrm'"/>
- </xsl:call-template>
- <xsl:apply-templates select="text()"/>
- </secondary>
- <xsl:apply-templates select="*" mode="tertiary"/>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/indexterm ')]" mode="tertiary">
- <tertiary>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'indxtrm'"/>
- </xsl:call-template>
- <xsl:apply-templates select="text()"/>
- </tertiary>
- <xsl:apply-templates select="*"/>
- </xsl:template>
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - TABLES
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
- <xsl:template match="*[contains(@class,' topic/table ')]">
- <xsl:param name="titleSpec" select="' topic/title '"/>
- <xsl:param name="titleNode" select="*[contains(@class,$titleSpec)]"/>
- <xsl:variable name="descNode" select="*[contains(@class,' topic/desc ')]"/>
- <xsl:variable name="element">
- <xsl:choose>
- <xsl:when test="$titleNode">
- <xsl:text>table</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>informaltable</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:element name="{$element}">
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'tbl'"/>
- </xsl:call-template>
- <xsl:if test="@colsep">
- <xsl:copy-of select="@colsep"/>
- </xsl:if>
- <xsl:if test="@frame">
- <xsl:copy-of select="@frame"/>
- </xsl:if>
- <xsl:if test="@rowsep">
- <xsl:copy-of select="@rowsep"/>
- </xsl:if>
- <xsl:apply-templates select="@rowheader|@scale" mode="deflate"/>
- <xsl:if test="$titleNode">
- <xsl:apply-templates select="$titleNode"/>
- </xsl:if>
- <xsl:if test="$descNode">
- <xsl:apply-templates select="$descNode"/>
- </xsl:if>
- <xsl:apply-templates select="*[contains(@class,' topic/tgroup ')]"/>
- </xsl:element>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/tgroup ')]">
- <xsl:call-template name="copyAs">
- <xsl:with-param name="elementName" select="'tgroup'"/>
- </xsl:call-template>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/colspec ')]">
- <xsl:call-template name="copyAs">
- <xsl:with-param name="elementName" select="'colspec'"/>
- <xsl:with-param name="hasRemap" select="false()"/>
- </xsl:call-template>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/spanspec ')]">
- <xsl:call-template name="copyAs">
- <xsl:with-param name="elementName" select="'spanspec'"/>
- <xsl:with-param name="hasRemap" select="false()"/>
- </xsl:call-template>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/thead ')]">
- <xsl:call-template name="copyAs">
- <xsl:with-param name="elementName" select="'thead'"/>
- </xsl:call-template>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/tfoot ')]">
- <xsl:call-template name="copyAs">
- <xsl:with-param name="elementName" select="'tfoot'"/>
- </xsl:call-template>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/tbody ')]">
- <xsl:call-template name="copyAs">
- <xsl:with-param name="elementName" select="'tbody'"/>
- </xsl:call-template>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/row ')]">
- <xsl:call-template name="copyAs">
- <xsl:with-param name="elementName" select="'row'"/>
- </xsl:call-template>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/entry ')]">
- <xsl:call-template name="copyAs">
- <xsl:with-param name="elementName" select="'entry'"/>
- </xsl:call-template>
- </xsl:template>
- <!-- segmentedlist is a closer match with simpletable
- but the content model of set is too restrictive -->
- <xsl:template match="*[contains(@class,' topic/simpletable ')]">
- <xsl:variable name="colcount">
- <xsl:call-template name="maxsemcol">
- <xsl:with-param name="rows"
- select="*[contains(@class,' topic/strow ')]"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="element">
- <xsl:choose>
- <xsl:when test="@title">
- <xsl:text>table</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>informaltable</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:element name="{$element}">
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'smtbl'"/>
- </xsl:call-template>
- <xsl:if test="@title">
- <title>
- <xsl:value-of select="@title"/>
- </title>
- </xsl:if>
- <tgroup cols="{$colcount}">
- <xsl:apply-templates select="*[contains(@class,' topic/sthead ')]"/>
- <tbody>
- <xsl:apply-templates select="*[contains(@class,' topic/strow ')]"/>
- </tbody>
- </tgroup>
- </xsl:element>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/sthead ')]">
- <thead>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'sthd'"/>
- </xsl:call-template>
- <row>
- <xsl:apply-templates/>
- </row>
- </thead>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/strow ')]">
- <row>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'strw'"/>
- </xsl:call-template>
- <xsl:apply-templates/>
- </row>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/stentry ')]">
- <entry>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'stent'"/>
- </xsl:call-template>
- <xsl:if test="@title">
- <xsl:attribute name="xreflabel">
- <xsl:value-of select="@xreflabel"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:apply-templates/>
- </entry>
- </xsl:template>
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - FIGURES AND MEDIA OBJECTS
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
- <xsl:template match="*[contains(@class,' topic/fig ')]">
- <xsl:param name="titleSpec" select="' topic/title '"/>
- <xsl:param name="titleNode" select="*[contains(@class,$titleSpec)]"/>
- <xsl:variable name="descNode" select="*[contains(@class,' topic/desc ')]"/>
- <xsl:variable name="contentNode" select="*[not(contains(@class,$titleSpec)
- or contains(@class,' topic/desc '))]"/>
- <xsl:variable name="element">
- <xsl:choose>
- <xsl:when test="$titleNode or @title">
- <xsl:text>figure</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>informalfigure</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:element name="{$element}">
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'fig'"/>
- </xsl:call-template>
- <xsl:apply-templates select="@frame|@scale" mode="deflate"/>
- <xsl:choose>
- <xsl:when test="$titleNode">
- <xsl:apply-templates select="$titleNode"/>
- </xsl:when>
- <xsl:when test="@title">
- <title>
- <xsl:value-of select="@title"/>
- </title>
- </xsl:when>
- </xsl:choose>
- <xsl:if test="$descNode">
- <xsl:apply-templates select="$descNode"/>
- </xsl:if>
- <xsl:choose>
- <xsl:when test="contains($contentNode/@class,' topic/figgroup ') and (
- contains($contentNode/*/@class,' topic/dl ') or
- contains($contentNode/*/@class,' topic/gl ') or
- contains($contentNode/*/@class,' topic/note ') or
- contains($contentNode/*/@class,' topic/notelist ') or
- contains($contentNode/*/@class,' topic/ol ') or
- contains($contentNode/*/@class,' topic/p ') or
- contains($contentNode/*/@class,' topic/qalist ') or
- contains($contentNode/*/@class,' topic/ul '))">
- <blockquote remap="CONTAINER">
- <xsl:apply-templates select="$contentNode"/>
- </blockquote>
- </xsl:when>
- <xsl:when test="contains($contentNode/@class,' topic/dl ') or
- contains($contentNode/@class,' topic/gl ') or
- contains($contentNode/@class,' topic/note ') or
- contains($contentNode/@class,' topic/notelist ') or
- contains($contentNode/@class,' topic/ol ') or
- contains($contentNode/@class,' topic/p ') or
- contains($contentNode/@class,' topic/qalist ') or
- contains($contentNode/@class,' topic/ul ')">
- <blockquote remap="CONTAINER">
- <xsl:apply-templates select="$contentNode"/>
- </blockquote>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="$contentNode"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:element>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/figgroup ')]">
- <xsl:apply-templates select="." mode="deflate">
- <xsl:with-param name="descendentsOkay" select="true()"/>
- </xsl:apply-templates>
- </xsl:template>
- <!-- to do -->
- <xsl:template match="*[contains(@class,' topic/object ')]">
- <mediaobject>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'obj'"/>
- </xsl:call-template>
- <xsl:apply-templates select="." mode="deflate"/>
- </mediaobject>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/textalt ')]">
- <textobject>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'txtlt'"/>
- </xsl:call-template>
- <xsl:call-template name="makeBlock"/>
- </textobject>
- </xsl:template>
- <!-- to do -->
- <xsl:template match="*[contains(@class,' topic/image ')]">
- <mediaobject>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'img'"/>
- </xsl:call-template>
- <imageobject>
- <imagedata>
- <xsl:if test="@href">
- <xsl:attribute name="fileref">
- <xsl:value-of select="@href"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="@height">
- <xsl:attribute name="depth">
- <xsl:value-of select="@height"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="@width">
- <xsl:attribute name="width">
- <xsl:value-of select="@width"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="@align">
- <xsl:attribute name="align">
- <xsl:value-of select="@align"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:apply-templates select="@placement" mode="deflate"/>
- </imagedata>
- </imageobject>
- <xsl:if test="@alt or @longdescref">
- <textobject remap="alt_attribute">
- <xsl:if test="@alt">
- <phrase remap="#PCDATA">
- <xsl:value-of select="@alt"/>
- </phrase>
- </xsl:if>
- <xsl:if test="@longdescref">
- <xref linkend="{@href}">
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'xref'"/>
- </xsl:call-template>
- </xref>
- </xsl:if>
- </textobject>
- </xsl:if>
- </mediaobject>
- </xsl:template>
- <!-- to do: imagemap -->
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - MISCELLANEOUS AND DEFAULT
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
- <xsl:template match="*[contains(@class,' topic/draft-comment ')]">
- <remark>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'sp'"/>
- </xsl:call-template>
- <xsl:apply-templates/>
- </remark>
- </xsl:template>
- <xsl:template match="*[ not( @class ) ]">
- <xsl:message>
- <xsl:text>No class attribute for </xsl:text>
- <xsl:value-of select="name(.)"/>
- </xsl:message>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/no-topic-nesting ')]"/>
- <xsl:template match="*[@conref]">
- <!-- a well-known Docbook hack -->
- <inlinemediaobject role="{@parse}">
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="'include'"/>
- </xsl:call-template>
- <imageobject>
- <imagedata format="linespecific" fileref="{@conref}"/>
- </imageobject>
- </inlinemediaobject>
- </xsl:template>
- <!-- default element rule -->
- <xsl:template match="*">
- <!-- to debug, uncomment the following message -->
- <!--
- <xsl:message>
- <xsl:text>unmapped: </xsl:text>
- <xsl:value-of select="local-name(.)"/>
- <xsl:text> spec="</xsl:text>
- <xsl:value-of select="@class"/>
- <xsl:text>"</xsl:text>
- </xsl:message>
- -->
- <xsl:apply-templates select="." mode="deflate"/>
- </xsl:template>
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - UTILITIES
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
- <xsl:template name="setStandardAttr">
- <xsl:param name="IDPrefix" select="local-name(.)"/>
- <xsl:if test="not( @id )">
- <xsl:attribute name="id">
- <xsl:call-template name="provideID">
- <xsl:with-param name="IDPrefix" select="$IDPrefix"/>
- </xsl:call-template>
- </xsl:attribute>
- </xsl:if>
- <xsl:attribute name="remap">
- <xsl:value-of select="local-name(.)"/>
- </xsl:attribute>
- <xsl:for-each select="@*">
- <xsl:call-template name="testStandardAttr">
- <xsl:with-param name="IDPrefix" select="$IDPrefix"/>
- </xsl:call-template>
- </xsl:for-each>
- </xsl:template>
- <xsl:template name="testStandardAttr">
- <xsl:param name="IDPrefix"/>
- <xsl:param name="attrName" select="local-name(.)"/>
- <xsl:choose>
- <xsl:when test="$attrName='id'">
- <xsl:attribute name="id">
- <xsl:value-of select="."/>
- </xsl:attribute>
- </xsl:when>
- <xsl:when test="$attrName='spec'">
- <xsl:attribute name="remap">
- <xsl:value-of select="."/>
- </xsl:attribute>
- </xsl:when>
- <xsl:when test="$attrName='platform'">
- <xsl:attribute name="arch">
- <xsl:value-of select="."/>
- </xsl:attribute>
- </xsl:when>
- <xsl:when test="$attrName='product'">
- <xsl:attribute name="os">
- <xsl:value-of select="."/>
- </xsl:attribute>
- </xsl:when>
- <xsl:when test="$attrName='version'">
- <xsl:attribute name="revision">
- <xsl:value-of select="."/>
- </xsl:attribute>
- </xsl:when>
- <xsl:when test="$attrName='audience'">
- <xsl:attribute name="userlevel">
- <xsl:value-of select="."/>
- </xsl:attribute>
- </xsl:when>
- <!-- leave non-standard attributes to be handled locally -->
- </xsl:choose>
- </xsl:template>
- <xsl:template name="provideID">
- <xsl:param name="IDPrefix" select="local-name(.)"/>
- <xsl:choose>
- <xsl:when test="@id">
- <xsl:value-of select="@id"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="concat( $IDPrefix, generate-id() )"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template name="copyAs">
- <xsl:param name="elementName" select="local-name(.)"/>
- <xsl:param name="hasRemap" select="true()"/>
- <xsl:element name="{$elementName}">
- <xsl:for-each select="@*">
- <xsl:choose>
- <xsl:when test="local-name(.) = 'spec'">
- <xsl:if test="$hasRemap">
- <xsl:attribute name="remap">
- <xsl:value-of select="."/>
- </xsl:attribute>
- </xsl:if>
- </xsl:when>
- <xsl:when test="local-name(.) = 'class'">
- </xsl:when>
- <xsl:otherwise>
- <xsl:copy/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- <xsl:apply-templates/>
- </xsl:element>
- </xsl:template>
- <xsl:template name="makeBlock">
- <xsl:param name="node" select="."/>
- <xsl:call-template name="makeBlockList">
- <xsl:with-param name="nodelist" select="$node/*|$node/text()"/>
- </xsl:call-template>
- </xsl:template>
- <xsl:template name="deflateBlock">
- <xsl:param name="id" select="concat('elem', generate-id())"/>
- <xsl:param name="element" select="local-name(.)"/>
- <xsl:param name="nodelist" select="*|text()"/>
- <xsl:call-template name="deflateElementStart">
- <xsl:with-param name="id" select="$id"/>
- <xsl:with-param name="element" select="$element"/>
- </xsl:call-template>
- <xsl:call-template name="makeBlockList">
- <xsl:with-param name="nodelist" select="$nodelist"/>
- </xsl:call-template>
- <xsl:call-template name="deflateElementEnd">
- <xsl:with-param name="id" select="$id"/>
- <xsl:with-param name="element" select="$element"/>
- </xsl:call-template>
- </xsl:template>
- <!-- where block is optional in DITA but required in Docbook,
- wrap PCDATA or phrase elements in para -->
- <xsl:template name="makeBlockList">
- <xsl:param name="currnode" select="1"/>
- <xsl:param name="nodelist"/>
- <!-- default value must match $FindAny variable -->
- <xsl:param name="findTarget" select="1"/>
- <xsl:variable name="FindAny" select="1"/>
- <xsl:variable name="FindBlock" select="2"/>
- <xsl:variable name="FindNonBlock" select="3"/>
- <xsl:if test="count($nodelist)>=$currnode">
- <xsl:variable name="node" select="$nodelist[position()=$currnode]"/>
- <xsl:variable name="isBlock">
- <xsl:call-template name="isBlock">
- <xsl:with-param name="nodelist" select="$node"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$isBlock=1">
- <xsl:if test="$findTarget!=$FindNonBlock">
- <xsl:apply-templates select="$node"/>
- <xsl:call-template name="makeBlockList">
- <xsl:with-param name="nodelist" select="$nodelist"/>
- <xsl:with-param name="currnode" select="$currnode + 1"/>
- <xsl:with-param name="findTarget" select="$FindAny"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="$findTarget=$FindAny">
- <xsl:variable name="nonblock">
- <xsl:apply-templates select="$node"/>
- <xsl:call-template name="makeBlockList">
- <xsl:with-param name="nodelist" select="$nodelist"/>
- <xsl:with-param name="currnode" select="$currnode + 1"/>
- <xsl:with-param name="findTarget" select="$FindNonBlock"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:if test="normalize-space(string($nonblock))!=''">
- <para remap="#PCDATA">
- <xsl:copy-of select="$nonblock"/>
- </para>
- </xsl:if>
- <xsl:call-template name="makeBlockList">
- <xsl:with-param name="nodelist" select="$nodelist"/>
- <xsl:with-param name="currnode" select="$currnode + 1"/>
- <xsl:with-param name="findTarget" select="$FindBlock"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$findTarget=$FindNonBlock">
- <xsl:apply-templates select="$node"/>
- <xsl:call-template name="makeBlockList">
- <xsl:with-param name="nodelist" select="$nodelist"/>
- <xsl:with-param name="currnode" select="$currnode + 1"/>
- <xsl:with-param name="findTarget" select="$FindNonBlock"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$findTarget=$FindBlock">
- <xsl:call-template name="makeBlockList">
- <xsl:with-param name="nodelist" select="$nodelist"/>
- <xsl:with-param name="currnode" select="$currnode + 1"/>
- <xsl:with-param name="findTarget" select="$FindBlock"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:message>
- <xsl:text>Unknown target type for find: </xsl:text>
- <xsl:value-of select="$findTarget"/>
- </xsl:message>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- </xsl:template>
- <xsl:template name="isBlock">
- <xsl:param name="nodelist" select="."/>
- <xsl:choose>
- <xsl:when test="boolean($nodelist[
- contains(@class,' topic/dl ')
- or contains(@class,' topic/fig ')
- or contains(@class,' topic/itemgroup ')
- or contains(@class,' topic/lines ')
- or contains(@class,' topic/lq ')
- or contains(@class,' topic/note ')
- or contains(@class,' topic/ol ')
- or contains(@class,' topic/p ')
- or contains(@class,' topic/pre ')
- or contains(@class,' topic/simpletable ')
- or contains(@class,' topic/table ')
- or contains(@class,' topic/ul ')
- ])">
- <xsl:value-of select="1"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="0"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template name="makeBlockCont">
- <xsl:param name="titleSpec" select="' topic/title '"/>
- <xsl:param name="titleNode" select="*[contains(@class,$titleSpec)]"/>
- <xsl:param name="isContReq" select="false()"/>
- <xsl:param name="IDPrefix"/>
- <xsl:variable name="hasBlocks">
- <xsl:call-template name="isBlock">
- <xsl:with-param name="nodelist" select="*"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$hasBlocks=1">
- <xsl:choose>
- <xsl:when test="$isContReq or $titleNode">
- <xsl:choose>
- <xsl:when test="count(*[not(contains(@class,$titleSpec))]) =
- count(*[contains(@class,' topic/qalist ')])">
- <qandaset>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="$IDPrefix"/>
- </xsl:call-template>
- <xsl:if test="$titleNode">
- <xsl:apply-templates select="$titleNode"/>
- </xsl:if>
- <xsl:apply-templates select="*[contains(@class,' topic/qalist ')]">
- <xsl:with-param name="element" select="'qandadiv'"/>
- </xsl:apply-templates>
- </qandaset>
- </xsl:when>
- <xsl:otherwise>
- <!-- probably need to add other mappings -->
- <xsl:variable name="element">
- <xsl:text>sidebar</xsl:text>
- </xsl:variable>
- <xsl:element name="{$element}">
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="$IDPrefix"/>
- </xsl:call-template>
- <xsl:if test="$titleNode">
- <xsl:apply-templates select="$titleNode"/>
- </xsl:if>
- <xsl:call-template name="makeBlockList">
- <xsl:with-param name="nodelist"
- select="*[not(contains(@class,$titleSpec))]|text()"/>
- </xsl:call-template>
- </xsl:element>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="deflateBlock">
- <xsl:with-param name="nodelist"
- select="*[not(contains(@class,$titleSpec))]|text()"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="makePara">
- <xsl:with-param name="titleSpec" select="$titleSpec"/>
- <xsl:with-param name="titleNode" select="$titleNode"/>
- <xsl:with-param name="IDPrefix" select="$IDPrefix"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template name="makePara">
- <xsl:param name="titleSpec" select="' topic/title '"/>
- <xsl:param name="titleNode" select="*[contains(@class,$titleSpec)]"/>
- <xsl:param name="role" select="''"/>
- <xsl:param name="IDPrefix"/>
- <xsl:choose>
- <xsl:when test="$titleNode or @title">
- <formalpara>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="$IDPrefix"/>
- </xsl:call-template>
- <xsl:choose>
- <xsl:when test="$role!=''">
- <xsl:attribute name="role">
- <xsl:value-of select="$role"/>
- </xsl:attribute>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="$titleNode">
- <xsl:apply-templates select="@title" mode="deflate"/>
- <title>
- <xsl:apply-templates select="$titleNode/*|$titleNode/text()"/>
- </title>
- </xsl:when>
- <xsl:otherwise>
- <title>
- <xsl:value-of select="@title"/>
- </title>
- </xsl:otherwise>
- </xsl:choose>
- <para>
- <xsl:apply-templates select="*[not(contains(@class,$titleSpec))]"/>
- </para>
- </formalpara>
- </xsl:when>
- <xsl:otherwise>
- <para>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="$IDPrefix"/>
- </xsl:call-template>
- <xsl:apply-templates/>
- </para>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template name="makeTitle">
- <xsl:param name="elemTitled"/>
- <xsl:param name="elemUntitled" select="$elemTitled"/>
- <xsl:param name="titleSpec" select="' topic/title '"/>
- <xsl:param name="titleNode" select="*[contains(@class,$titleSpec)]"/>
- <xsl:param name="role" select="''"/>
- <xsl:param name="IDPrefix"/>
- <xsl:choose>
- <xsl:when test="$titleNode or @title">
- <xsl:element name="{$elemTitled}">
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="$IDPrefix"/>
- </xsl:call-template>
- <xsl:choose>
- <xsl:when test="$role!=''">
- <xsl:attribute name="role">
- <xsl:value-of select="$role"/>
- </xsl:attribute>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="$titleNode">
- <xsl:apply-templates select="@title" mode="deflate"/>
- <title>
- <xsl:apply-templates select="$titleNode/*|$titleNode/text()"/>
- </title>
- </xsl:when>
- <xsl:otherwise>
- <title>
- <xsl:value-of select="@title"/>
- </title>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:apply-templates select="*[not(contains(@class,$titleSpec))]"/>
- </xsl:element>
- </xsl:when>
- <xsl:otherwise>
- <xsl:element name="{$elemUntitled}">
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="$IDPrefix"/>
- </xsl:call-template>
- <xsl:apply-templates/>
- </xsl:element>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template name="wrapTitle">
- <xsl:param name="wrapElem"/>
- <xsl:param name="coreElem"/>
- <xsl:param name="titleSpec" select="' topic/title '"/>
- <xsl:param name="titleNode" select="*[contains(@class,$titleSpec)]"/>
- <xsl:param name="role" select="''"/>
- <xsl:param name="IDPrefix"/>
- <xsl:choose>
- <xsl:when test="$titleNode or @title">
- <xsl:element name="{$wrapElem}">
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="$IDPrefix"/>
- </xsl:call-template>
- <xsl:choose>
- <xsl:when test="$role!=''">
- <xsl:attribute name="role">
- <xsl:value-of select="$role"/>
- </xsl:attribute>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="$titleNode">
- <xsl:apply-templates select="@title" mode="deflate"/>
- <title>
- <xsl:apply-templates select="$titleNode/*|$titleNode/text()"/>
- </title>
- </xsl:when>
- <xsl:otherwise>
- <title>
- <xsl:value-of select="@title"/>
- </title>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:element name="{$coreElem}">
- <xsl:apply-templates select="*[not(contains(@class,$titleSpec))]"/>
- </xsl:element>
- </xsl:element>
- </xsl:when>
- <xsl:otherwise>
- <xsl:element name="{$coreElem}">
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="$IDPrefix"/>
- </xsl:call-template>
- <xsl:apply-templates/>
- </xsl:element>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template name="wrapLiteralTitle">
- <xsl:param name="classAttr"/>
- <xsl:param name="IDPrefix"/>
- <xsl:choose>
- <xsl:when test="@title">
- <blockquote>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="$IDPrefix"/>
- </xsl:call-template>
- <title>
- <xsl:value-of select="@title"/>
- </title>
- <literallayout class="{$classAttr}">
- <xsl:apply-templates/>
- </literallayout>
- </blockquote>
- </xsl:when>
- <xsl:otherwise>
- <literallayout class="{$classAttr}">
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="$IDPrefix"/>
- </xsl:call-template>
- <xsl:apply-templates/>
- </literallayout>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template name="programtext">
- <xsl:param name="IDPrefix" select="'prgtxt'"/>
- <literal>
- <xsl:call-template name="setStandardAttr">
- <xsl:with-param name="IDPrefix" select="$IDPrefix"/>
- </xsl:call-template>
- <xsl:if test="@optreq">
- <xsl:attribute name="role">
- <xsl:value-of select="@optreq"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:apply-templates select="@convar" mode="deflate"/>
- <xsl:apply-templates/>
- </literal>
- </xsl:template>
- <xsl:template name="countsemcols">
- <xsl:param name="row"/>
- <xsl:variable name="cols" select="$row/*[
- contains(@class,' topic/stentry ') or
- contains(@class,' topic/sthead ')]"/>
- <xsl:value-of select="count($cols)"/>
- </xsl:template>
- <xsl:template name="maxsemcol">
- <xsl:param name="rows"/>
- <xsl:param name="colcount" select="0"/>
- <xsl:variable name="firstcount">
- <xsl:call-template name="countsemcols">
- <xsl:with-param name="row" select="$rows[position() = 1]"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="newcount">
- <xsl:choose>
- <xsl:when test="$firstcount > $colcount">
- <xsl:value-of select="$firstcount"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$colcount"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="restrows" select="$rows[position() > 1]"/>
- <xsl:choose>
- <xsl:when test="$restrows">
- <xsl:call-template name="maxsemcol">
- <xsl:with-param name="rows" select="$restrows"/>
- <xsl:with-param name="colcount" select="$newcount"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$newcount"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <!-- Add for "New <data> element (#9)" in DITA 1.1 -->
- <xsl:template match="*[contains(@class,' topic/data ')]"/>
- <!-- Add for "Support foreign content vocabularies such as
- MathML and SVG with <unknown> (#35) " in DITA 1.1 -->
- <xsl:template match="*[contains(@class,' topic/foreign ') or contains(@class,' topic/unknown ')]"/>
- </xsl:stylesheet>
|