Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 9th, 2010, 04:59 PM
Authorized User
 
Join Date: Mar 2009
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default I used default namespace in my stylesheet but root element is not firing

I have the below xml and would like to retrieve its element value without using prefix. I included the default namespace in my xml in the stylesheet but cannot get the root element (Bird) to fire. I even try giving the namespace a name and use prefix to template match the node but it didn’t work. I am getting all text as output. When I remove the default namespace from the input file, it works. I read some of the post on default namespace but didn’t help.
Any suggestions or previous post that would point me to what I need to do will be greatly appreciated.

Last edited by smandeh; June 9th, 2010 at 05:02 PM..
 
Old June 9th, 2010, 06:56 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You need to declare the namespace in the stylesheet with a prefix, and to use this prefix whenever you refer to an element in this namespace in a match pattern or XPath expression.

If you did this and it didn't work, you need to tell us exactly what you did, because you did it wrong.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
 
Old June 9th, 2010, 09:22 PM
Authorized User
 
Join Date: Mar 2009
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, Kay. I took care of this already. What I was doing wrong was not using the prefix to refer to an element. I am doing that now so it is working properly.





Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the best approch to find root element ? nisargmca XSLT 5 March 11th, 2010 07:25 AM
Remove Namespace from root tag using xslt namespce prefix nisargmca XSLT 0 February 24th, 2010 01:08 AM
Chapter 7 re hiding root element in TreeView control stephjnca BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 May 27th, 2009 02:26 PM
Remove root namespace help? JohnBampton XSLT 2 March 6th, 2009 06:49 AM
root element missing Kross Classic ASP Basics 1 February 5th, 2007 08:16 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.