Cascading Fallback

From DLXS Documentation

Revision as of 14:06, 23 March 2011 by Besmit (Talk | contribs)
Jump to: navigation, search

Contents

Description

With fallback, if a file is required (e.g., XML, XSL, CSS, etc.), the system will look through all the fallback layers, starting with the most specific (e.g., the collection) and ending with the least specific (generally, t/text and lib/). Once the file is found, it is used and the search terminates.

E.g., if looking for textclass.css, say a collection is the following fallback layers (from highest to lowest):

  • /c/collid/ (no textclass.css)
  • /g/groupid/textclass.css
  • /a/anotherlayer1/textclass.css
  • /a/anotherlayer2/ (no textclass.css)
  • /t/text/textclass.css

Fallback will first search /c/collid/, which does not contain textclass.css. However, the next layer (/g/groupid/) has the file. /g/groupid/textclass.css will then be used, and the search stops.

The purpose of cascading fallback is to include all matching files in each fallback layer. So for the above example, /g/groupid/textclass.css, /a/anotherlayer1/textclass.css, and /t/text/textclass.css are all used. But they will be included in such a way that files from higher layers have higher precedence.

Note that this behavior can be accomplished in normal fallback by used import statements in CSS, XSL, XML. However, with many levels, these import statements need to be updated, and there is a duplication of filesystem logic (the file exists on the filesystem AND you have to import it) that does not occur with cascading fallback. This prevents a range of potentially subtle bugs that become more likely when you use more fallback layers.

How to use

To use cascading fallback for a collection, simply set cascadingfallback in collmgr to yes.

To use cascading fallback for a group, simply set cascadingfallback in collmgr to yes for all its member collections.

Note that only the following files are supported:

  • xsl
  • css

For unsupported files (e.g., XML), treat them as you would with normal fallback. (E.g., if you want to include /t/text/langmapextra.en.xml with /c/collid/langmapextra.en.xml, use <?CHUNK filename="../../m/mpubs/dlxsclassglobals.xml"?>.)

How it works

CSS

With cascading fallback, you no longer need to use @import to include CSS files from lower fallback layers.

With CSS declarations, if selectors have the same specificity, then those appearing later will be used. With cascading fallback, all matching CSS files will be included, but they will be included so that matching files from lower fallback layers are included before those in higher layers.

XSL

With cascading fallback, you no longer need to use xsl:import to include XSL files from lower fallback layers.

With XSL templates, if templates have the same specificity, then those appearing later will be used. With cascading fallback, all matching XSL files will be included in the virtual stylesheet, but they will be included so that matching files from lower fallback layers are included before those in higher layers.

How to troubleshoot

If you enabled cascading

Personal tools