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 May 14th, 2008, 10:48 AM
Friend of Wrox
 
Join Date: May 2004
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
 
Old May 14th, 2008, 10:53 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
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 -/
 
Old May 14th, 2008, 10:56 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
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
 
Old May 14th, 2008, 11:16 AM
Friend of Wrox
 
Join Date: May 2004
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





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





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