Re: [xsl] Combining stylesheets for baseclass-subclass type documents

Subject: Re: [xsl] Combining stylesheets for baseclass-subclass type documents
From: "Daniel Brockman" <daniel.brockman@xxxxxxxxxxxxxxxx>
Date: Mon, 15 Apr 2002 01:21:12 +0200
Alright, let's make it practical.  (I realized all occurences of <c:foo>
and <c:bar> were erroneous in my original message, but I've corrected them
here.)  Here are the stylesheets that transform the following:

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

into the following:

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

and the following:

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

into the following:

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

--- in a.xsl ---
<xsl:template match="a:a">
  <c:c>
    <xsl:call-template name="a:output-a-specific-information" />
  </c:c>
</xsl:template>
<xsl:template name="a:output-a-specific-information">
  <c:a-specific-information />
</xsl:template>

--- in b.xsl ---
<xsl:import href="a.xsl" />
<xsl:template match="a:a">
  <c:c>
    <c:b-specific-information>
      <xsl:call-template name="a:output-a-specific-information" />
    </c:b-specific-information>
  </c:c>
</xsl:template>

Now, changing only the two stylesheets -- a.xsl and b.xsl -- and
maintaining all the restrictions, your mission is to transform source 2
into one of the following (source 1 must still transform into result 1):

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

or the following:

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


Thanks in advance,

-
   Daniel Brockman
   mailto:daniel.brockman@xxxxxxxxxxxxxxxx
   
    "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