com.arsdigita.templating
Class PatternStylesheetResolver

java.lang.Object
  extended bycom.arsdigita.templating.PatternStylesheetResolver
All Implemented Interfaces:
StylesheetResolver

public class PatternStylesheetResolver
extends Object
implements StylesheetResolver

This stylesheet resolver is used by the *PresentationManager class to work out which XSLT stylesheet to apply to the current Bebop XML output.

This particular stylesheet resolver uses a flat file containing a list of stylesheet patterns, one per line. The file is called WEB-INF/resources/stylesheet-paths.txt. Such a file could look like this:

 # Comments and empty lines are ignored.

 /packages/aplaws/xsl/::vhost::/cms_::locale::.xsl
 /packages/aplaws/xsl/::vhost::/cms.xsl
 /packages/aplaws/xsl/default/cms_::locale::.xsl
 /packages/aplaws/xsl/default/cms.xsl
 /packages/content-section/xsl/cms_::locale::.xsl
 /packages/content-section/xsl/cms.xsl
 

You may use the com.arsdigita.templating.stylesheet_paths system property to change the file from which the stylesheet patterns are drawn.

The patterns, such as ::vhost::, are substituted for string values:

Pattern Meaning Examples
::locale:: Current locale fr_FR
::vhost:: Virtual hostname. business.camden.gov.uk
::outputtype:: Output format. text_html

Each substituted string is cleaned up using the following rules:

The resolver looks at each stylesheet in turn, and the first one which actually exists on disk is returned.

Author:
Richard W.M. Jones

Field Summary
 
Fields inherited from interface com.arsdigita.templating.StylesheetResolver
versionId
 
Constructor Summary
PatternStylesheetResolver()
           
 
Method Summary
static void registerPatternGenerator(String key, PatternGenerator gen)
          Registers a new pattern generator for the given key.
 URL resolve(javax.servlet.http.HttpServletRequest request)
          Resolves a template for the request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PatternStylesheetResolver

public PatternStylesheetResolver()
Method Detail

registerPatternGenerator

public static void registerPatternGenerator(String key,
                                            PatternGenerator gen)
Registers a new pattern generator for the given key.

Parameters:
key - the key as it appears in the pattern string
gen - a pattern generator for producing values to be substituted for key

resolve

public URL resolve(javax.servlet.http.HttpServletRequest request)
Description copied from interface: StylesheetResolver
Resolves a template for the request.

Specified by:
resolve in interface StylesheetResolver
Parameters:
request - the HttpServletRequest for which to resolve a template


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 20 2004:2337 UTC