This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Combining stylesheets for baseclass-subclass type documents
- From: "Daniel Brockman" <daniel dot brockman at utb dot sandviken dot se>
- To: XSL-List at lists dot mulberrytech dot com
- Date: Sun, 14 Apr 2002 23:48:28 +0200
- Subject: [xsl] Combining stylesheets for baseclass-subclass type documents
- Reply-to: xsl-list at lists dot mulberrytech dot com
I need help designing a couple of stylesheets that both transform similar
source types; the first stylesheet transforms the base type while the
second
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" />
</c:c>
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
a.xsl
to output the a-specific information in a named template, which would be
called
from the template matching the root element in a.xsl. This template could
then
also be called from b.xsl inside the result-element containing the
b-specific
information, <c:bar>.
--- result 2c ---
<c:c xmlns:c="urn:c">
<c:bar="b-specific information">
<c:foo="a-specific information" />
</c:bar>
</c:c>
So far, so good, right? Well, these are the problematic versions that I
want
to be able generate:
--- result 2a ---
<c:c xmlns:c="urn:c">
<c:foo="a-specific information" />
<c:bar="b-specific information" />
</c:c>
--- result 2b ---
<c:c xmlns:c="urn:c">
<c:foo="a-specific information">
<c:bar="b-specific information" />
</c:foo>
</c:c>
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@drlion.nu
+----+ 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