This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Re: style sheet line
On Thu, Apr 11, 2002 at 09:45:53AM -0700, Bob Stayton wrote:
> On Thu, Apr 11, 2002 at 03:52:43PM +0200, dbook@centrum.cz wrote:
> > Hi,
> > I have got a little problem with adding style sheet line
> > (second line in source). I'm writing XSL sheet for converting
> > DocBook -> HTML+MathML.
> >
> > I would like to get after transformation:
> >
> > 1. <?xml version="1.0" encoding="UTF-8"?>
> > 2. <?xml-stylesheet type="text/xsl" href="mathml.xsl"?>
> > ... some HTML and MathML tags.
> >
> > Is there any way, how to write XSL which will do that(insert 2.
> > line). The reason is using document in IE + Math plug-in.
>
> As with the previous request to output comments,
> you can use <xsl:text> as follows in your customization layer:
>
> <xsl:template match="/">
> <xsl:text disable-output-escaping="yes"><?xml-stylesheet type="text/xsl" href="mathml.xsl"?>
> </xsl:text>
> <xsl:apply-imports/>
> </xsl:template>
>
> This template match intercepts the root element processing
> in order to output the xsl-stylesheet processing instruction.
> Then <xsl:apply-imports/> element passes it on
> to the real root processor.
I also forgot there was an <xsl:processing-instruction>
element, so this can be done more cleanly with:
<xsl:template match="/">
<xsl:processing-instruction name="xml-stylesheet">
<xsl:text>type="text/xsl" href="mathml.xsl"</xsl:text>
</xsl:processing-instruction>
<xsl:apply-imports/>
</xsl:template>
--
Bob Stayton 400 Encinal Street
Publications Architect Santa Cruz, CA 95060
Technical Publications voice: (831) 427-7796
Caldera International, Inc. fax: (831) 429-1887
email: bobs@caldera.com