Template Developer Guide

The HTML code displayed to user is generated by XSL transformation of XML data generated by the DirectoryListingHandler or InfoPageHandler. In configuration you specify path to XSL template which will be used. The design and most of functionality of application is defined by the XSL templates.

Format of directory listing XML

<?xml version="1.0" encoding="utf-8"?>
<directoryListing title="Misc" isRoot="False" virtualPath="~/Misc/" physicalPath="C:\inetpub\wwwroot\Misc\">
    <folder title="Urban Patterns" 
            name="Urban_Patterns" 
            creationTime="2008-10-31T08:45:13.6874410+01:00" 
            lastWriteTime="2008-10-31T08:45:15.3410410+01:00" />
    <file title="20030510-074756-0000.jpg" 
          name="20030510-074756-0000.jpg"
          creationTime="2008-10-31T08:45:15.3566410+01:00"
          lastWriteTime="2008-10-31T08:45:15.3566410+01:00"
          size="106271" />
</directoryListing>

<directoryListing> element

This is the document (root) element, which must be present exactly once. Has the following attributes:
  • title - display title of the current folder; basically the same as folder name, with underscores replaced by spaces
  • isRoot - when set to True, current folder is root of the gallery (does not have any parent folder)
  • virtualPath - virtual path to current directory, relative to application root (represented by ~)
  • physicalPath - physical folder path

<folder> element

Represents one subfolder of current folder. May occur zero or more times, once for each folder. Has the following attributes:
  • title - display title of the subfolder; basically the same as folder name, with underscores replaced by spaces
  • name - raw folder name
  • creationTime - date when the folder was created (taken from file system)
  • lastWriteTime - date when the folder was last written to (taken from file system)

<file> element

Represents one file in current folder. May occur zero or more times, once for each file. Has the following attributes:
  • title - display title of the file; basically the same as file name, with underscores replaced by spaces and without extension
  • name - raw file name
  • creationTime - date when the file was created (taken from file system)
  • lastWriteTime - date when the file was last written to (taken from file system)
  • size - file size in bytes

Format of information page XML

<?xml version="1.0" encoding="utf-8" ?>
<file name="20040502-181652-0000.jpg" 
      virtualPath="~/Misc/20040502-181652-0000.jpg" 
      physicalPath="C:\inetpub\wwwroot\Misc\20040502-181652-0000.jpg">
    <folder isRoot="false">Misc</folder>
    <title>20040502-181652-0000</title>
    <creationTime>2008-10-31T08:45:15.3566410+01:00</creationTime>
    <lastWriteTime>2008-10-31T08:45:15.3722410+01:00</lastWriteTime>
    <position current="2" max="5" />
    <prevName>20030510-074756-0000.jpg</prevName>
    <nextName>20040603-181328-0000.jpg</nextName>
    <size width="1024" height="768" bytes="146790" />
</file>

<file> element

This is the document (root) element, which must be present exactly once. Has the following attributes:
  • name - name of the file
  • virtualPath - virtual path to current file, relative to application root (represented by ~)
  • physicalPath - physical file path

<folder> element

Represents the folder where the picture resides. Is present exactly once. Has the isRoot attribute, when set to True, current folder is root of the gallery (does not have any parent folder).

<title> element

Display title of the file; basically the same as file name, with underscores replaced by spaces and without extension.

<creationTime> and <lastWriteTime> elements

Each occurs exactly once. Represents the date when file was created or last written to, taken from file system.

<position> element

Occurs exactly once. Represents current position of file in folder when sorted alphabetically. Has the following attributes:
  • current - position index of the file, 1-based
  • max - number of the files in folder

<prevName> and <nextName> elements

File name of previous and next file in sequence (folder), when sorted alphabetically. If the file is on first or last position, the appropriate element is not present.

<size> element

Occurs exactly once. Represents size of the image. Has the following attributes:
  • width and height - dimensions of image in pixels
  • bytes - size of source image in bytes

XSL parameters

The transformation can be parametrized. The XSL template may be given set of parameters, which may affect how the template processes data.

In Nemesis Gallery you may use four types of parameters: configuration, dynamic, query string and form fields.

Please note that all XSL parameter names are case sensitive.

Configuration parameters

The parameters defined in web.config file, in path /configuration/altairis.nemesis.gallery/templateParameters. Their names, values and namespaces are defined in configuration. See Installation and Configuration page for more details.

Dynamic parameters

These parameters are evaluated at time when transformation occurs. Due to caching, it may not be for each request. These parameters are defined in the http://schemas.altairis.cz/Nemesis/Gallery/XsltArguments#Dynamic namespace.
  • CurrentTime - time when transformation is started, in standard XML format (ie. 2008-10-31T08:45:15.3566410+01:00)
  • HostName - server hostname requested by user (ie. www.mysite.com)

Query string parameters

When the varyByParams function is enabled in configuration of directory listing or info page, query string (GET parameters) are forwarded to template. The parameter name is converted to lowercase and the parameters are defined in the http://schemas.altairis.cz/XML4web/Arguments#QueryString namespace.

Form field parameters

When the varyByParams function is enabled in configuration of directory listing or info page, form fields (POST parameters) are forwarded to template. The parameter name is converted to lowercase and the parameters are defined in the http://schemas.altairis.cz/XML4web/Arguments#FormFields namespace.

Last edited Nov 9, 2008 at 11:47 PM by altair, version 1

Comments

No comments yet.