Skip to main content Design options ...

Design Options

Changes effect all users.

Developer:
Theme:
Components:

XslWebMaker Advanced Instructions - Subdirectories

In your source directory you may want to organise your website by including subdirectories. Pages within your subdirectories well need special handling. For example, when these pages reference a common navigation menu system, the links within that menu will be slightly different.

  1. In your source .html files that are within source subdirectories add <xwm:subDirectoryFlag />
      ...
      <xwm:commonHead />
      <xwm:subDirectoryFlag />
      <xwm:directoryDependantHead />        
    </head>
    <body>
      <xwm:navigation />
      ...
     
  2. In your xwmToXhtml.xslt define a variable, here directoryLevel, that returns a string "../" if the <xwm:subDirectoryFlag /> element is in your source .html files.

    Wherever you need to have different urls depending on whether the page is in a subdirectroy or not, reference the directoryLevel variable.

    
    <xsl:variable name="directoryLevel" xml:space="no">
      <xsl:choose>
        <xsl:when test="//*[local-name()='subDirectoryFlag']">../</xsl:when>
        <xsl:otherwise></xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
      
    <!-- Needed to allow the subDirectoryFlag in the source doc -->
    <xsl:template match="*[local-name()='subDirectoryFlag']" xml:space="preserve">
    </xsl:template>
    ...
    <xsl:template match="*[local-name()='directoryDependantHead']" xml:space="preserve">
      <xsl:comment> directoryDependantHead start </xsl:comment>
      <link type="text/css" rel="stylesheet" href="{concat($directoryLevel, 'minimalist.css')}" />
      <script type="text/javascript" src="{concat($directoryLevel, 'webDateTime.js')}"></script>  
      <xsl:comment> directoryDependantHead Finish </xsl:comment>
    </xsl:template>  
    ...
    <xsl:template match="*[local-name()='navigation']" xml:space="preserve">
      <div id="navigation">
        <ul>
          <li><a href="{concat($directoryLevel, 'index.html')}">Home</a></li> 
          <li>Calendar
            <ul>
              <li><a href="{concat($directoryLevel, 'pastCalendar.html')}">Past</a></li>
            </ul>
          </li>
          <li><a href="{concat($directoryLevel, 'examplePlainPage.html')}">Example Plain Page</a></li> 
        </ul>           
      </div>
    </xsl:template> 
    

Updates

  • 2021-11-08 21:01. "contact.html" to "examplePlainPage.html"; "Contact" to "Example Plain Page".