Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 9th, 2010, 04:59 PM
Authorized User
Points: 63, Level: 1
Points: 63, Level: 1 Points: 63, Level: 1 Points: 63, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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..
Reply With Quote
  #2 (permalink)  
Old June 9th, 2010, 06:56 PM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
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
Reply With Quote
  #3 (permalink)  
Old June 9th, 2010, 09:22 PM
Authorized User
Points: 63, Level: 1
Points: 63, Level: 1 Points: 63, Level: 1 Points: 63, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 05:56 PM.


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