Re: [xsl] seriously trivial question about processing the root element

Subject: Re: [xsl] seriously trivial question about processing the root element
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 20 Mar 2003 09:57:20 +0000
Hi Robert,

> more than one book i've been reading has presented examples of
> processing an XML document whose document element is, say, <doc>,
> with:
>
>   <xsl:template match="/">
>    <xsl:apply-templates select="doc"/>
>   </xsl:template>
>
>   <xsl:template match="doc">
>    ....etc etc ...

The pattern that I tend to use is:

<xsl:template match="/">
  <xsl:apply-templates select="doc" mode="html" />
</xsl:template>

<xsl:template match="doc" mode="html">
  ...
</xsl:template>

In other words, I use the template matching the root node to start
processing using a particular mode. This arrangement makes it easy to
combine stylesheets. As Ken said, it also specifies the document
element of the documents that you expect to be working with.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread