This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: XSL outputting HTML from an XML source
- To: xsl-list at mulberrytech dot com
- Subject: Re: XSL outputting HTML from an XML source
- From: Warren Hedley <w dot hedley at auckland dot ac dot nz>
- Date: Fri, 19 May 2000 15:56:20 -0400
- Organization: Department of Engineering Science, The University of Auckland
- References: <39258227.B4734D64@valinux.com>
- Reply-To: xsl-list at mulberrytech dot com
Ariel Garza wrote:
>
> <CONTENT>
> This is a generic piece of content that a content person wants to have
> <B>dynamic bold</B> in.
> </CONTENT>
To get this output, put it straight in your stylesheet.
<xsl:template match="some_element">
<content>Here's my <b>content</b>.</content>
</xsl:template>
> In other words, Netscape just prints out
> <B>dynamic bold</B> without evaluating the tags.
Huh? If Netscape sees <B>...</B>, the ... should be bold, unless
you have some stylesheet that tells it to do otherwise.
> Is there a way to
> include HTML on the fly, not knowing where in the tree it is and have
> the XSL stylesheet output it as though it were HTML and not text?
First of all you should have an <xsl:output method="html"> at the top
of your stylesheet. This won't actually affect how <B> tags are output
but it will affect things like <br />, which becomes <br>. Any HTML
that you want in your output document you just define in the templates
that are applied to your input document. The following creates your
basic HTML structure. Is this what you meant?
<xsl:template match="/">
<html>
<head>
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>
</xsl:template>
> If I
> use straight <B></B> tags in XML, is there a way to have a stylesheet
> interpret all <B></B> tags automatically?
If you have a <b>...</b> in your stylesheet, any working
processor will put a <b>...</b> in your output document.
If you want <b>...</b> in your input XML to become something
else in your output, then define a template. The following
converts <b> elements to <strong>.
<xsl:template match="b|B">
<strong><xsl:apply-templates select="*|text()" /><strong>
</xsl:template>
Hope this helps. If it doesn't, then send a little more
information about the problem, with a short input document,
stylesheet, and the desired output.
--
Warren Hedley
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list