Re: Newbie Needs Help

Subject: Re: Newbie Needs Help
From: Steve Dahl <sdahl@xxxxxxxxxxx>
Date: Thu, 17 Dec 1998 13:34:53 -0500
Oren Ben-Kiki wrote:

> Robert W. Hackenfort <rhackenfort@xxxxxxxxxx> wrote:
>
> >Just starting out in XML and XSL and tried to do a very simple document.
> >
> >The XML is:
> >
> ><?xml version="1.0"?>
> ><?xml:stylesheet type="text/xsl" href="test.xsl"?>
> >
> ><greeting>Hello XSL!</greeting>
> >
> >and the XSL is:
> >
> ><xsl:stylesheet
> >xmlns:xsl="http//www.w3.org/TR/WD-xsl"
> >xmlns:fo="http//www.w3.org/TR/WD-xsl/FO" result-ns="fo">
> > <xsl:template match= "greeting">
> > <fo:block color="red" font-size="16pt">
> >   <process-children/>
> >  </fo:block>
> > </xsl:template>
> ></xsl:stylesheet>
>
> Which produces a blank result, since matching on the top-level element can
> only done by using match="/" regardless of the actual element type which
> appears there. "It made sense at the time" - it probably still does when
> viewing it in the right way. It makes for an excellent FAQ question (if we
> had a FAQ, that is) - it seems every new XSL user goes through finding this
> out the hard way.
>
> Share & Enjoy,
>
>     Oren Ben-Kiki

On the contrary. The top-level element is *not* matchable by the "/" pattern.
According to the August 18th draft:

> 2.4.1 Root Node
>
> The root node is the root of the tree. It does not occur anywhere else in the
tree.
> It has a single child which is the element node for the document element of
the document.

So the root node is not the top-level element, but is the parent node of the
top-level element--in other words, the root node is the Document node. The "/"
pattern, in a conforming XSL processor, selects the Document, not the
<greeting> element.

Quite probably, the main problem here is that <process-children/> needs to be
replaced with <xsl:apply-templates/>, as well as the fact that IE5b2 doesn't
implement the FO part of XSL.



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


Current Thread