That is exactly what I had tried to do. I tried to prepend the boilerplate
HTML within my XSLT stylesheet, but I kept on getting parser errors, even
with the CDATA encapsulation.
It turns out I mistyped the CDATA syntax and omitted the outer pair of
Thanks for your help.
"John E. Simpson" wrote:
> At 04:40 PM 03/08/2001 -0800, Ben Lam wrote:
> >I wrote an XSLT stylesheet that outputs a simple HTML file from a source
> >XML document.
> >Now I need to prepend a ready-made HTML boilerplate to the <BODY>
> >section of the output file:
> >I tried to encapsulate the boilerplate in a CDATA tag, but the parser
> >complains that the content needs to be well-formed.
> >How do I incorporate well-formed HTML into my XSLT stylesheet?
> Not sure I follow. Is there some reason you chose not to prepend this
> boilerplate at the time you generated the rest of the HTML?
> Typically, a stylesheet to transform XML to (X)HTML follows a structure
> like this:
> <xsl:stylesheet version="1.0"
> [other namespace declarations, e.g.
> xmlns="http://www.w3.org/TR/REC-html40" to
> transform to HTML 4.0, or
> xmlns="http://www.w3.org/1999/xhtml" to
> transform to XHTML] >
> <xsl:template match="/">
> <head><title>Some Title</title></head>
> [boilerplate stuff?]
> <xsl:template match="elem_1">
> The template rule for processing the root node (or sometimes, the root
> *element*) creates ("instantiates," as they say) the overall structure of
> the HTML document. Details are filled in from the source document in a
> series of xsl:apply-templates elements, which invoke further xsl:template
> elements, and so on down through the source tree. But before that very
> first xsl:apply-templates, or after it for that matter, you can put any
> boilerplate you need before (or after) the details transferred from the
> source tree.
> Does that help?
> John E. Simpson | "Is it weird in here, or is it just
> http://www.flixml.org | me?" -- Steven Wright
> XML Q&A: www.xml.com |