[xsl] Combining stylesheets for baseclass-subclass type documents

Subject: [xsl] Combining stylesheets for baseclass-subclass type documents
From: "Daniel Brockman" <daniel.brockman@xxxxxxxxxxxxxxxx>
Date: Sun, 14 Apr 2002 23:48:28 +0200
I need help designing a couple of stylesheets that both transform similar
source types; the first stylesheet transforms the base type while the
stylesheet transforms an extension to this type.

The first stylesheet, a.xsl, provides the a-specific information.  It has
to be
independant of the second stylesheet, b.xsl, which provides the b-specific
information.  By definition, the second stylesheet, b.xsl, cannot provide
the a-
specific information.

If the source document uses the first stylesheet, nothing special happens:

--- source 1 ---
<?xml-stylesheet type="text/xsl" href="a.xsl"?>
<a:a xmlns:a="urn:a" />

--- result 1 ---
<c:c xmlns:c="urn:c">
  <c:foo="a-specific information" />

If, however, it uses the second stylesheet, it gets a bit more complicated:

--- source 2 ---
<?xml-stylesheet type="text/xsl" href="b.xsl"?>
<a:a xmlns:a="urn:a" />

If the following result, result 2c, was to be generated, we could design
to output the a-specific information in a named template, which would be
from the template matching the root element in a.xsl.  This template could
also be called from b.xsl inside the result-element containing the
information, <c:bar>.

--- result 2c ---
<c:c xmlns:c="urn:c">
  <c:bar="b-specific information">
    <c:foo="a-specific information" />

So far, so good, right?  Well, these are the problematic versions that I
to be able generate:

--- result 2a ---
<c:c xmlns:c="urn:c">
  <c:foo="a-specific information" />
  <c:bar="b-specific information" />

--- result 2b ---
<c:c xmlns:c="urn:c">
  <c:foo="a-specific information">
    <c:bar="b-specific information" />

I would very much appreciate any thoughts or suggestions (or indeed full
solutions) that might help me on the way.

Thanks in advance,

    +----+   Daniel Brockman
    | :) |   thedoc@xxxxxxxxx
    +----+   http://www.drlion.nu/

    "To spot the expert, pick the one who predicts
     the job will take the longest and cost the most."
      - Murphy

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

Current Thread