[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: xslt2 - namespace attributes for output from calle

Subject: RE: xslt2 - namespace attributes for output from called templates
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Fri, 22 Aug 2003 15:16:15 +0100
xslt namespace attribute
I don't think there's anything specific to XSLT 2.0 here.

If the outermost element in your result tree has:

prefix="", localname="xxx", uri="some.uri"

and you then generate a child element that has:

prefix="", localname="yyy", uri=""

then the serializer has to insert an xmlns="" undeclaration to ensure
that the yyy element is in the null namespace.

If you think the xmlns="" undeclaration is wrong, then you've probably
been putting your elements in the wrong namespace. Perhaps you wanted
"yyy" to have namespace URI "some.uri"? In that case, you need to
correct the code that generates it.

When you output an element, the namespace it goes in is determined by
the instructions in the stylesheet that produce this element. It doesn't
automatically (or even by default) go in the same namespace as its
parent in the result tree.

Michael Kay

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Tom Schutzer-Weissmann
> Sent: 22 August 2003 13:57
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  xslt2 - namespace attributes for output from 
> called templates
> 
> 
> Hello All,
> 
> I'm using Saxon 7 and xsl 2 to create web pages, and I 
> noticed that some of 
> the output was decorated with 'xmlns=""' and some of it wasn't.
> 
> It turns out that if I specify a namespace to the top level 
> tag of my output, 
> eg
> <html xmlns="http://www.w3.org/1999/xhtml">
> then output that comes from functions, called templates, 
> copies of variables 
> etc., 
> will contain an empty namespace attribute.
> 
> Of course, my mistake was to specify the namespace in the 
> first place. With 
> <xsl:output method="html">, it will be inserted for me, and no empty 
> namespace attributes will appear.
> 
> But if I wasn't making html, then I could have this problem. 
> Would every 
> function, called template etc. have to re-specify the 
> namespace attribute?
> 
> Thanks for your help,
> 
> Tom SW
> ~ceci n'est pas un sig~
> 
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.