- From: Jeni Tennison <jeni@jenitennison.com>
- Date: Wed, 23 Oct 2002 10:00:14 +0100
- To: xmlschema-dev@w3.org, "vze3y7w8" <boris.kortiak@verizon.net>
- CC: boris@kortiak.com
Hi Boris, > If you look at the XML source, about the third line down, you will > see a commented out root declaration with information about the CSD > as generated by XMLSPY. > > The problem I am having is that if I restore that line and comment > out the other root declaration I only get the data contents of the > XML document and no XSL formatting is performed. (Instead of "root declaration", you should say "document element start tag" -- the thing that you are switching in and out is the start tag of the document element.) The problem that you are encountering is due to the fact that the start tag generated by XMLSpy includes a default namespace declaration: xmlns="http://www.kortiak.com/namespace" Read up on namespaces at: http://www.jclark.com/xml/xmlns.htm When the default namespace is included (i.e. when you use the XMLSpy start tag) all the elements in your XML document are in your namespace. In XPath, which you're using in your XSLT, when you select an element using only its local name (i.e. without a prefix to indicate a namespace) then you're always referring to an element *in no namespace*. For example: <xsl:template match="/FamilyTree"> ... </xsl:template> will only match FamilyTree elements in no namespace. If you want to make it match FamilyTree elements in your namespace then you must declare that namespace, with a prefix, in your stylesheet, and use that prefix for every element name that you refer to in your stylesheet. Something like: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ft="http://www.kortiak.com/namespace"> <xsl:template match="/ft:FamilyTree"> ... </xsl:template> ... </xsl:stylesheet> Read more in the XSL FAQ at: http://www.dpawson.co.uk/xsl/sect2/N5536.html By the way, this has nothing to do with using XML Schema. Questions about XSLT are best sent to XSL-List (http://www.mulberrytech.com/xsl-list). Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/
Received on Wednesday, 23 October 2002 05:00:20 UTC