This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: save me from the name spaces confusion


I'm tempted to say: go and read the XSL specification from start to end, and
then come back with questions. Your questions are very confused as to the
nature of XSL - what it does and how it is used in the real world.
 
This is how I understand it. Mike Kay et al will no doubt pick up any
problems with my understanding of the mechanics of namespaces, which I will
blame on a stinking hangover... *grin*
 
Namespaces are a way of seperating different types of tags in xml; in the
case of the XSL namespace, it tells the parser deal with the tree using its
XSL engine.
 
In a stylesheet, the XSL namespace follows a rigidly defined DTD which
describes that namespace implicitly. You tell the parser what version you
are using by the following command:
 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- templates go here -->
</xsl:stylesheet>
 
Now, the parser does not actually go to this URL to get the namespace DTD -
it is inbuilt into the parser, and so (at least at the moment) unless you
use the correct namespace declaration, the parser will throw you back an
error. The namespace declaration you have used implies that you are still
using the old IE5 parser. Unless there is a good reason why you are using
this (like you are processing your stylesheets on the client side), upgrade
immediately to one of the more compliant parsers such as XT or, if you are
not experienced with Java, try the latest MS parser, MSXML3. IE5 was
released in December 1998; the specification has changed almost beyond
recognition since then, and XSL you write for that parser will not work on
anything else (including MSXML3).
 
That should answer the first question.
 
QUESTION 2:
You can create your own namespaces by simply declaring a namespace path to
your schema or DTD in the first occurrence of that namespace. This will be
fetched by the parser and all of the elements within that node with the
declared namespace will be validated against the DTD/Schema.
 
For example:
 
<bk:book xmlns:bk="urn:bookstore.com:BookInfo">
    <bk:title>War and Peace</bk:title>
    <bk:author>Leo Tolstoy</bk:author>
    <price>$29.00</price>
</bk:book>
 
In this example, the <price> tag will not be validated against the
namespace; the others will.
 
QUESTION 3:
Is <xsl:stylesheet xmlns:xsl="..." version="1.0"> a method for including
stylesheets? No. It is the declaration of the type of stylesheet you are
using. If you want to include a stylesheet into another stylesheet, you must
use the <xsl:include> tag.
 
QUESTION 4:
See question 2
 
QUESTION 5:
See question 2
 
 
Hope this helps - but you really should go and read the XML and XSL
specifications.
 
Ben


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]