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 May 14th, 2008, 10:48 AM
Friend of Wrox
Points: 470, Level: 7
Points: 470, Level: 7 Points: 470, Level: 7 Points: 470, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2004
Location: Plano, TX, USA.
Posts: 109
Thanks: 18
Thanked 0 Times in 0 Posts
Default undeclare-namespaces directive

I'm using Saxon8B within the Oxygen XML IDE.
I'm also neck deep in having to deal with <!ENTITY ...> references because my XML source came from heavily SGML'd Framemaker, and they still use <!ENTITY ...> for referencing bitmaps.

So I'm using the saxon extensions for generating these items.

But the problem is that I've defined the namespaces for the saxon extensions and the dtd extensions and these namespaces are showing up in my result tree.

In "XSLT 2.0" on or about page 114 in Capter 3, section "Namespaces for a Literal Result Element" there is a note that one can use:

 
Quote:
quote:<xsl:output method="xml" version="1.1" undeclare-namespaces="yes"/>


and then use something like:

 
Quote:
quote:<img xmlns:saxon="" xmlns:dtd="" href="{unparsed-entity-uri(.)}"></img>


to remove these unwanted and unneeded namespaces in the result.

Problem is I'm getting an error:

 
Quote:
quote:Severity and Description Path Resource Location Creation Time Id
Quote:
[Saxon8B] Attribute @undeclare-namespaces is not allowed on element <xsl:output>
@see: http://www.w3.org/TR/xslt20/#err-XTSE0090
The w3c link confirms this to be a static error and further indicates to use exclude-result-prefixes attributes to stop the unwanted namespaces in the result tree.

However, I declared the extension namespaces on the global <xsl:stylesheet> element. I don't seem to be able to add the exclude-result-prefixes to the global element.

How else can I remove these unwanted namespaces from my result tree?


------------------------
GnuPG Key fingerprint = 1AD4 726D E359 A31D 05BF ACE5 CA93 7AD5 D8E3 A876

Michael Hare
__________________
------------------------
Keep Moving Forward

GnuPG Key fingerprint = 1AD4 726D E359 A31D 05BF ACE5 CA93 7AD5 D8E3 A876

Michael Hare
Reply With Quote
  #2 (permalink)  
Old May 14th, 2008, 10:53 AM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Why can't you use exclude-result-prefixes="saxon"? That should work fine.

Also try extension-element-prefixes="saxon".

Code:
<xsl:stylesheet extension-element-prefixes="saxon" exclude-result-prefixes="saxon">

/- Sam Judson : Wrox Technical Editor -/
Reply With Quote
  #3 (permalink)  
Old May 14th, 2008, 10:56 AM
mhkay's Avatar
Wrox Author
Points: 18,481, Level: 59
Points: 18,481, Level: 59 Points: 18,481, Level: 59 Points: 18,481, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,960
Thanks: 0
Thanked 292 Times in 287 Posts
Default

The attribute name on xsl:output changed from undeclare-namespaces to undeclare-prefixes in the final specification.

However, this attribute is quite irrevelant to your requirement.

You want something like this:

<xsl:stylesheet version="2.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:saxon="http://saxon.sf.net/"
  exclude-result-prefixes="xs saxon">

If you prefer to declare the namespaces locally you can also exclude them locally:

<img xmlns:saxon="http://saxon.sf.net/"
    xsl:exclude-result-prefixes="saxon" href="..."/>

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote
  #4 (permalink)  
Old May 14th, 2008, 11:16 AM
Friend of Wrox
Points: 470, Level: 7
Points: 470, Level: 7 Points: 470, Level: 7 Points: 470, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2004
Location: Plano, TX, USA.
Posts: 109
Thanks: 18
Thanked 0 Times in 0 Posts
Default

I must have entered the attribute wrong, because I did try it and got a parsing error.

I tried again and it works just fine .. Thanks!


------------------------
GnuPG Key fingerprint = 1AD4 726D E359 A31D 05BF ACE5 CA93 7AD5 D8E3 A876

Michael Hare
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
missing a using directive or an assembly reference zhshqzyc ASP.NET 2.0 Basics 3 January 13th, 2008 03:50 AM
ErrorPage in Page Directive balesh.mind ASP.NET 2.0 Professional 1 August 10th, 2007 09:14 AM
Regex within a DirectoryMatch Directive someUser BOOK: Beginning Regular Expressions 1 June 6th, 2006 04:53 AM
Parser Error with Control Directive kasie .NET Web Services 0 July 24th, 2003 03:03 PM
#exec server directive vitanza BOOK: Beginning ASP 3.0 1 July 11th, 2003 09:33 AM



All times are GMT -4. The time now is 05:28 AM.


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