summaryrefslogtreecommitdiffstats
path: root/tools/Sandcastle/ProductionTransforms/TocToHxsContents.xsl
blob: 5fa6ce15fe840ee34539fb6c5dcca1e93d5bb599 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1">

	<xsl:output indent="yes" encoding="UTF-8" doctype-system="MS-Help://Hx/Resources/HelpTOC.dtd" />

  <xsl:param name="segregated" />
  <xsl:param name="includeIds" />

  <xsl:template match="/">
		<HelpTOC DTDVersion="1.0">
			<xsl:apply-templates select="/topics" />
		</HelpTOC>
	</xsl:template>

	<xsl:template match="topic">
		<HelpTOCNode>
      <xsl:if test="boolean($includeIds)">
        <xsl:attribute name="Id">
          <xsl:value-of select="@id"/>
        </xsl:attribute>
      </xsl:if>
      <xsl:choose>
        <xsl:when test="@file">
          <xsl:attribute name="Url">
            <xsl:choose>
              <xsl:when test="boolean($segregated)">
                <xsl:value-of select="concat('ms-help:/../',@project,'/html/',@file,'.htm')" />
              </xsl:when>
              <xsl:otherwise>
                <xsl:value-of select="concat('html\',@file,'.htm')" />
              </xsl:otherwise>
            </xsl:choose>
          </xsl:attribute>
        </xsl:when>
        <xsl:otherwise>
          <xsl:attribute name="Title">
            <xsl:value-of select="@id" />
          </xsl:attribute>
        </xsl:otherwise>
      </xsl:choose>
			<xsl:apply-templates />
		</HelpTOCNode>
	</xsl:template>

  <xsl:template match="stoc">
    <HelpTOCNode NodeType="TOC" Url="{@project}" />
  </xsl:template>

  <xsl:template match="stopic">
    <HelpTOCNode Url="ms-help:/../{@project}/html/{@file}.htm" Id="{@id}">
      <xsl:apply-templates />
    </HelpTOCNode>
  </xsl:template>
</xsl:stylesheet>