This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: xalan error with plain text
- From: Jeni Tennison <jeni at jenitennison dot com>
- To: Christian Roth <roth at visualclick dot de>
- Cc: XSL-List <XSL-List at lists dot mulberrytech dot com>
- Date: Sat, 12 Jan 2002 15:40:45 +0000
- Subject: Re: [xsl] xalan error with plain text
- Organization: Jeni Tennison Consulting Ltd
- References: <EC61ECAF-076A-11D6-A893-003065E74B40@earthtrip.com><20020112151529.6153@post.strato.de>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi Christian,
> I don't know about the exception, but I think you do not have a
> template for the document root. So, you should at least add
>
> <xsl:template match="/">
> <xsl:apply-templates />
> </xsl:template>
>
> This is what cost me some time to figure out: <document /> is not
> the document root, but the one and only child of the document root.
> And it's the document root where the processor starts to work.
It's true that the processor starts from the document node. But it's
almost never a problem if you don't specify a template that matches
this node - the built-in template for the root node is exactly the
same as that above, so you only *have* to specify it if you've got
some other template, somewhere else in your stylesheet, that matches
the document node and does something different.
[Also note that the document node can have more than one child - there
might be comments and processing instructions before or after the
top-level (document) element, and these are also children of the
document node. Indeed, there's actually nothing stopping XSLT from
working on documents with more than one top-level element, but you
have to pass them to the processor through code rather than as
serialized XML documents.]
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list