[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: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Fri, 22 Aug 2003 14:30:14 +0100
xsl attributes
Hi Tom,

> 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?

If you want a literal result element to be in the namespace
'http://www.w3.org/1999/xhtml' then it has to be associated with that
namespace. If you don't want the element to have a prefix, then the
'http://www.w3.org/1999/xhtml' namespace has to be in-scope as the
default namespace.

Namespaces are in-scope on the element that they're declared, and on
all the descendants of that element. So the usual way in which you
guarantee that all the elements you generate in the stylesheet are in
a particular default namespace is to declare that namespace as the
default on the <xsl:stylesheet> element.

So rather than:

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
  <html xmlns="http://www.w3.org/1999/xhtml">
    ...
  </html>
</xsl:template>

...lots of other templates in which the default namespace is no
namespace...
                
</xsl:stylesheet>

you should use:

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns="http://www.w3.org/1999/xhtml">

<xsl:template match="/">
  <html>
    ...
  </html>
</xsl:template>

...lots of other templates in which the default namespace is the XHTML
namespace...
                
</xsl:stylesheet>

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 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.