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 January 3rd, 2008, 06:02 PM
Authorized User
 
Join Date: Jun 2003
Location: Stockton, CA, USA.
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default Fundamental namespace problem?

In the .xml file, I declare:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="CatalogItem.xsl"?>
<catalogItem xmlns="http://www.fineHomemadeSoap.com/Catalog"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="
        http://www.fineHomemadeSoap.com/Catalog
        CatalogItem.xsd"
    >
    <sortProperty>Lavender</sortProperty>
...


When I do this, the CatalogItem.xsl file is not applied, and the .xml file's text is displayed in the browser, with all the tags stripped-out.

If I change the heading as follows, everything works properly:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="CatalogItem.xsl"?>
<catalogItem
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="
        http://www.fineHomemadeSoap.com/Catalog
        CatalogItem.xsd"
    >
    <sortProperty>Lavender</sortProperty>
...



Daniel Hutchins
Stockton, CA
http://www.finehomemadesoap.com
__________________
Daniel Hutchins
Stockton, CA
http://www.finehomemadesoap.com
Reply With Quote
  #2 (permalink)  
Old January 3rd, 2008, 06:40 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: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Please read the first "sticky" post in this forum, or google for "XSLT default namespace".

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote
  #3 (permalink)  
Old January 3rd, 2008, 08:20 PM
Authorized User
 
Join Date: Jun 2003
Location: Stockton, CA, USA.
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Michael Kay,
I have your book, "XSLT 2.0," 3rd Ed. I bought it to supplement my XML course. I also have "Beginning XML," 3rd, whereas I don't see your name on the authors. Your book helps tremendously. When I took the class, I got more out of your book (for one lesson) than the required textbook.

I understand the message of your post is to perform adequate research in advance before making a post. However, I assure you that I have many hours in this topic. I am on vacation, and for 4 days, this has been a major project. That's probably 30-40 hours. I wouldn't make this post if I didn't have a large amount of advance work involved.

There is something in the dynamics of transforming one .xml file into another, if a default namespace is named in the original document, and I don't understand why.

For 4 days, this has been bugging me. I don't like to make changes in a document without understanding.

Please don't get me wrong. I am very grateful for responses, and I would even be grateful for a reference to go read.

Interestingly, in your book, p.66, I see a default namespace is not defined in the source document.




Daniel Hutchins
Stockton, CA
http://www.finehomemadesoap.com
Reply With Quote
  #4 (permalink)  
Old January 3rd, 2008, 09:04 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: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

>I have your book, "XSLT 2.0," 3rd Ed.

Please see the discussion on pp442-444.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote
  #5 (permalink)  
Old January 6th, 2008, 06:24 AM
Authorized User
 
Join Date: Jun 2003
Location: Stockton, CA, USA.
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Mr. Kay,
Thank you very much for the reference.
My browser only honors XSLT 1.0, so I do not have xpath-default-namespace.

As an amend, I tried to figure out how to refer to a specific namespace node using xpath (an experiment all the way):

<xsl:value-of select="catalogItem/test"/>
or: <xsl:value-of select="cat:catalogItem/test"/> (ambiguous-should be an error)

, but I think it'll work if I have a null default namespace in the .xml source document.

I'll continue to investigate the XPath naming rules, in case I'm missing something.

Daniel Hutchins
Stockton, CA
http://www.finehomemadesoap.com
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
Something Fundamental Clem BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 5 November 24th, 2008 11:41 AM
Namespace problem Harshal123 BOOK: Beginning XML, 4th Ed ISBN: 978-0-470-11487-2 1 October 21st, 2008 06:35 AM
Namespace problem adwaitjoshi ASP.NET 2.0 Professional 0 March 28th, 2007 10:04 PM
namespace problem olambe BOOK: ASP.NET Website Programming Problem-Design-Solution 3 May 21st, 2004 12:08 PM
namespace problem marclena XSLT 1 February 12th, 2004 03:48 PM



All times are GMT -4. The time now is 06:21 PM.


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