Re: A Query

Subject: Re: A Query
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 26 Jul 1999 20:13:00 -0400
At 99/07/26 15:56 -0700, Anupam Gupta wrote:
>How do you generate a XSL stylesheet by applying a stylesheet to a XML
>document ?

By escaping the namespace of the output XSLT instructions so the XSLT
engine doesn't get confused between what you are asking it to do and what
you are asking it to put to the result tree.

Without this mechanism, there would be no way to tell the difference
between an instruction to be acted on and an instruction to be emitted.

This escaping mechanism can be applied any number of times (stylesheets for
stylesheets for stylesheets etc.)

>XML + XSL ==> XSL
>                                + XML (Another One) ===> HTML

A terse example is below.

Note how the "xslo" namespace URI is prefaced with "quote:" which is
removed on output by the XSLT engine.  With it removed, it is recognized
the second time around.

I hope this helps.

........... Ken

p.s. please note that I changed "html" to be "hmtl" so that my mailer
wouldn't eat the markup and *help* me by displaying the HTML; the
principles of what I'm trying to show are unchanged.

T:\FTEMP>type xsl.xsl
<?xml version="1.0"?><!--xsl.xsl-->
<!--XSLT Working Draft 1999-07-09 ->

<xsl:stylesheet xmlns:xsl="";

<xsl:template match="/">                          <!--root rule-->
  <xslo:stylesheet xmlns:xslo="quote:";>
    <xslo:template match="/">
      <hmtl>             <!--I made this is a typo because of my mailer-->
        <p>Hello world</p>


T:\FTEMP>call xsl xsl.xsl xsl.xsl xslo.xsl
T:\FTEMP>type xslo.xsl
<xslo:stylesheet xmlns:xslo="";>
<xslo:template match="/">
<p>Hello world</p>

T:\FTEMP>call xsl xsl.xsl xslo.xsl xslo.htm
T:\FTEMP>type xslo.htm
<hmtl><p>Hello world</p></hmtl>

G. Ken Holman                    mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.   
Box 266, Kars, Ontario CANADA K0A-2E0   +1(613)489-0999   (Fax:-0995)
Website:  XSL/XML/DSSSL/SGML services, training, libraries, products.
Publications:   Introduction to XSLT (3rd Edition) ISBN 1-894049-00-4
Next instructor-led training:   MS'99 1999-08-16  MT'99 1999-12-05/06

 XSL-List info and archive:

Current Thread