xsl-list
[Top] [All Lists]

Re: seriously trivial question about processing the root element

2003-03-20 02:57:20
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



<Prev in Thread] Current Thread [Next in Thread>