RE: [xsl] apply one XSLT stylesheet to another one ?

Subject: RE: [xsl] apply one XSLT stylesheet to another one ?
From: "Brian Martinez" <Brian.Martinez@xxxxxxxxxxxx>
Date: Mon, 27 Nov 2006 11:36:39 -0700
Yes, it's certainly possible (sometimes necessary in fact!) to generate
XSLT from XSLT.  The trick (in XSLT 1.0 at least) is to use a namespace
alias so that the processor can distinguish between actual XSLT elements
and elements which are meant to be written to output.

You can start with:

<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:xso="dummy">
  <!-- the 'xso' namespace represents your output XSLT elements -->

  <xsl:output method="xml" version="1.0" encoding="UTF-8" />
  <xsl:namespace-alias stylesheet-prefix="xso" result-prefix="xsl" />

  <!-- write your XSLT templates, substituting 'xso' for 'xsl'
       wherever you wish to output literal XSLT elements -->
  <xsl:template match="xsl:stylesheet | xsl:transform">
    <xso:stylesheet>
    <!-- . . . -->
    </xso:stylesheet>
  </xsl:template>

</xsl:stylesheet>

Note that I haven't tested any of this but it's been mostly cribbed from
Sal Mangano's XSLT Cookbook, and I've done this before, so it *should*
work.  ;-)

hth,
b.

> -----Original Message-----
> From: Michael Stephan [mailto:e0126140@xxxxxxxxxxxxxxxxxxxx]
> Sent: Monday, November 27, 2006 11:10 AM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] apply one XSLT stylesheet to another one ?
>
> Hallo, sorry for my question but I'm totally new to XSLT.
>
> Is it possible to modify one XSLT stylesheet (A) with another (B) to
> create a new one (C), I guess it is! Would be great if someone of you
> could help me, a tiny example would be more than great. Thx in
advance.
>
> mfg
> Michael St.

Current Thread