This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: mixed implicit and explicit stylesheet - possible ?
- To: "Simon Polz" <Simon dot Polz at chello dot at>
- Subject: Re: mixed implicit and explicit stylesheet - possible ?
- From: Jeni Tennison <jeni at friday dot u-net dot com>
- Date: Sat, 05 Aug 2000 22:04:51 +0100
- Cc: <XSL-List at mulberrytech dot com>
- Reply-To: xsl-list at mulberrytech dot com
Simon,
>is it possible to mix implicit and explicit stylesheets ?
I'm not sure which you're counting as implicit and which as explicit, but
the answer is 'sort of'.
When you have a literal result element as the stylesheet (so the stylesheet
looks like an HTML document with some xsl elements in it to indicate where
information should be slotted in), it's equivalent to declaring a
stylesheet with a template that matches on the root node, with the same
content. For example:
<html xmlns:xsl="...">
...
<td><xsl:value-of select="Section/@Name"/></td>
<td><xsl:apply-template select="Option"></td>
</html>
is equivalent to:
<xsl:stylesheet version="1.0" xmlns:xsl="...">
<xsl:template match="/">
<html>
...
<td><xsl:value-of select="Section/@Name"/></td>
<td><xsl:apply-template select="Option"></td>
</html>
</xsl:template>
</xsl:stylesheet>
If you transform a stylesheet into the second form, then you can add any
other templates you want into it. For example:
<xsl:stylesheet version="1.0" xmlns:xsl="...">
<xsl:template match="/">
<html>
...
<td><xsl:value-of select="Section/@Name"/></td>
<td><xsl:apply-template select="Option"></td>
</html>
</xsl:template>
<xsl:template match='Option[@Type="List"]'>
<select>...</select>
</xsl:template>
</xsl:stylesheet>
You can also put any top-level elements like xsl:import or xsl:output or
xsl:key into it. Unsurprisingly, 'proper' stylesheets like these are a lot
more powerful than 'basic' stylesheets, but they are also a lot more complex.
I hope that helps,
Jeni
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list