RE: [xsl] Why "value-of "cannot work?

Subject: RE: [xsl] Why "value-of "cannot work?
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Sat, 24 Feb 2001 12:25:10 -0000
>  I wrote an xml document and an xsl blow,and they were in the
> same  directory.I wanted
> to see the result ---Fred Smith on my screan.But i was disappointed.

Well, your stylesheet is riddled with errors.

>  <xsl:stylesheet xmlns:xsl="www.3org.com/TR/WD-xsl">

That namespace resembles the namespace for the old Microsoft dialect of XSL,
but even for that dialect, it's wrong. First decide whether you want to use
Microsoft WD-xsl or W3C XSLT (they are quite different,and WD-xsl is
effectively obsolete: see the MSXML FAQ at www.netcrucible.com ) and then
type the namespace correctly, otherwise your document isn't even a
stylesheet.

> <xsl:template match="/">
>
>  <xsl:template match="person">

Template rules are never nested in XSLT.

>    <xsl:value-of select="person/given-name" />

Delete "person/": you're looking for a <person> element within a <person>
element.
>
>    <xsl:value-of match="family-name" />

Change "match" to "select".

I suggest you start by taking some sample stylesheets written by someone
else and getting them to work in your environment. Then see if you can
modify them to create your own.

Mike Kay


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


Current Thread