XDC - v. 0.6.1

File config.xsl

<xsl:stylesheet version="1.0">
  <xsl:import href="util.xsl"/>
</xsl:stylesheet>

This stylesheet contains templates controlling the access to configuration parameters.
Version:
0.5
Author:
Jens Voß

Parameter Summary
<xsl:param name="configuration"/>

The configuration stylesheet parameter may be passed to the stylesheet processing an XML file.


Template Summary
<xsl:template match="/" mode="config.getValueFromConfig">
  <xsl:param name="tableName"/>
  <xsl:param name="key"/>
  <xsl:param name="default"/>
</xsl:template>

This template is used to retrieve a value for a given key from a list of tables of key-value pair entries which is passed to the stylesheet as a global parameter.

<xsl:template match="/" mode="config.getConfigValue">
  <xsl:param name="tableName"/>
  <xsl:param name="key"/>
  <xsl:param name="default"/>
</xsl:template>

This template is merely a workaround for an MSXSL bug.

<xsl:template match="/|*" mode="config.getPiValue">
  <xsl:param name="key"/>
  <xsl:param name="default"/>
  <xsl:param name="forceDefault"/>
</xsl:template>

This template is used to extract a configuration parameter from a processing instruction (named "xdc") within the source file.

<xsl:template match="/|*" mode="config.getValue">
  <xsl:param name="tableName"/>
  <xsl:param name="key"/>
</xsl:template>

This template retrieves a configuration value from either the XML file or the XDC configuration or a set of default values according to the following rules (first rule satisfied applies).

<xsl:template match="/|*" mode="config.getDictionaryValue">
  <xsl:param name="key"/>
</xsl:template>

This template retrieves a dictionary value from either the XML file or the XDC configuration.

<xsl:template match="/|*" mode="config.getPatternValue">
  <xsl:param name="key"/>
</xsl:template>

This template retrieves an XPath pattern value (i.e.


Parameter Detail
<xsl:param name="configuration"/>

The configuration stylesheet parameter may be passed to the stylesheet processing an XML file. It is expected to be a DOM element containing subelements named entry with a (required) attribute named key and an (optional) attribute named value.


Template Detail
<xsl:template match="/" mode="config.getValueFromConfig">
  <xsl:param name="tableName"/>
  <xsl:param name="key"/>
  <xsl:param name="default"/>
</xsl:template>

This template is used to retrieve a value for a given key from a list of tables of key-value pair entries which is passed to the stylesheet as a global parameter.

Parameters:
table - The name of the table containing <entry> subelements with key-value pairs (realized as <key> resp. <value> subelements). If omitted, the table name "config" is used as the default.
key - The key for which the value is retrieved from the given table
default - A default value which is "returned" if either the table parameter is not set or does not contain a key-value pair with the given key
Author:
Jens Voß


<xsl:template match="/" mode="config.getConfigValue">
  <xsl:param name="tableName"/>
  <xsl:param name="key"/>
  <xsl:param name="default"/>
</xsl:template>

This template is merely a workaround for an MSXSL bug. It provides a simple indirection for the unnamed template with mode="config.getValueFromConfig" .

See:
the template withmode="config.getValueFromConfig"


<xsl:template match="/|*" mode="config.getPiValue">
  <xsl:param name="key"/>
  <xsl:param name="default"/>
  <xsl:param name="forceDefault"/>
</xsl:template>

This template is used to extract a configuration parameter from a processing instruction (named "xdc") within the source file. These parameters may be specified in the form <?xdc key1="value1" key2="value2" ... ?>.

Parameters:
key - The key of the configuration parameter to be read
default - A default value which is returned if the specified key is not set in an "xdc" processing instruction (or if it is forced by the forceDefault parameter)
forceDefault - If this equals 1, it forces this template to return the default value (unless no default is specified).


<xsl:template match="/|*" mode="config.getValue">
  <xsl:param name="tableName"/>
  <xsl:param name="key"/>
</xsl:template>

This template retrieves a configuration value from either the XML file or the XDC configuration or a set of default values according to the following rules (first rule satisfied applies).

  1. If the value for the key has been specified in the configuration and the "forceoptions" value has been set to 1 in the configuration, the configuration value is taken.
  2. If the value has been specified in an XDC processing instruction in the XML file, that value is taken.
  3. If the value has been specified in the configuration, that value is taken.
  4. The (hard-coded) default value is taken.
Parameters:
key - The key for which a value is to be retrieved.


<xsl:template match="/|*" mode="config.getDictionaryValue">
  <xsl:param name="key"/>
</xsl:template>

This template retrieves a dictionary value from either the XML file or the XDC configuration.

Parameters:
key - The key for which a value is to be retrieved.


<xsl:template match="/|*" mode="config.getPatternValue">
  <xsl:param name="key"/>
</xsl:template>

This template retrieves an XPath pattern value (i.e. a valid HTML link) from either the XML file or the XDC configuration.

Parameters:
key - The key for which a value is to be retrieved.


XDC - v. 0.6.1

Copyright © 2005 - 2006 Jens Voß.