Hi all, Here i would like to know answers for my queries, please help me in clearing my doubts. ***************** XML File ***************** <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="kiran.xsl"?> <person> <details> <name>Lokesh</name> <address>Hyderabad</address> </details> <details> <name>Narayana</name> <address>Secunderabad</address> </details> <details> <name>Kiran</name> <address>Khairatabad</address> </details> </person>
**************** My Queries **************** 1) Why should i only specify http://www.w3.org/TR/WD-xsl as a namespace and why not others. 2) I am not able to view my xml file if i replace "/" in the first template with the root element, what is the reason behind it? Thanx in advance. Loke.
hi Loke Regarding ur first query i.e of xslt name space XSLT processors must use the XML namespaces mechanism [XML Names] to recognize elements and attributes from this namespace. Elements from the XSLT namespace are recognized only in the stylesheet not in the source document. Vendors must not extend the XSLT namespace with additional elements or attributes. Instead, any extension must be in a separate namespace. Any namespace that is used for additional instruction elements must be identified by means of the extension element mechanism. For example for java it is xmlns:java="http://xml.apache.org/xslt/java" I tried ur's second query and it gave me the perfect result. Bye Pankaj
If you don't mind me asking: which XSLT processor are you using? Version one of the XSLT specification specifies that the namespace URI should be "http://www.w3.org/1999/XSL/Transform". The namespace URI you have is quite old. For instance, the "wd" of the namespace you have means "working draft". XSLT is a full specification since November 1999. Actually, if you don't get anything from the XML document if you do not match "/" in one of the templates, then you are probably using one of the older Microsoft XSLT processors. For those processors, you must specify the default templates as well. That is why if you don't specify "/", you won't be able to process the root of the document (not to be confused with the root element of the document, "person" in your case). And of course, since everything is under the root element, you won't be able to process the rest of the document as well. My advice is to get a more up-to-date XSLT processor.