May 11, 2011

XSL XSLT file for Visual Studio HelpViewer 1.0

This XSL/XSLT file is based on a Visual Studio Help file found in "C:\ProgramData\Microsoft\HelpLibrary\content\Microsoft\store\Development_Frameworks_21823146_VS_100_en-us_9.msha"
I've stripped out the content and replaced with <xsl:if gt;
etc.
The values for this content are taken from XML files which have the corresponding XML element hierachy, e.g



 




<xsl:value-of select="HelpDocument/Meta/title"/>
<xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">
    <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
        
        <meta name="Microsoft.Help.ContentType" content="Reference" >meta>
        <meta name="Microsoft.Help.Locale" content="en-us" >meta>
        <meta name="Microsoft.Help.TopicLocale" content="en-us" >meta>
        <meta name="Microsoft.Help.Category" content="ApiHelp3" >meta>
        <meta name="SelfBranded" content="false" >meta>
        <link href="stylesheets/CSharp.css" type="text/css" rel="Stylesheet" />
 
        
        <title>
          <xsl:value-of select="HelpDocument/Meta/title"/>
        title>
        <xsl:variable name="metaTitleVar">
          <xsl:value-of select="HelpDocument/Meta/metaTitle"/>
        xsl:variable>
        <meta name="Title" content="{$metaTitleVar}" >meta>
 
        <xsl:variable name="metaIDVar">
          <xsl:value-of select="HelpDocument/Meta/metaID"/>
        xsl:variable>
        <meta name="Microsoft.Help.Id" content="{$metaIDVar}">meta>
 
        <xsl:variable name="metaParentVar">
          <xsl:value-of select="HelpDocument/Meta/metaParent"/>
        xsl:variable>
        <meta name="Microsoft.Help.TocParent" content="{$metaParentVar}">meta>
 
        <xsl:variable name="metaKeyword1Var">
          <xsl:value-of select="HelpDocument/Meta/metaKeyword1"/>
        xsl:variable>
        <meta name="Microsoft.Help.Keywords" content="{$metaKeyword1Var}" >meta>
 
        <xsl:variable name="metaKeyword2Var">
          <xsl:value-of select="HelpDocument/Meta/metaKeyword2"/>
        xsl:variable>
        <meta name="Microsoft.Help.Keywords" content="{$metaKeyword1Var}" >meta>
 
        <xsl:variable name="metaF1Var">
          <xsl:value-of select="HelpDocument/Meta/metaF1"/>
        xsl:variable>
        <meta name="Microsoft.Help.F1" content="{$metaF1Var}" >meta>
 
        <xsl:variable name="metaTocOrderVar">
          <xsl:value-of select="HelpDocument/Meta/metaTocOrder"/>
        xsl:variable>
        <meta name="Microsoft.Help.TocOrder" content="{$metaTocOrderVar}" >meta>
        
      head>
      <body class="primary-mtps-offline-document">
        <div class="topic">
          <div class="majorTitle">
            <xsl:value-of selectHelpDocument/HelpBody/majorTitle"/>
          div>
          <div class="title">
            <xsl:value-of select="HelpDocument/HelpBody/title"/>
          div>
 
          <xsl:variable name="feedbackLinkVar">
            <xsl:value-of select="HelpDocument/HelpBody/feedbackLink"/>
          xsl:variable>
          <div class="OH_feedbacklink">
            <a href="mailto:support@avaeon.com?subject=Documentation Feedback:{$feedbackLinkVar}">Send commentsa>
          div>
 
          <div id="mainSection">
            <div id="mainBody">
              <p>
                
              p>
              
               <div>
                <div class="summary">
                  <p>
                    <xsl:copy-of select="HelpDocument/HelpBody/summary/summaryText"/>
                  p>
 
 
                div>
              div>
              <p>
                
              p>
              
              
              
              <xsl:if test="HelpDocument/HelpBody/syntax">
                <CollapsibleArea runat="server" Expanded="1" Title="Syntax" xmlns="http://msdn2.microsoft.com/mtps">
 
                  <xsl:if test="HelpDocument/HelpBody/syntax/codeSnippet">
                    <a id="syntaxToggle" xmlns="http://www.w3.org/1999/xhtml">
                      
                    a>
                    <CodeSnippet runat="server" Language="Gravity" DisplayLanguage="Gravity" ContainsMarkup="false" EnableCopyCode="false">
                      <xsl:copy-of select="HelpDocument/HelpBody/syntax/codeSnippet"/>
                    CodeSnippet>
                  xsl:if>
 
                  
                  <xsl:if test="HelpDocument/HelpBody/syntax/properties">
                    <CollapsibleArea runat="server" Expanded="1" Title="Properties" xmlns="http://msdn2.microsoft.com/mtps">
                      <a id="propertyTableToggle" xmlns="http://www.w3.org/1999/xhtml">
                        
                      a>
                      <table id="memberList1" class="members" xmlns="http://www.w3.org/1999/xhtml">
                        <tr>
                          <th class="iconColumn">
                             
                          th>
                          <th class="nameColumn">Nameth>
                          <th class="descriptionColumn">Descriptionth>
                        tr>
                        <xsl:for-each select="HelpDocument/HelpBody/syntax/properties/property">
                          <xsl:variable name="hierachyVar">
                            <xsl:value-of select="hierachy"/>
                          xsl:variable>
                          
                          
                          <xsl:variable name="hierachyImageVar">
                            <xsl:if test="$hierachyVar='public;declared;'">
                              <xsl:value-of select="'images/IC74937'"/>
                            xsl:if>
                            <xsl:if test="$hierachyVar='public;inherited;'">
                              <xsl:value-of select="'images/IC100399'"/>
                            xsl:if>
                          xsl:variable>
                          <xsl:variable name="hierachyImageAltVar">
                            <xsl:if test="$hierachyVar='public;declared;'">
                              <xsl:value-of select="'Public Property'"/>
                            xsl:if>
                            <xsl:if test="$hierachyVar='public;inherited;'">
                              <xsl:value-of select="'Public Inherited Property'"/>
                            xsl:if>
                          xsl:variable>
                          
                          <tr data="{$hierachyVar}">
                            <td>
                                   <img class="mtps-img-src" alt="{$hierachyImageAltVar}" src="{$hierachyImageVar}" />
                            td>
                            <td>
                              <xsl:variable name="linkUrlVar">
                                <xsl:value-of select="linkUrl"/>
                              xsl:variable>
                              <a class="mtps-internal-link" href="{$linkUrlVar}">
                                <xsl:value-of select="linkUrlName"/>
                              a>
                            td>
                            <td>
                              <span>
                                <xsl:copy-of select="linkUrlDescription"/>
                              span>
                            td>
                          tr>
                           xsl:for-each>
                        
                      table>
                      <a href="#mainBody" xmlns="http://www.w3.org/1999/xhtml">Topa>
                    CollapsibleArea>
                    
                  xsl:if>
 
                  
                  <xsl:if test="HelpDocument/HelpBody/syntax/settings">
                    <CollapsibleArea runat="server" Expanded="1" Title="Settings" xmlns="http://msdn2.microsoft.com/mtps">
                      <a id="propertyTableToggle" xmlns="http://www.w3.org/1999/xhtml">
                        
                      a>
                      <table id="memberList1" class="members" xmlns="http://www.w3.org/1999/xhtml">
                        <tr>
                          <th class="iconColumn">
                             
                          th>
                          <th class="nameColumn">Nameth>
                          <th class="descriptionColumn">Descriptionth>
                        tr>
                        <xsl:for-each select="HelpDocument/HelpBody/syntax/settings/setting">
                          <xsl:variable name="hierachyVar">
                            <xsl:value-of select="hierachy"/>
                          xsl:variable>
 
 
                          <xsl:variable name="hierachyImageVar">
                            <xsl:if test="$hierachyVar='public;declared;'">
                              <xsl:value-of select="'images/IC74937'"/>
                            xsl:if>
                            <xsl:if test="$hierachyVar='public;inherited;'">
                              <xsl:value-of select="'images/IC100399'"/>
                            xsl:if>
                          xsl:variable>
                          <xsl:variable name="hierachyImageAltVar">
                            <xsl:if test="$hierachyVar='public;declared;'">
                              <xsl:value-of select="'Public Setting'"/>
                            xsl:if>
                            <xsl:if test="$hierachyVar='public;inherited;'">
                              <xsl:value-of select="'Public Inherited Setting'"/>
                            xsl:if>
                          xsl:variable>
 
                          <tr data="{$hierachyVar}">
                            <td>
                              <img class="mtps-img-src" alt="{$hierachyImageAltVar}" src="{$hierachyImageVar}" />
                            td>
                            <td>
                              <xsl:variable name="linkUrlVar">
                                <xsl:value-of select="linkUrl"/>
                              xsl:variable>
                              <a class="mtps-internal-link" href="{$linkUrlVar}">
                                <xsl:value-of select="linkUrlName"/>
                              a>
                            td>
                            <td>
                              <span>
                                <xsl:copy-of select="linkUrlDescription"/>
                              span>
                            td>
                          tr>
                        xsl:for-each>
                        
 
                      table>
                      <a href="#mainBody" xmlns="http://www.w3.org/1999/xhtml">Topa>
                    CollapsibleArea>
                    
                  xsl:if>
                  
                  
                  <xsl:if test="HelpDocument/HelpBody/syntax/events">
                    <CollapsibleArea runat="server" Expanded="1" Title="Events" xmlns="http://msdn2.microsoft.com/mtps">
                      <a id="eventTableToggle" xmlns="http://www.w3.org/1999/xhtml">
                        
                      a>
                      <table id="memberList3" class="members" xmlns="http://www.w3.org/1999/xhtml">
                        <tr>
                          <th class="iconColumn">
                             
                          th>
                          <th class="nameColumn">Nameth>
                          <th class="descriptionColumn">Descriptionth>
                        tr>
                        
                        
                        <xsl:for-each select="HelpDocument/HelpBody/syntax/events/event">
                          <xsl:variable name="hierachyVar">
                            <xsl:value-of select="hierachy"/>
                          xsl:variable>
 
                          <tr data="{$hierachyVar}">
                            <td>
                              
                              <img class="mtps-img-src" alt="Public event" src="images/IC90369" />
                            td>
                            <td>
                              <xsl:variable name="linkUrlVar">
                                <xsl:value-of select="linkUrl"/>
                              xsl:variable>
                              <a class="mtps-internal-link" href="{$linkUrlVar}">
                                <xsl:value-of select="linkUrlName"/>
                              a>
                            td>
                            <td>
                              <span>
                                <xsl:copy-of select="linkUrlDescription"/>
                              span>
                            td>
                          tr>
                          
                        xsl:for-each>
                      table>
                      <a href="#mainBody" xmlns="http://www.w3.org/1999/xhtml">Topa>
                    CollapsibleArea>
                    
                  xsl:if>
 
                  
                  <xsl:if test="HelpDocument/HelpBody/syntax/parameters">
                    <div id="parameters" xmlns="http://www.w3.org/1999/xhtml">
                      <h4 class="subHeading">Parametersh4>
                      <xsl:for-each select="HelpDocument/HelpBody/syntax/parameters/parameter">
                        <dl>
                          <dt>
                            <span class="parameter">
                              <xsl:value-of select="name"/>
                            span>
                          dt>
                          <dd>
                            Type:
                            <xsl:variable name="typeLinkVar">
                              <xsl:value-of select="typeLink"/>
                            xsl:variable>
                            <a class="mtps-internal-link" href="{$typeLinkVar}" >
                              <xsl:value-of select="typeLinkNameSpace"/>
                              <LanguageSpecificText runat="server" devLangcs="." devLangvb="." devLangcpp="::" devLangnu="." xmlns="http://msdn2.microsoft.com/mtps">.LanguageSpecificText>
                              <xsl:value-of select="typeName"/>
                            a>
                            <br/>
                            <span>
                              <xsl:value-of select="typeText"/>
                              <br />
                            span>
                          dd>
                        dl>
                      xsl:for-each>
                      
                    div>
                  xsl:if>
 
                  
                  <xsl:if test="HelpDocument/HelpBody/syntax/return">
                    <div id="returns" xmlns="http://www.w3.org/1999/xhtml">
                      <h4 class="subHeading">Return Valueh4>Type:
                      <xsl:variable name="returnTypeLinkVar">
                        <xsl:value-of select="HelpDocument/HelpBody/syntax/return/typeLink"/>
                      xsl:variable>
                      <a class="mtps-internal-link" href="{$returnTypeLinkVar}" >
                        <xsl:value-of select="HelpDocument/HelpBody/syntax/return/typeNameSpace"/>
                        <LanguageSpecificText runat="server" devLangcs="." devLangvb="." devLangcpp="::" devLangnu="." xmlns="http://msdn2.microsoft.com/mtps">.LanguageSpecificText>
                        <xsl:value-of select="HelpDocument/HelpBody/syntax/return/typeName"/>
                      a>
                      <br/>
                      <span>
                        <span>
                          <xsl:value-of select="HelpDocument/HelpBody/syntax/return/typeDescription"/>
                          <span class="parameter">
                            <xsl:value-of select="HelpDocument/HelpBody/syntax/return/typeVar"/>
                          span>.
                        span>
                        <br/>
                        <div class="caption">
                          
                        div>
                        <div class="tableSection">
                          <table>
                            <tr>
                              <th>
                                <p>Return Value p>
                              th>
                              <th>
                                <p>Description p>
                              th>
                            tr>
                            <tr>
                              <td>
                                <p>
                                  <xsl:value-of select="HelpDocument/HelpBody/syntax/return/value"/>
                                p>
                              td>
                              <td>
                                <p>
                                  <xsl:value-of select="HelpDocument/HelpBody/syntax/return/description"/>
                                  <span class="parameter">
                                    <xsl:value-of select="HelpDocument/HelpBody/syntax/return/name"/>
                                  span>.
                                p>
                              td>
                            tr>
                          table>
                        div>
                      span>
                    div>
                  xsl:if>
 
                  <br xmlns="http://www.w3.org/1999/xhtml"/>
                CollapsibleArea>
 
 
 
 
                <xsl:if test="HelpDocument/HelpBody/syntax/exceptions">
                  <CollapsibleArea runat="server" Expanded="1" Title="Exceptions" xmlns="http://msdn2.microsoft.com/mtps">
                    <a id="ddueExceptionsToggle" xmlns="http://www.w3.org/1999/xhtml">
                      
                    a>
                    <div class="tableSection" xmlns="http://www.w3.org/1999/xhtml">
                      <table>
                        <tr>
                          <th class="exceptionNameColumn">Exceptionth>
                          <th class="exceptionConditionColumn">Conditionth>
                          <th class="exceptionConditionColumn">Descriptionth>
                        tr>
                        <xsl:for-each select="HelpDocument/HelpBody/syntax/exceptions/exception">
                          <tr>
                            <td>
                              <span>
                                <xsl:variable name="typeLinkVar">
                                  <xsl:value-of select="typeLink"/>
                                xsl:variable>
                                <a class="mtps-internal-link" href="{$typeLinkVar}" >
                                  <xsl:value-of select="name"/>
                                a>
 
                              span>
                            td>
                            <td>
                              <p>
                                <span class="parameter">
                                  <xsl:value-of select="parameter/value"/>
                                span> <xsl:value-of select="parameter/text"/>
                                <span>
                                  <xsl:variable name="typeLinkVar">
                                    <xsl:value-of select="parameter/typeLink"/>
                                  xsl:variable>
                                  <a class="mtps-internal-link" href="{$typeLinkVar}" >
                                    
                                    <xsl:value-of select="parameter/typeName"/>
                                  a>
                                span>
                              p>
                            td>
                            <td>
                              <p>
                                <xsl:value-of select="description"/>
                              p>
                            td>
                          tr>
                        xsl:for-each>
                      table>
                    div>
                  CollapsibleArea>
                xsl:if>
 
                
                <xsl:if test="HelpDocument/HelpBody/syntax/remarks">
                  <CollapsibleArea runat="server" Expanded="1" Title="Remarks" xmlns="http://msdn2.microsoft.com/mtps">
                    <a id="remarksToggle" xmlns="http://www.w3.org/1999/xhtml">
                      
                    a>
                    <p xmlns="http://www.w3.org/1999/xhtml">
 
                      <xsl:copy-of select="HelpDocument/HelpBody/syntax/remarks/text"/>
                    p>
                  CollapsibleArea>
                xsl:if>
 
                
                <xsl:if test="HelpDocument/HelpBody/syntax/example">
                  <CollapsibleArea runat="server" Expanded="1" Title="Examples" xmlns="http://msdn2.microsoft.com/mtps">
                    <a id="exampleToggle" xmlns="http://www.w3.org/1999/xhtml">
                      
                    a>
                    <p xmlns="http://www.w3.org/1999/xhtml">
                      The following code example demonstrates the
                      <span>
                        <xsl:variable name="exampleLinkVar">
                          <xsl:value-of select="HelpDocument/HelpBody/syntax/example/link"/>
                        xsl:variable>
                        <a class="mtps-internal-link" href="{$exampleLinkVar}" >
                          <xsl:value-of select="HelpDocument/HelpBody/syntax/example/linkText"/>
                        a>
                      span> method.
                    p>
                    <div id="snippetGroup" xmlns="http://www.w3.org/1999/xhtml">
                      <CodeSnippet EnableCopyCode="true" runat="server" Language="Gravity" ContainsMarkup="false" DisplayLanguage="Gravity" xmlns="http://msdn2.microsoft.com/mtps">
                        <xsl:copy-of select="HelpDocument/HelpBody/syntax/example/codeSnippetFull"/>
                      CodeSnippet>
                    div>
                  CollapsibleArea>
                xsl:if>
              
              xsl:if>
                
 
              <xsl:if test="HelpDocument/HelpBody/seeAlsos">
                <CollapsibleArea runat="server" Expanded="1" Title="See Also" xmlns="http://msdn2.microsoft.com/mtps">
                  <a id="seeAlsoToggle" xmlns="http://www.w3.org/1999/xhtml">
                    
                  a>
                  <h4 class="subHeading" xmlns="http://www.w3.org/1999/xhtml">Referenceh4>
 
                  <xsl:for-each select="HelpDocument/HelpBody/seeAlsos/seeAlso">
                    <div class="seeAlsoStyle" xmlns="http://www.w3.org/1999/xhtml">
                      <span>
                        <xsl:variable name="seeAlsoLinkVar">
                          <xsl:value-of select="link"/>
                        xsl:variable>
                        <a class="mtps-internal-link" href="{$seeAlsoLinkVar}" >
                          <xsl:value-of select="text"/>
                        a>
                      span>
                    div>
                  xsl:for-each>
                CollapsibleArea>
              xsl:if>
 
            div>
          div>
        div>
      body>
    html>
 
 
 
 
  xsl:template>
xsl:stylesheet>
 

No comments: