Attachment 'toc.xsl'

Download

   1 <?xml version="1.0" encoding="UTF-8"?>
   2 <xsl:stylesheet version="1.0" xmlns="http://www.w3.org/MarkUp/Wilbur/HTML32.dtd"
   3                               xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   4                               xmlns:msxsl="urn:schemas-microsoft-com:xslt"
   5                               xmlns:html="http://www.w3.org/MarkUp/Wilbur/HTML32.dtd"
   6                               xmlns:wwtoc="urn:WebWorks-Engine-TOC-Schema"
   7                               xmlns:wwlinks="urn:WebWorks-Engine-Links-Schema"
   8                               xmlns:wwmode="urn:WebWorks-Engine-Mode"
   9                               xmlns:wwfiles="urn:WebWorks-Engine-Files-Schema"
  10                               xmlns:wwdoc="urn:WebWorks-Document-Schema"
  11                               xmlns:wwbehaviors="urn:WebWorks-Behaviors-Schema"
  12                               xmlns:wwsplits="urn:WebWorks-Engine-Splits-Schema"
  13                               xmlns:wwproject="urn:WebWorks-Publish-Project"
  14                               xmlns:wwpage="urn:WebWorks-Page-Template-Schema"
  15                               xmlns:wwlocale="urn:WebWorks-Locale-Schema"
  16                               xmlns:wwprogress="urn:WebWorks-XSLT-Extension-Progress"
  17                               xmlns:wwlog="urn:WebWorks-XSLT-Extension-Log"
  18                               xmlns:wwfilesystem="urn:WebWorks-XSLT-Extension-FileSystem"
  19                               xmlns:wwuri="urn:WebWorks-XSLT-Extension-URI"
  20                               xmlns:wwstring="urn:WebWorks-XSLT-Extension-StringUtilities"
  21                               xmlns:wwunits="urn:WebWorks-XSLT-Extension-Units"
  22                               xmlns:wwfilesext="urn:WebWorks-XSLT-Extension-Files"
  23                               xmlns:wwprojext="urn:WebWorks-XSLT-Extension-Project"
  24                               xmlns:wwexsldoc="urn:WebWorks-XSLT-Extension-Document"
  25                               exclude-result-prefixes="xsl msxsl html wwtoc wwlinks wwmode wwfiles wwdoc wwbehaviors wwsplits wwproject wwpage wwlocale wwprogress wwlog wwfilesystem wwuri wwstring wwunits wwfilesext wwprojext wwexsldoc"
  26 >
  27  <xsl:param name="GlobalInput" />
  28  <xsl:param name="GlobalPipelineName" />
  29  <xsl:param name="GlobalProject" />
  30  <xsl:param name="GlobalFiles" />
  31  <xsl:param name="ParameterDependsType" />
  32  <xsl:param name="ParameterSplitsType" />
  33  <xsl:param name="ParameterProjectSplitsType" />
  34  <xsl:param name="ParameterType" />
  35  <xsl:param name="ParameterMergeType" />
  36  <xsl:param name="ParameterLocaleType" />
  37  <xsl:param name="ParameterUILocaleType" />
  38  <xsl:param name="ParameterTOCSplitFileType" />
  39  <xsl:param name="ParameterIndexSplitFileType" />
  40  <xsl:param name="ParameterCHMSplitFileType" />
  41  <xsl:param name="ParameterPageTemplateURI" />
  42  <xsl:param name="ParameterCategory" />
  43  <xsl:param name="ParameterUse" />
  44  <xsl:param name="ParameterDeploy" />
  45  <xsl:param name="ParameterMergeCategory" />
  46  <xsl:param name="ParameterMergeUse" />
  47  <xsl:param name="ParameterMergeDeploy" />
  48 
  49 
  50  <xsl:output encoding="UTF-8" indent="yes" />
  51  <xsl:namespace-alias stylesheet-prefix="html" result-prefix="#default" />
  52  <xsl:strip-space elements="*" />
  53 
  54 
  55  <xsl:include href="wwtransform:common/pages/pagetemplate.xsl" />
  56 
  57 
  58  <xsl:key name="wwfiles-files-by-type" match="wwfiles:File" use="@type" />
  59  <xsl:key name="wwfiles-files-by-groupid-type" match="wwfiles:File" use="concat(@groupID, ':', @type)" />
  60  <xsl:key name="wwproject-formatconfigurations-by-targetid" match="wwproject:FormatConfiguration" use="@TargetID" />
  61  <xsl:key name="wwsplits-files-by-groupid-type" match="wwsplits:File" use="concat(@groupID, ':', @type)" />
  62 
  63 
  64  <xsl:variable name="GlobalActionChecksum">
  65   <xsl:variable name="VarTransformChecksums">
  66    <xsl:value-of select="concat(wwuri:AsFilePath('wwtransform:self'), ':', wwfilesystem:GetChecksum(wwuri:AsFilePath('wwtransform:self')))" />
  67    <xsl:value-of select="concat(',', wwuri:AsFilePath($ParameterPageTemplateURI), ':', wwfilesystem:GetChecksum(wwuri:AsFilePath($ParameterPageTemplateURI)))" />
  68    <xsl:value-of select="concat(',', wwuri:AsFilePath('wwtransform:common/pages/pagetemplate.xsl'), ':', wwfilesystem:GetChecksum(wwuri:AsFilePath('wwtransform:common/pages/pagetemplate.xsl')))" />
  69   </xsl:variable>
  70   <xsl:value-of select="wwstring:MD5Checksum($VarTransformChecksums)" />
  71  </xsl:variable>
  72 
  73 
  74  <!-- Locale -->
  75  <!--        -->
  76  <xsl:variable name="GlobalLocalePath">
  77   <xsl:for-each select="$GlobalFiles[1]">
  78    <xsl:value-of select="key('wwfiles-files-by-type', $ParameterLocaleType)[1]/@path" />
  79   </xsl:for-each>
  80  </xsl:variable>
  81  <xsl:variable name="GlobalLocale" select="wwexsldoc:LoadXMLWithoutResolver($GlobalLocalePath)" />
  82 
  83 
  84  <!-- UI Locale -->
  85  <!--           -->
  86  <xsl:variable name="GlobalUILocalePath">
  87   <xsl:for-each select="$GlobalFiles[1]">
  88    <xsl:value-of select="key('wwfiles-files-by-type', $ParameterUILocaleType)[1]/@path" />
  89   </xsl:for-each>
  90  </xsl:variable>
  91  <xsl:variable name="GlobalUILocale" select="wwexsldoc:LoadXMLWithoutResolver($GlobalUILocalePath)" />
  92 
  93 
  94  <!-- Page Template -->
  95  <!--               -->
  96  <xsl:variable name="GlobalPageTemplatePath" select="wwuri:AsFilePath($ParameterPageTemplateURI)" />
  97  <xsl:variable name="GlobalPageTemplate" select="wwexsldoc:LoadXMLWithoutResolver($GlobalPageTemplatePath)" />
  98 
  99 
 100  <!-- Project Splits -->
 101  <!--                -->
 102  <xsl:variable name="GlobalProjectSplitsPath">
 103   <xsl:for-each select="$GlobalFiles[1]">
 104    <xsl:value-of select="key('wwfiles-files-by-type', $ParameterProjectSplitsType)[1]/@path" />
 105   </xsl:for-each>
 106  </xsl:variable>
 107  <xsl:variable name="GlobalProjectSplits" select="wwexsldoc:LoadXMLWithoutResolver($GlobalProjectSplitsPath)" />
 108 
 109 
 110  <!-- Single Quote -->
 111  <!--              -->
 112  <xsl:variable name="GlobalSingleQuote">
 113   <xsl:text>&#39;</xsl:text>
 114  </xsl:variable>
 115 
 116  <xsl:template match="/">
 117   <wwfiles:Files version="1.0">
 118 
 119    <!-- Generate TOC? -->
 120    <!--               -->
 121    <xsl:if test="wwprojext:GetFormatSetting('toc-generate', 'true') = 'true'">
 122     <!-- Iterate input documents -->
 123     <!--                         -->
 124     <xsl:for-each select="$GlobalFiles[1]">
 125      <xsl:variable name="VarFilesByType" select="key('wwfiles-files-by-type', $ParameterDependsType)" />
 126 
 127      <xsl:variable name="VarProgressGroupsAndMergeStart" select="wwprogress:Start(count($VarFilesByType) + 1)" />
 128 
 129      <xsl:for-each select="$VarFilesByType">
 130       <xsl:variable name="VarProgressGroupTOCStart" select="wwprogress:Start(1)" />
 131 
 132       <xsl:variable name="VarFilesDocument" select="." />
 133 
 134       <!-- Load splits -->
 135       <!--             -->
 136       <xsl:variable name="VarFilesSplits" select="key('wwfiles-files-by-groupid-type', concat($VarFilesDocument/@groupID, ':', $ParameterSplitsType))[1]" />
 137       <xsl:variable name="VarSplits" select="wwexsldoc:LoadXMLWithoutResolver($VarFilesSplits/@path)" />
 138 
 139       <xsl:for-each select="$VarSplits[1]">
 140        <!-- Split -->
 141        <!--       -->
 142        <xsl:variable name="VarSplit" select="key('wwsplits-files-by-groupid-type', concat($VarFilesDocument/@groupID, ':', $ParameterTOCSplitFileType))[1]" />
 143 
 144        <!-- Transform -->
 145        <!--           -->
 146        <xsl:variable name="VarUpToDate" select="wwfilesext:UpToDate($VarSplit/@path, '', $VarFilesDocument/@groupID, $VarFilesDocument/@documentID, $GlobalActionChecksum)" />
 147        <xsl:if test="not($VarUpToDate)">
 148         <xsl:variable name="VarResultAsXML">
 149          <!-- Conditions -->
 150          <!--            -->
 151          <xsl:variable name="VarConditionsAsXML">
 152           <!-- No conditions defined -->
 153           <!--                       -->
 154          </xsl:variable>
 155          <xsl:variable name="VarConditions" select="msxsl:node-set($VarConditionsAsXML)" />
 156 
 157          <!-- Replacements -->
 158          <!--              -->
 159          <xsl:variable name="VarReplacementsAsXML">
 160           <!-- Content -->
 161           <!--         -->
 162           <wwpage:Replacement name="content">
 163            <!-- Load document -->
 164            <!--               -->
 165            <xsl:variable name="VarTOC" select="wwexsldoc:LoadXMLWithoutResolver($VarFilesDocument/@path)" />
 166 
 167            <xsl:call-template name="TableOfContents">
 168             <xsl:with-param name="ParamSplits" select="$VarSplits" />
 169             <xsl:with-param name="ParamTOC" select="$VarTOC" />
 170             <xsl:with-param name="ParamSplit" select="$VarSplit" />
 171            </xsl:call-template>
 172           </wwpage:Replacement>
 173          </xsl:variable>
 174          <xsl:variable name="VarReplacements" select="msxsl:node-set($VarReplacementsAsXML)" />
 175 
 176          <!-- Output directory path -->
 177          <!--                       -->
 178          <xsl:variable name="VarOutputDirectoryPath" select="wwfilesystem:Combine(wwprojext:GetTargetOutputDirectoryPath(), wwprojext:GetGroupName($VarSplit/@groupID))" />
 179 
 180          <!-- Invoke page template -->
 181          <!--                      -->
 182          <xsl:apply-templates select="$GlobalPageTemplate" mode="wwmode:pagetemplate">
 183           <xsl:with-param name="ParamOutputDirectoryPath" select="$VarOutputDirectoryPath" />
 184           <xsl:with-param name="ParamOutputPath" select="$VarSplit/@path" />
 185           <xsl:with-param name="ParamConditions" select="$VarConditions" />
 186           <xsl:with-param name="ParamReplacements" select="$VarReplacements" />
 187          </xsl:apply-templates>
 188         </xsl:variable>
 189         <xsl:variable name="VarResult" select="msxsl:node-set($VarResultAsXML)" />
 190         <xsl:variable name="VarEncoding" select="wwunits:EncodingFromCodePage($GlobalLocale/wwlocale:Locale/@codepage)" />
 191         <xsl:variable name="VarWriteResult" select="wwexsldoc:Document($VarResult, $VarSplit/@path, $VarEncoding, 'html', '3.2', 'yes', 'yes', '', '-//IETF//DTD HTML//EN', '', '', 'text/html')" />
 192        </xsl:if>
 193 
 194        <!-- Report Files -->
 195        <!--              -->
 196        <wwfiles:File path="{$VarSplit/@path}" type="{$ParameterType}" checksum="{wwfilesystem:GetChecksum($VarSplit/@path)}" projectchecksum="" groupID="{$VarFilesDocument/@groupID}" documentID="{$VarFilesDocument/@documentID}" actionchecksum="{$GlobalActionChecksum}" category="{$ParameterCategory}" use="{$ParameterUse}" deploy="{$ParameterDeploy}">
 197         <wwfiles:Depends path="{$GlobalLocalePath}" checksum="{wwfilesystem:GetChecksum($GlobalLocalePath)}" groupID="" documentID="" />
 198         <wwfiles:Depends path="{$GlobalUILocalePath}" checksum="{wwfilesystem:GetChecksum($GlobalUILocalePath)}" groupID="" documentID="" />
 199         <wwfiles:Depends path="{$GlobalPageTemplatePath}" checksum="{wwfilesystem:GetChecksum($GlobalPageTemplatePath)}" groupID="" documentID="" />
 200         <wwfiles:Depends path="{$VarFilesSplits/@path}" checksum="{$VarFilesSplits/@checksum}" groupID="{$VarFilesSplits/@groupID}" documentID="{$VarFilesSplits/@documentID}" />
 201         <wwfiles:Depends path="{$VarFilesDocument/@path}" checksum="{$VarFilesDocument/@checksum}" groupID="{$VarFilesDocument/@groupID}" documentID="{$VarFilesDocument/@documentID}" />
 202        </wwfiles:File>
 203       </xsl:for-each>
 204 
 205       <xsl:variable name="VarProgressGroupTOCEnd" select="wwprogress:End()" />
 206      </xsl:for-each>
 207 
 208      <!-- Merge -->
 209      <!--       -->
 210      <xsl:variable name="VarProgressMergeStart" select="wwprogress:Start(1)" />
 211      <xsl:if test="count($GlobalProject/wwproject:Project/wwproject:Groups/wwproject:Group) &gt; 1">
 212       <xsl:variable name="VarProjectGroups" select="$GlobalProject/wwproject:Project/wwproject:Groups/wwproject:Group" />
 213 
 214       <xsl:variable name="VarMergePath" select="wwfilesystem:Combine(wwprojext:GetTargetOutputDirectoryPath(), concat(wwprojext:GetFormatName(), '.hhc'))" />
 215 
 216       <xsl:variable name="VarUpToDate" select="wwfilesext:UpToDate($VarMergePath, concat($GlobalProject/wwproject:Project/@ChangeID, ':', count($VarProjectGroups)), '', '', $GlobalActionChecksum)" />
 217       <xsl:if test="not($VarUpToDate)">
 218        <xsl:variable name="VarResultAsXML">
 219         <!-- Conditions -->
 220         <!--            -->
 221         <xsl:variable name="VarConditionsAsXML">
 222          <!-- No conditions defined -->
 223          <!--                       -->
 224         </xsl:variable>
 225         <xsl:variable name="VarConditions" select="msxsl:node-set($VarConditionsAsXML)" />
 226 
 227         <!-- Replacements -->
 228         <!--              -->
 229         <xsl:variable name="VarReplacementsAsXML">
 230          <!-- Content -->
 231          <!--         -->
 232          <wwpage:Replacement name="content">
 233           <xsl:for-each select="$GlobalProject[1]">
 234            <!-- Merge settings -->
 235            <!--                -->
 236            <xsl:variable name="VarFormatConfiguration" select="key('wwproject-formatconfigurations-by-targetid', wwprojext:GetFormatID())[1]" />
 237            <xsl:variable name="VarMergeSettings" select="$VarFormatConfiguration/wwproject:MergeSettings" />
 238 
 239            <xsl:call-template name="MergeTableOfContents">
 240             <xsl:with-param name="ParamMergeSettings" select="$VarMergeSettings" />
 241             <xsl:with-param name="ParamPath" select="$VarMergePath" />
 242            </xsl:call-template>
 243           </xsl:for-each>
 244          </wwpage:Replacement>
 245         </xsl:variable>
 246         <xsl:variable name="VarReplacements" select="msxsl:node-set($VarReplacementsAsXML)" />
 247 
 248         <!-- Invoke page template -->
 249         <!--                      -->
 250         <xsl:apply-templates select="$GlobalPageTemplate" mode="wwmode:pagetemplate">
 251          <xsl:with-param name="ParamOutputDirectoryPath" select="wwprojext:GetTargetOutputDirectoryPath()" />
 252          <xsl:with-param name="ParamOutputPath" select="$VarMergePath" />
 253          <xsl:with-param name="ParamConditions" select="$VarConditions" />
 254          <xsl:with-param name="ParamReplacements" select="$VarReplacements" />
 255         </xsl:apply-templates>
 256        </xsl:variable>
 257        <xsl:variable name="VarResult" select="msxsl:node-set($VarResultAsXML)" />
 258        <xsl:variable name="VarEncoding" select="wwunits:EncodingFromCodePage($GlobalLocale/wwlocale:Locale/@codepage)" />
 259        <xsl:variable name="VarWriteResult" select="wwexsldoc:Document($VarResult, $VarMergePath, $VarEncoding, 'html', '3.2', 'yes', 'yes', '', '-//IETF//DTD HTML//EN', '', '', 'text/html')" />
 260       </xsl:if>
 261 
 262       <wwfiles:File path="{$VarMergePath}" type="{$ParameterMergeType}" checksum="{wwfilesystem:GetChecksum($VarMergePath)}" projectchecksum="{concat($GlobalProject/wwproject:Project/@ChangeID, ':', count($VarProjectGroups))}" groupID="" documentID="" actionchecksum="{$GlobalActionChecksum}" category="{$ParameterMergeCategory}" use="{$ParameterMergeUse}" deploy="{$ParameterMergeDeploy}">
 263        <wwfiles:Depends path="{$GlobalLocalePath}" checksum="{wwfilesystem:GetChecksum($GlobalLocalePath)}" groupID="" documentID="" />
 264        <wwfiles:Depends path="{$GlobalUILocalePath}" checksum="{wwfilesystem:GetChecksum($GlobalUILocalePath)}" groupID="" documentID="" />
 265        <wwfiles:Depends path="{$GlobalPageTemplatePath}" checksum="{wwfilesystem:GetChecksum($GlobalPageTemplatePath)}" groupID="" documentID="" />
 266        <wwfiles:Depends path="{$GlobalProjectSplitsPath}" checksum="{wwfilesystem:GetChecksum($GlobalProjectSplitsPath)}" groupID="" documentID="" />
 267       </wwfiles:File>
 268      </xsl:if>
 269      <xsl:variable name="VarProgressMergeEnd" select="wwprogress:End()" />
 270 
 271      <xsl:variable name="VarProgressGroupsAndMergeEnd" select="wwprogress:End()" />
 272     </xsl:for-each>
 273    </xsl:if>
 274 
 275   </wwfiles:Files>
 276  </xsl:template>
 277 
 278 
 279  <xsl:template name="NewLine">
 280   <xsl:text>
 281 </xsl:text>
 282  </xsl:template>
 283 
 284 
 285  <xsl:template name="TableOfContents">
 286   <xsl:param name="ParamSplits" />
 287   <xsl:param name="ParamTOC" />
 288   <xsl:param name="ParamSplit" />
 289 
 290   <xsl:call-template name="NewLine" />
 291 
 292   <xsl:variable name="VarIndent" select="'    '" />
 293 
 294   <!-- Handle empty TOCs -->
 295   <!--                   -->
 296   <xsl:choose>
 297    <xsl:when test="count($ParamTOC/wwtoc:TableOfContents/wwtoc:Entry[1]) &gt; 0">
 298     <xsl:call-template name="Entries">
 299      <xsl:with-param name="ParamSplits" select="$ParamSplits" />
 300      <xsl:with-param name="ParamParent" select="$ParamTOC/wwtoc:TableOfContents" />
 301      <xsl:with-param name="ParamSplit" select="$ParamSplit" />
 302      <xsl:with-param name="ParamIndent" select="$VarIndent" />
 303     </xsl:call-template>
 304    </xsl:when>
 305 
 306    <xsl:otherwise>
 307     <!-- Without this workaround, the HTML Help compiler reports:                                                                                       -->
 308     <!--                                                                                                                                                -->
 309     <!-- HHC6000: Error: An internal file could not be created. Make certain there is enough disk space on the drive where you are compiling your file. -->
 310     <!-- HHC5007: Error: Fatal navigational compilation error. This is likely the result of an invalid contents .hhc file.                              -->
 311     <!--                                                                                                                                                -->
 312     <xsl:value-of select="$VarIndent" />
 313     <html:ul>
 314     <xsl:call-template name="NewLine" />
 315      <xsl:value-of select="$VarIndent" /><xsl:text>  </xsl:text>
 316      <wwexsldoc:LessThan />li<wwexsldoc:GreaterThan />
 317      <html:object type="text/sitemap">
 318      <xsl:call-template name="NewLine" />
 319 
 320       <xsl:value-of select="$VarIndent" /><xsl:text>        </xsl:text>
 321       <html:param name="Name" value="{$GlobalLocale/wwlocale:Locale/wwlocale:Strings/wwlocale:String[@name = 'MapTOCStyles']/@value}" />
 322       <xsl:call-template name="NewLine" />
 323 
 324       <xsl:variable name="VarPageSplit" select="$ParamSplits/wwsplits:Splits/wwsplits:Split[1]" />
 325       <xsl:variable name="VarGroupOutputDirectoryPath" select="wwfilesystem:Combine(wwprojext:GetTargetOutputDirectoryPath(), wwprojext:GetGroupName($VarPageSplit/@groupID), 'dummy.component')" />
 326       <xsl:variable name="VarPageRelativePath" select="wwfilesystem:GetRelativeTo($VarPageSplit/@path, $VarGroupOutputDirectoryPath)" />
 327 
 328       <xsl:value-of select="$VarIndent" /><xsl:text>        </xsl:text>
 329       <html:param name="Local" value="{$VarPageRelativePath}" />
 330       <xsl:call-template name="NewLine" />
 331 
 332      <xsl:value-of select="$VarIndent" /><xsl:text>      </xsl:text>
 333      </html:object>
 334      <xsl:call-template name="NewLine" />
 335     <xsl:value-of select="$VarIndent" />
 336     </html:ul>
 337     <xsl:call-template name="NewLine" />
 338 
 339     <!-- Emit warning -->
 340     <!--              -->
 341     <xsl:variable name="VarWarningMapTOCStyles" select="wwlog:Warning($GlobalUILocale/wwlocale:Locale/wwlocale:Strings/wwlocale:String[@name = 'MapTOCStyles']/@value)" />
 342    </xsl:otherwise>
 343   </xsl:choose>
 344 
 345   <xsl:text>  </xsl:text>
 346  </xsl:template>
 347 
 348 
 349  <xsl:template name="TOCText">
 350   <xsl:param name="ParamEntry" />
 351 
 352   <xsl:variable name="VarText">
 353    <xsl:call-template name="Paragraph">
 354     <xsl:with-param name="ParamParagraph" select="$ParamEntry/wwdoc:Paragraph" />
 355    </xsl:call-template>
 356   </xsl:variable>
 357 
 358   <xsl:variable name="VarFixSingleQuotes" select="wwstring:ReplaceWithExpression($VarText, '[&#8216;&#8217;]', $GlobalSingleQuote)" />
 359   <xsl:variable name="VarFixDoubleQuotes" select="wwstring:ReplaceWithExpression($VarFixSingleQuotes, '[&#8220;&#8221;]', '&amp;quot;')" />
 360 
 361   <xsl:value-of select="$VarFixDoubleQuotes" />
 362  </xsl:template>
 363 
 364 
 365  <xsl:template name="Entries">
 366   <xsl:param name="ParamSplits" />
 367   <xsl:param name="ParamParent" />
 368   <xsl:param name="ParamSplit" />
 369   <xsl:param name="ParamIndent" />
 370 
 371   <xsl:variable name="VarSubEntries" select="$ParamParent/wwtoc:Entry" />
 372 
 373   <xsl:for-each select="$VarSubEntries[1]">
 374    <xsl:value-of select="$ParamIndent" />
 375    <html:ul>
 376    <xsl:call-template name="NewLine" />
 377     <xsl:for-each select="$VarSubEntries">
 378      <xsl:variable name="VarEntry" select="." />
 379 
 380      <xsl:value-of select="$ParamIndent" /><xsl:text>  </xsl:text>
 381      <wwexsldoc:LessThan />li<wwexsldoc:GreaterThan />
 382      <html:object type="text/sitemap">
 383      <xsl:call-template name="NewLine" />
 384       <xsl:choose>
 385        <xsl:when test="string-length($VarEntry/@path) &gt; 0">
 386         <!-- Get link -->
 387         <!--          -->
 388         <xsl:variable name="VarRelativeLinkPath" select="wwfilesystem:GetRelativeTo($VarEntry/@path, $ParamSplit/@path)" />
 389 
 390         <xsl:variable name="VarLink">
 391          <xsl:value-of select="$VarRelativeLinkPath" />
 392          <!-- HACK JESSE: Implement smart anchor -->
 393          <!--                                    -->
 394          <xsl:if test="$VarEntry/@first = 'false'">
 395           <xsl:text>#</xsl:text>
 396           <xsl:value-of select="$VarEntry/@linkid" />
 397          </xsl:if>
 398         </xsl:variable>
 399         <xsl:variable name="VarTOCText">
 400          <xsl:call-template name="TOCText">
 401           <xsl:with-param name="ParamEntry" select="$VarEntry" />
 402          </xsl:call-template>
 403         </xsl:variable>
 404 
 405         <xsl:value-of select="$ParamIndent" /><xsl:text>        </xsl:text>
 406         <html:param name="Name" value="{wwstring:ReplaceWithExpression($VarTOCText, '[&#8216;&#8217;&#8220;&#8221;]', '&quot;')}" />
 407         <xsl:call-template name="NewLine" />
 408 
 409         <xsl:value-of select="$ParamIndent" /><xsl:text>        </xsl:text>
 410         <html:param name="Local" value="{$VarLink}" />
 411         <xsl:call-template name="NewLine" />
 412 
 413         <!-- Window type -->
 414         <!--             -->
 415         <xsl:variable name="VarLinkSplit" select="$ParamSplits/wwsplits:Splits/wwsplits:Split[@path = $VarEntry/@path]" />
 416         <xsl:if test="string-length($VarLinkSplit/@window-type) &gt; 0">
 417          <xsl:value-of select="$ParamIndent" /><xsl:text>        </xsl:text>
 418          <html:param name="WindowName" value="{$VarLinkSplit/@window-type}" />
 419          <xsl:call-template name="NewLine" />
 420         </xsl:if>
 421        </xsl:when>
 422 
 423        <xsl:otherwise>
 424         <xsl:variable name="VarTOCTextNoLink">
 425          <xsl:call-template name="TOCText">
 426           <xsl:with-param name="ParamEntry" select="$VarEntry" />
 427          </xsl:call-template>
 428         </xsl:variable>
 429 
 430         <xsl:value-of select="$ParamIndent" /><xsl:text>        </xsl:text>
 431         <html:param name="Name" value="{wwstring:ReplaceWithExpression($VarTOCTextNoLink, '[&#8216;&#8217;&#8220;&#8221;]', '&quot;')}" />
 432         <xsl:call-template name="NewLine" />
 433        </xsl:otherwise>
 434       </xsl:choose>
 435 
 436       <!-- TOC Icon -->
 437       <!--          -->
 438       <xsl:variable name="VarTOCIconMarkers" select="$VarEntry/wwbehaviors:Paragraph/wwbehaviors:Marker[@behavior = 'toc-icon-html-help']" />
 439 
 440       <xsl:if test="count($VarTOCIconMarkers) &gt; 0">
 441        <xsl:variable name="VarTOCIconMarker" select="$VarTOCIconMarkers[count($VarTOCIconMarkers)]" />
 442        <xsl:variable name="VarTOCIconText">
 443         <xsl:for-each select="$VarTOCIconMarker//wwdoc:TextRun/wwdoc:Text">
 444          <xsl:value-of select="@value" />
 445         </xsl:for-each>
 446        </xsl:variable>
 447 
 448        <!-- Validate value -->
 449        <!--                -->
 450        <xsl:variable name="VarTOCIconAsNumber" select="number($VarTOCIconText)" />
 451        <xsl:choose>
 452         <xsl:when test="($VarTOCIconAsNumber &gt; 0) and ($VarTOCIconAsNumber &lt; 43)">
 453          <xsl:value-of select="$ParamIndent" /><xsl:text>        </xsl:text>
 454          <html:param name="ImageNumber" value="{$VarTOCIconText}" />
 455          <xsl:call-template name="NewLine" />
 456         </xsl:when>
 457 
 458         <xsl:otherwise>
 459          <xsl:variable name="VarWarningInvalidTOCIcon" select="wwlog:Warning(concat('Invalid TOCIcon value: ', $VarTOCIconText, ': Ignoring marker.'))" />
 460         </xsl:otherwise>
 461        </xsl:choose>
 462       </xsl:if>
 463      <xsl:value-of select="$ParamIndent" /><xsl:text>      </xsl:text>
 464      </html:object>
 465      <xsl:call-template name="NewLine" />
 466 
 467      <xsl:variable name="VarIndent">
 468       <xsl:value-of select="$ParamIndent" />
 469       <xsl:text>  </xsl:text>
 470      </xsl:variable>
 471 
 472      <xsl:call-template name="Entries">
 473       <xsl:with-param name="ParamSplits" select="$ParamSplits" />
 474       <xsl:with-param name="ParamParent" select="$VarEntry" />
 475       <xsl:with-param name="ParamSplit" select="$ParamSplit" />
 476       <xsl:with-param name="ParamIndent" select="$VarIndent" />
 477      </xsl:call-template>
 478     </xsl:for-each>
 479    <xsl:value-of select="$ParamIndent" />
 480    </html:ul>
 481    <xsl:call-template name="NewLine" />
 482   </xsl:for-each>
 483  </xsl:template>
 484 
 485 
 486  <xsl:template name="Paragraph">
 487   <xsl:param name="ParamParagraph" />
 488 
 489   <xsl:variable name="VarText">
 490    <xsl:for-each select="$ParamParagraph/wwdoc:Number/wwdoc:Text | $ParamParagraph/wwdoc:TextRun/wwdoc:Text">
 491     <xsl:value-of select="@value" />
 492    </xsl:for-each>
 493   </xsl:variable>
 494   <xsl:value-of select="normalize-space($VarText)" />
 495  </xsl:template>
 496 
 497 
 498  <xsl:template name="MergeTableOfContents">
 499   <xsl:param name="ParamMergeSettings" />
 500   <xsl:param name="ParamPath" />
 501 
 502   <xsl:call-template name="NewLine" />
 503 
 504   <xsl:value-of select="'    '" />
 505   <html:ul>
 506   <xsl:call-template name="NewLine" />
 507 
 508    <xsl:apply-templates select="$ParamMergeSettings/wwproject:*" mode="wwmode:merge">
 509     <xsl:with-param name="ParamPath" select="$ParamPath" />
 510     <xsl:with-param name="ParamIndent" select="'      '" />
 511    </xsl:apply-templates>
 512 
 513   <xsl:value-of select="'    '" />
 514   </html:ul>
 515   <xsl:call-template name="NewLine" />
 516 
 517   <xsl:text>  </xsl:text>
 518  </xsl:template>
 519 
 520 
 521  <xsl:template match="wwproject:TOC" mode="wwmode:merge">
 522   <xsl:param name="ParamPath" />
 523   <xsl:param name="ParamIndent" />
 524   <xsl:param name="ParamTOC" select="." />
 525 
 526   <xsl:value-of select="$ParamIndent" />
 527   <wwexsldoc:LessThan />li<wwexsldoc:GreaterThan />
 528   <html:object type="text/sitemap">
 529   <xsl:call-template name="NewLine" />
 530 
 531    <xsl:value-of select="$ParamIndent" /><xsl:text>      </xsl:text>
 532    <html:param name="Name" value="{$ParamTOC/@Name}" />
 533    <xsl:call-template name="NewLine" />
 534 
 535   <xsl:value-of select="$ParamIndent" /><xsl:text>    </xsl:text>
 536   </html:object>
 537   <xsl:call-template name="NewLine" />
 538 
 539   <xsl:value-of select="$ParamIndent" />
 540   <html:ul>
 541    <xsl:variable name="VarIndent">
 542     <xsl:value-of select="$ParamIndent" />
 543     <xsl:text>  </xsl:text>
 544    </xsl:variable>
 545 
 546    <xsl:call-template name="NewLine" />
 547     <xsl:apply-templates mode="wwmode:merge">
 548      <xsl:with-param name="ParamPath" select="$ParamPath" />
 549      <xsl:with-param name="ParamIndent" select="$VarIndent" />
 550     </xsl:apply-templates>
 551 
 552   <xsl:value-of select="$ParamIndent" />
 553   </html:ul>
 554   <xsl:call-template name="NewLine" />
 555  </xsl:template>
 556 
 557 
 558  <xsl:template match="wwproject:MergeGroup" mode="wwmode:merge">
 559   <xsl:param name="ParamPath" />
 560   <xsl:param name="ParamIndent" />
 561   <xsl:param name="ParamMergeGroup" select="." />
 562 
 563   <xsl:for-each select="$GlobalProject[1]">
 564    <xsl:variable name="VarGroupName" select="wwprojext:GetGroupName($ParamMergeGroup/@GroupID)" />
 565 
 566    <xsl:variable name="VarTitle">
 567     <xsl:choose>
 568      <xsl:when test="string-length($ParamMergeGroup/@Title) &gt; 0">
 569       <xsl:value-of select="$ParamMergeGroup/@Title" />
 570      </xsl:when>
 571 
 572      <xsl:otherwise>
 573       <xsl:value-of select="$VarGroupName" />
 574      </xsl:otherwise>
 575     </xsl:choose>
 576    </xsl:variable>
 577 
 578    <xsl:for-each select="$GlobalProjectSplits[1]">
 579     <xsl:variable name="VarCHMSplit" select="key('wwsplits-files-by-groupid-type', concat($ParamMergeGroup/@GroupID, ':', $ParameterCHMSplitFileType))[1]" />
 580     <xsl:variable name="VarTOCSplit" select="key('wwsplits-files-by-groupid-type', concat($ParamMergeGroup/@GroupID, ':', $ParameterTOCSplitFileType))[1]" />
 581     <xsl:variable name="VarCHMRelativePath" select="wwfilesystem:GetFileName($VarCHMSplit/@path)" />
 582     <xsl:variable name="VarGroupOutputDirectoryPath" select="wwfilesystem:Combine(wwprojext:GetTargetOutputDirectoryPath(), $VarGroupName, 'dummy.component')" />
 583     <xsl:variable name="VarTOCRelativePath" select="wwfilesystem:GetRelativeTo($VarTOCSplit/@path, $VarGroupOutputDirectoryPath)" />
 584 
 585     <xsl:variable name="VarTOCReference" select="concat($VarCHMRelativePath, '::/', $VarTOCRelativePath)" />
 586 
 587     <xsl:value-of select="$ParamIndent" />
 588     <wwexsldoc:LessThan />li<wwexsldoc:GreaterThan />
 589     <html:object type="text/sitemap">
 590     <xsl:call-template name="NewLine" />
 591 
 592      <xsl:value-of select="$ParamIndent" /><xsl:text>      </xsl:text>
 593      <html:param name="Name" value="{$VarTitle}" />
 594      <xsl:call-template name="NewLine" />
 595 
 596     <xsl:value-of select="$ParamIndent" /><xsl:text>    </xsl:text>
 597     </html:object>
 598     <xsl:call-template name="NewLine" />
 599 
 600     <xsl:value-of select="$ParamIndent" /><xsl:text>    </xsl:text>
 601     <html:object type="text/sitemap">
 602     <xsl:call-template name="NewLine" />
 603 
 604      <xsl:value-of select="$ParamIndent" /><xsl:text>      </xsl:text>
 605      <html:param name="Merge" value="{$VarTOCReference}" />
 606      <xsl:call-template name="NewLine" />
 607 
 608     <xsl:value-of select="$ParamIndent" /><xsl:text>    </xsl:text>
 609     </html:object>
 610     <xsl:call-template name="NewLine" />
 611    </xsl:for-each>
 612   </xsl:for-each>
 613  </xsl:template>
 614 </xsl:stylesheet>

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2008-02-13 06:16:07, 28.9 KB) [[attachment:toc.xsl]]
 All files | Selected Files: delete move to page

You are not allowed to attach a file to this page.