XslWebMaker Advanced - Repeating Components

Page Updated: Mon, 23 Sep 2019 23:40 AEST (UTC+1000)

Grab parts of a .html page and repeat it on the same page.

In .html source.

...
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <!-- Title, Description, and keyword content should be repeated in the 
        body -->
  <title>Philorum - <xwm:pageTitleSource>Contact</xwm:pageTitleSource></title>
  ...
</head>
<body>  
  ...
  <xwm:topArea />  
    ...

In xwmToXhtml.xslt

<xsl:template match="*[local-name()='pageTitleSource']" >
    <xsl:value-of select="." /> 
</xsl:template>

<xsl:template match="*[local-name()='topArea']" xml:space="preserve">
  <div id="topArea">   
    <div id="pageTitle" class="introduction">
      <xsl:value-of select="//*[local-name()='pageTitleSource']" /> 
    </div>    
  </div></xsl:template> <!-- </xsl:template> here to reduce new lines in output -->  

The resulting file will have that part of the <title> meta element text, in this example "Contact", automatically displayed to the user at the top of the web page.