[xsl] switching designs in xsl

Subject: [xsl] switching designs in xsl
From: "Kloeck, Erwin" <Erwin.Kloeck@xxxxxx>
Date: Mon, 15 Dec 2003 15:59:58 +0100

I do some xsl:fo formatting that depends on the value of an element <design-id value="design-001" />. I keep the xsl stylesheets for each design in a separate directory 'design-001'. Currently, I import all designs in my start xsl and then switch according to the value of the design-id. This works but has the disadvantage that all templates, attribute-sets etc have to be globally distinct, which I do by prefixing them with a 
design-marker, e.g. 'd001-'. This strikes me as not very elegant. What would be a more clever way to do this? I append my top stylesheet, to give people an idea what I am doing.

Thanks for your help.


<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:fo="http://www.w3.org/1999/XSL/Format";>

  <xsl:include href="design-001/d001-format-complete.xsl" />
  <xsl:include href="design-002/d002-format-complete.xsl" />

  <xsl:template match="/">
    <xsl:variable name="design-id" select="/printobject/design-id/@value"/>
      <xsl:when test="$design-id = 'design-001'">
         <xsl:call-template name="d001-format-complete"/>
      <xsl:when test="$design-id = 'design-002'">
        <xsl:call-template name="d002-format-complete"/>


Erwin Kloeck

Oestreicher + Wagner 
Medientechnik GmbH
Frankenthaler Strasse 20
D-81539 Muenchen

Fon   +49 (0)89-68961 216 
Fax   +49 (0)89-68961 271

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread