I have an XML source and from where I fetch one of the element value using XSL file. But the problem I am facing is that, instead of getting only one value from the source XML, I am getting the valus of all the elements in the source XML. If I remove the 'namespace' attribute in the document element of the source XML, I am getting the value correctly. Could someone pls help me why it is happening so? XML file <HR> <?xml version="1.0"?> <GetArticle xmlns="com:test eveloper" xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" version="1.0" xml:lang="en"> <Control> <SessionID>WlpaWlpaaMjAwMTE </SessionID> </Control>
Fiz, Let me try to help you. I can see the problem with your XML file and XSL file. All the elements in your source XML file is in �com:test: developer� namespace. While in your XSL file all the �xsl:template� looking for an element in source document which is not in any anmespace and it does not find any element in source document which is not in any namespace. All the defaults templates will be executed in this case and this is how you are getting all the value. Once you remove the namespace declaration from source file then all the elements in source XML file do not belongs to any namespace and the templates in XSL documents get executed.
If you do following change in your source XSL file then you will get desired results.
I am assuming that the namespace string in source document is �com:test: developer�, in case if it is different then change it accordingly in above XSL file. I hope this make things clear to you. Thanks [ March 19, 2003: Message edited by: Vivek Saxena ]
posted 17 years ago
I got it. Thanks Vivek...
Heroic work plunger man. Please allow me to introduce you to this tiny ad: