Orb/CxxApiRef2Dita/cxx.xsl
changeset 0 42188c7ea2d9
equal deleted inserted replaced
-1:000000000000 0:42188c7ea2d9
       
     1 <?xml version="1.0" encoding="UTF-8"?>
       
     2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:data="urn:some.urn" exclude-result-prefixes="data">
       
     3 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     4 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     5 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     6 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     7 <!-- Initial Contributors:
       
     8 	Nokia Corporation - initial contribution.
       
     9 Contributors: 
       
    10 -->
       
    11     <!--topic_xref pr-d_xref api-d_apipackage-->
       
    12     <xsl:template name="isParentReference">
       
    13         <xsl:choose>
       
    14             <xsl:when test="name(..)='cxxClassInherits' or name(..)='cxxTypedef' or name(..)='cxxVariable' or name(..)='cxxEnumeration' or name(..)='cxxEnumerator' or name(..)='cxxFile' or name(..)='cxxGlobals' or name(..)='cxxPackage' or name(..)='cxxDefine' or name(..)='cxxFunction' or name(..)='cxxClass' or name(..)='cxxStruct' or name(..)='cxxUnion'">
       
    15                 <xsl:value-of select="'true'"/>
       
    16             </xsl:when>
       
    17             <xsl:otherwise>
       
    18                 <xsl:value-of select="'false'"/>
       
    19             </xsl:otherwise>
       
    20         </xsl:choose>
       
    21     </xsl:template>
       
    22     
       
    23     <!--topic_xref pr-d_xref api-d_apipackage-->
       
    24     <xsl:template match="cxxbitfield|cxxclass|cxxdefine|cxxenumerator|cxxfile|cxxfunction|cxxnamespace|cxxparameter|cxxprogram|cxxstruct|cxxtypedef|cxxunion|cxxvariable">
       
    25         <xsl:variable name="isInReference">
       
    26             <xsl:call-template name="isParentReference"/>
       
    27         </xsl:variable>
       
    28         <xsl:choose>
       
    29         <!-- DEFECT xref was output inside reference this is not allowed in dita reference-->
       
    30             <xsl:when test="$isInReference='true'">
       
    31                 <xsl:comment>A specialisation of reference had a child that cannot be inside reference</xsl:comment>            
       
    32                 <xsl:call-template name="wrapInRequiredCleanup"/>
       
    33             </xsl:when>
       
    34             <xsl:otherwise>
       
    35                 <xref>
       
    36                     <xsl:apply-templates select="@*"/>
       
    37                     <xsl:apply-templates/>
       
    38                 </xref>
       
    39             </xsl:otherwise>
       
    40         </xsl:choose>        
       
    41         <xref>
       
    42             <xsl:apply-templates select="@*"/>
       
    43             <xsl:apply-templates/>
       
    44         </xref>
       
    45     </xsl:template>
       
    46 
       
    47     <!-- map_map apiMap_apiMap-->
       
    48     <xsl:template match="cxxAPIMap">
       
    49         <map>
       
    50             <xsl:apply-templates select="@*"/>
       
    51             <xsl:apply-templates/>
       
    52         </map>
       
    53     </xsl:template>
       
    54 
       
    55     <!--map_topicref apiMap_apiItemRef-->
       
    56     <xsl:template match="cxxClassRef|cxxDefineRef|cxxEnumerationRef|cxxFileRef|cxxFunctionRef|cxxNamespaceRef|cxxProgramRef|cxxStructRef|cxxTypedefRef|cxxUnionRef|cxxVariableRef">
       
    57         <topicref>
       
    58             <xsl:apply-templates select="@*"/>
       
    59             <xsl:apply-templates/>
       
    60         </topicref>
       
    61     </xsl:template>
       
    62 
       
    63     <!--topic_body reference_refbody apiRef_apiDetail apiClassifier_apiClassifierDetail-->
       
    64     <xsl:template match="cxxClassDetail|cxxStructDetail|cxxUnionDetail|cxxEnumerationDetail|cxxEnumeratorDetail|cxxFileDetail">
       
    65         <refbody>
       
    66             <xsl:apply-templates select="@*"/>
       
    67             <xsl:apply-templates/>
       
    68         </refbody>
       
    69     </xsl:template>
       
    70 
       
    71     <!--topic_body reference_refbody apiRef_apiDetail apiOperation_apiOperationDetail-->
       
    72     <xsl:template match="cxxDefineDetail|cxxFunctionDetail">
       
    73         <refbody>
       
    74             <xsl:apply-templates select="@*"/>
       
    75             <xsl:apply-templates/>
       
    76         </refbody>
       
    77     </xsl:template>
       
    78 
       
    79     <!--topic_body reference_refbody apiRef_apiDetail apiPackage_apiDetail-->
       
    80     <xsl:template match="cxxPackageDetail">
       
    81         <refbody>
       
    82             <xsl:apply-templates select="@*"/>
       
    83             <xsl:apply-templates/>
       
    84         </refbody>
       
    85     </xsl:template>
       
    86 
       
    87     <!--topic_body reference_refbody apiRef_apiDetail apiValue_apiValueDetail-->
       
    88     <xsl:template match="cxxTypedefDetail|cxxVariableDetail">
       
    89         <refbody>
       
    90             <xsl:apply-templates select="@*"/>
       
    91             <xsl:apply-templates/>
       
    92         </refbody>
       
    93     </xsl:template>
       
    94 
       
    95     <!--topic_ph reference_ph apiRef_apiDefItem-->
       
    96     <xsl:template match="cxxClassAPIItemLocation|cxxClassDerivation|cxxClassDerivations|cxxTemplateParamList|cxxDefineAPIItemLocation|cxxFunctionAPIItemLocation|cxxStructAPIItemLocation|cxxStructDerivation|cxxStructDerivations|cxxStructTemplateParamList|cxxStructTemplateParameter|cxxUnionAPIItemLocation|cxxUnionDerivation|cxxUnionDerivations|cxxClassTemplateParameter|cxxClassTemplateParamList|cxxEnumerationAPIItemLocation|cxxEnumeratorAPIItemLocation|cxxFileAPIItemLocation|cxxTypedefAPIItemLocation|cxxUnionTemplateParamList|cxxVariableAPIItemLocation|cxxFunctionDeclaredType|cxxFunctionNameLookup|cxxFunctionParameters|cxxFunctionParameter|cxxFunctionParameterDeclaredType|cxxFunctionParameterDeclarationName|cxxFunctionParameterDefaultValue|cxxFunctionParameterDefinitionName|cxxFunctionParameterType|cxxFunctionPrototype|cxxFunctionReturnType|cxxFunctionScopedName">
       
    97 
       
    98         <xsl:variable name="isInReference">
       
    99             <xsl:call-template name="isParentReference"/>
       
   100         </xsl:variable>
       
   101         <xsl:choose>
       
   102         <!-- DEFECT ph was output inside reference this is not allowed in dita reference-->
       
   103             <xsl:when test="$isInReference='true'">
       
   104                 <xsl:comment>A specialisation of reference had a child that cannot be inside reference</xsl:comment>            
       
   105                 <xsl:call-template name="wrapInRequiredCleanup"/>
       
   106             </xsl:when>
       
   107             <xsl:otherwise>
       
   108                 <ph>
       
   109                     <xsl:apply-templates select="@*"/>
       
   110                     <xsl:apply-templates/>
       
   111                 </ph>
       
   112             </xsl:otherwise>
       
   113         </xsl:choose>
       
   114     </xsl:template>
       
   115 
       
   116     <!--topic_section reference_section apiRef_apiDef apiClassifier_apiClassifierDef-->
       
   117     <xsl:template match="cxxClassDefinition|cxxStructDefinition|cxxUnionDefinition|cxxEnumerationDefinition|cxxEnumeratorDefinition">
       
   118         <section>
       
   119             <xsl:apply-templates select="@*"/>
       
   120             <xsl:apply-templates/>
       
   121         </section>
       
   122     </xsl:template>
       
   123 
       
   124     <!--topic_section reference_section apiRef_apiDef apiOperation_apiOperationDef-->
       
   125     <xsl:template match="cxxDefineDefinition|cxxFunctionDefinition">
       
   126         <section>
       
   127             <xsl:apply-templates select="@*"/>
       
   128             <xsl:apply-templates/>
       
   129         </section>
       
   130     </xsl:template>
       
   131 
       
   132     <!--topic_section reference_section apiRef_apiDef apiValue_apiValueDef-->
       
   133     <xsl:template match="cxxTypedefDefinition|cxxVariableDefinition">
       
   134         <section>
       
   135             <xsl:apply-templates select="@*"/>
       
   136             <xsl:apply-templates/>
       
   137         </section>
       
   138     </xsl:template>
       
   139 
       
   140     <!--topic_state reference_state apiRef_apiArray apiOperation_apiArray-->
       
   141     <xsl:template match="cxxDefineArrayType|cxxFunctionArrayType|cxxTypedefArrayType|cxxVariableArrayType">
       
   142 		<!--
       
   143         <state>        
       
   144             <xsl:call-template name="addMissingStateAttribs"/>
       
   145             <xsl:apply-templates select="@*"/>
       
   146             <xsl:apply-templates/>
       
   147         </state>
       
   148 		-->
       
   149     </xsl:template>
       
   150 
       
   151     <!--topic_state reference_state apiRef_apiQualifier apiClassifier_apiQualifier-->
       
   152     <xsl:template match="cxxClassAbstract|cxxClassAccessSpecifier|cxxClassDeclarationFile|cxxClassDeclarationFileLine|cxxClassDefinitionFile|cxxClassDefinitionFileLineEnd|cxxClassDefinitionFileLineStart|cxxClassDerivationVirtual|cxxDefineDeclarationFile|cxxDefineDeclarationFileLine|cxxDefineDefinitionFile|cxxDefineDefinitionFileLineEnd|cxxDefineDefinitionFileLineStart|cxxFunctionDeclarationFile|cxxFunctionDeclarationFileLine|cxxFunctionDefinitionFile|cxxFunctionDefinitionFileLineEnd|cxxFunctionDefinitionFileLineStart|cxxStructAbstract|cxxStructAccessSpecifier|cxxStructDeclarationFile|cxxStructDeclarationFileLine|cxxStructDefinitionFile|cxxStructDefinitionFileLineEnd|cxxStructDefinitionFileLineStart|cxxStructDerivationAccessSpecifier|cxxStructDerivationVirtual|cxxUnionAbstract|cxxUnionAccessSpecifier|cxxUnionDeclarationFile|cxxUnionDeclarationFileLine|cxxUnionDefinitionFile|cxxUnionDefinitionFileLineEnd|cxxUnionDefinitionFileLineStart|cxxUnionDerivationAccessSpecifier|cxxUnionDerivationVirtual|cxxDefineAccessSpecifier|cxxEnumerationAccessSpecifier|cxxEnumerationDeclarationFile|cxxEnumerationDeclarationFileLine|cxxEnumerationDefinitionFile|cxxEnumerationDefinitionFileLineEnd|cxxEnumerationDefinitionFileLineStart|cxxEnumeratorAccessSpecifier|cxxEnumeratorDeclarationFile|cxxEnumeratorDeclarationFileLine|cxxFileDeclarationFile|cxxFunctionAccessSpecifier">
       
   153         <!--
       
   154         <state>
       
   155             <xsl:call-template name="addMissingStateAttribs"/>
       
   156             <xsl:apply-templates select="@*"/>
       
   157             <xsl:apply-templates/>
       
   158         </state>
       
   159 		-->
       
   160     </xsl:template>
       
   161 
       
   162     <!--topic_state reference_state apiRef_apiQualifier apiOperation_apiQualifier-->
       
   163     <xsl:template match="cxxDefineConst|cxxDefineConstructor|cxxDefineDestructor|cxxDefineExplicit|cxxDefineInline|cxxDefinePureVirtual|cxxDefineStorageClassSpecifierExtern|cxxDefineStorageClassSpecifierMutable|cxxDefineStorageClassSpecifierStatic|cxxDefineVirtual|cxxDefineVoidType|cxxFunctionConst|cxxFunctionConstructor|cxxFunctionDestructor|cxxFunctionExplicit|cxxFunctionInline|cxxFunctionPureVirtual|cxxFunctionStorageClassSpecifierExtern|cxxFunctionStorageClassSpecifierMutable|cxxFunctionStorageClassSpecifierStatic|cxxFunctionVirtual|cxxFunctionFundementalType|cxxFunctionVoidType|cxxTypedefVoidType|cxxVariableConst|cxxVariableStorageClassSpecifierExtern|cxxVariableStorageClassSpecifierMutable|cxxVariableStorageClassSpecifierStatic|cxxVariableVoidType">
       
   164 		<!--
       
   165         <state>
       
   166             <xsl:call-template name="addMissingStateAttribs"/>
       
   167             <xsl:apply-templates select="@*"/>
       
   168             <xsl:apply-templates/>
       
   169         </state>
       
   170 		-->
       
   171     </xsl:template>
       
   172     
       
   173     <xsl:template name="addMissingStateAttribs">
       
   174         <xsl:if test="not(@name)">
       
   175             <xsl:attribute name="name">name</xsl:attribute>
       
   176         </xsl:if>
       
   177         <xsl:if test="not(@value)">
       
   178             <xsl:attribute name="value">value</xsl:attribute>           
       
   179         </xsl:if>        
       
   180     </xsl:template>
       
   181     <!--topic_state reference_state apiRef_apiDetail-->
       
   182     <xsl:template match="cxxClassInheritsDetail|cxxStructInheritsDetail">
       
   183         <refbody>
       
   184 			<section>
       
   185 				<ph>
       
   186 					<xsl:apply-templates select="@*"/>
       
   187 					<xsl:apply-templates/>
       
   188 				</ph>
       
   189 			</section>
       
   190         </refbody>
       
   191     </xsl:template>
       
   192 
       
   193     <!--topic_topic reference_refbody apiRef_apiRef apiClassifier_apiClassifier-->
       
   194     <xsl:template match="cxxClass|cxxStruct|cxxUnion">
       
   195         <reference>
       
   196             <xsl:apply-templates select="@*"/>
       
   197             <xsl:apply-templates/>
       
   198         </reference>
       
   199     </xsl:template>
       
   200 
       
   201     <!--topic_topic reference_reference apiRef_apiRef apiOperation_apiOperation-->
       
   202     <xsl:template match="cxxDefine|cxxFunction">
       
   203         <reference>
       
   204             <xsl:apply-templates select="@*"/>
       
   205             <xsl:apply-templates/>
       
   206         </reference>
       
   207     </xsl:template>
       
   208 
       
   209     <!--topic_topic reference_reference apiRef_apiRef apiPackage_apiPackage-->
       
   210     <xsl:template match="cxxFile|cxxGlobals|cxxPackage">
       
   211         <reference>
       
   212             <xsl:apply-templates select="@*"/>
       
   213             <xsl:apply-templates/>
       
   214         </reference>
       
   215     </xsl:template>
       
   216 
       
   217     <!--topic_topic reference_reference apiRef_apiRef apiValue_apiValue-->
       
   218     <xsl:template match="cxxTypedef|cxxVariable|cxxEnumeration|cxxEnumerator">
       
   219         <reference>
       
   220             <xsl:apply-templates select="@*"/>
       
   221             <xsl:apply-templates/>
       
   222         </reference>
       
   223     </xsl:template>
       
   224 
       
   225     <!--topic_topic reference_reference apiRef_apiRef-->
       
   226     <xsl:template match="cxxClassInherits|cxxStructInherits">
       
   227         <reference id="{generate-id(.)}">
       
   228             <title>Class Inheritance</title>
       
   229             <xsl:apply-templates select="@*"/>
       
   230             <xsl:apply-templates/>
       
   231         </reference>
       
   232     </xsl:template>
       
   233 
       
   234     <!--topic_xref reference_xref apiRef_apiRelation apiClassifier_apiBaseClassifier-->
       
   235     <xsl:template match="cxxClassBaseClass|cxxClassBaseStruct|cxxClassBaseUnion|cxxStructBaseClass|cxxStructBaseStruct|cxxStructBaseUnion|cxxUnionBaseClass|cxxUnionBaseStruct|cxxUnionBaseUnion">
       
   236         <xsl:variable name="isInReference">
       
   237             <xsl:call-template name="isParentReference"/>
       
   238         </xsl:variable>
       
   239         <xsl:choose>
       
   240         <!-- DEFECT xref was output inside reference this is not allowed in dita reference-->
       
   241             <xsl:when test="$isInReference='true'">
       
   242                 <xsl:comment>A specialisation of reference had a child that cannot be inside reference</xsl:comment>            
       
   243                 <xsl:call-template name="wrapInRequiredCleanup"/>
       
   244             </xsl:when>
       
   245             <xsl:otherwise>
       
   246                 <xref>
       
   247                     <xsl:apply-templates select="@*"/>
       
   248                     <xsl:apply-templates/>
       
   249                 </xref>
       
   250             </xsl:otherwise>
       
   251         </xsl:choose>
       
   252     </xsl:template>
       
   253 
       
   254     <!--topic_xref reference_xref apiRef_apiRelation apiOperation_apiOperationClassifier-->
       
   255     <xsl:template match="cxxDefineClassType|cxxDefineStructType|cxxDefineUnionType|cxxFunctionClassType|cxxFunctionStructType|cxxFunctionUnionType|cxxTypedefClassType|cxxTypedefStructType|cxxTypedefUnionType|cxxVariableClassType|cxxVariableStructType|cxxVariableUnionType">
       
   256         <xsl:variable name="isInReference">
       
   257             <xsl:call-template name="isParentReference"/>
       
   258         </xsl:variable>
       
   259         <xsl:choose>
       
   260         <!-- DEFECT xref was output inside reference this is not allowed in dita reference-->
       
   261             <xsl:when test="$isInReference='true'">
       
   262                 <xsl:comment>A specialisation of reference had a child that cannot be inside reference</xsl:comment>            
       
   263                 <xsl:call-template name="wrapInRequiredCleanup"/>
       
   264             </xsl:when>
       
   265             <xsl:otherwise>
       
   266                 <xref>
       
   267                     <xsl:apply-templates select="@*"/>
       
   268                     <xsl:apply-templates/>
       
   269                 </xref>
       
   270             </xsl:otherwise>
       
   271         </xsl:choose>
       
   272     </xsl:template>
       
   273 
       
   274     <!--topic_xref reference_xref apiRef_apiRelation-->
       
   275     <xsl:template match="cxxClassNestedClass|cxxClassNestedStruct|cxxClassNestedUnion|cxxStructNestedClass|cxxStructNestedStruct|cxxStructNestedUnion|cxxUnionNestedClass|cxxUnionNestedStruct|cxxUnionNestedUnion|cxxClassEnumerationInherited|cxxClassEnumeratorInherited|cxxClassFunctionInherited|cxxClassVariableInherited|cxxStructEnumerationInherited|cxxStructEnumeratorInherited|cxxStructFunctionInherited|cxxStructVariableInherited|cxxFunctionReimplemented">
       
   276         <xsl:variable name="isInReference">
       
   277             <xsl:call-template name="isParentReference"/>
       
   278         </xsl:variable>
       
   279         <xsl:choose>
       
   280         <!-- DEFECT xref was output inside reference this is not allowed in dita reference-->
       
   281             <xsl:when test="$isInReference='true'">
       
   282                 <xsl:comment>A specialisation of reference had a child that cannot be inside reference</xsl:comment>
       
   283                 <xsl:call-template name="wrapInRequiredCleanup"/>
       
   284             </xsl:when>
       
   285             <xsl:otherwise>
       
   286                 <xref>
       
   287                     <xsl:apply-templates select="@*"/>
       
   288                     <xsl:apply-templates/>
       
   289                 </xref>
       
   290             </xsl:otherwise>
       
   291         </xsl:choose>
       
   292     </xsl:template>
       
   293 </xsl:stylesheet>