Skip to main content Design options ...

Design Options

Changes effect all users.

Developer:
Theme:
Components:

XslWebMaker Advanced Instructions - Variables

Process variables originating from transformDir.wsf, via your *.xslt file, to your web page.

In .html source.

<body>  
  ...
  <xwm:footer />  
</body>  

In xwmToXhtml.xslt

...
<xsl:param name="nowLocalFriendly">Example text that gets overwritten by variable processing
  Wed, 16 Jun 1999 11:02 (+1000 AUS Eastern Standard Time)</xsl:param>

<xsl:template match="*[local-name()='footer']" >
  <div id="websiteLastUpdated">
    Page updated: <xsl:value-of select="$nowLocalFriendly" /> 
  </div></xsl:template> <!-- </xsl:template> here to reduce new lines in output --> 
...

In transformDir.wsf add a line calling the addParameter method of XSLTemplate.

...
xslTemplate = new ActiveXObject('MSXML2.XSLTemplate.' + msXmlVersion + '.0');
xslTemplate.stylesheet = domDocXsl;
var xslProcessor = xslTemplate.createProcessor();
xslProcessor.input = domDocSource;

// ****************************************************************
//  Add any parameters for specific XSL documents here. 
//  Any XSL document that doesn't have the parameter just ignore it.

var now = new Date();
...
// Summary: DateTime in format like 
//          Fri, 18 Jun 2004 14:44 AUS Eastern Standard Time (UTC+1000)
// Depends on: dateTime.js in EcmaScriptLibrary.
// Remarks: Used, for example, at the bottom of each web page
// Used in:
//    xwmToXhtml.xslt  
//  getDateTimeLocalFriendly() is a custom function. You can use something different.                      
xslProcessor.addParameter("nowLocalFriendly", getDateTimeLocalFriendly(now));