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

Re: Trouble with namespaces and running identity trans

Subject: Re: Trouble with namespaces and running identity transform on XHTML
From: Kevin Jones <kjones@xxxxxxxxxxx>
Date: Wed, 10 Mar 2004 21:36:37 +0000
sablotron namespaces
> Having an explicitly declared namespace attribute in
> xsl:element works in xsltproc, Saxon, and Xalan, but
> not Sablotron, which outputs
>
> <ns_1:html xmlns:ns_1="http://www.w3.org/1999/xhtml">
> <ns_2:head xmlns:ns_2="http://www.w3.org/1999/xhtml">
> --snip--
> </ns_2:head>
> </ns_1:html>
>

On Sablotron you can get better output by including a prefix in 
the xsl:element name attribute. Like this,

<xsl:element name="{concat('h:',local-name())}"
	namespace="http://www.w3.org/1999/xhtml">
	<xsl:apply-templates select="@*|node()" />
</xsl:element>

The 'h' acts as a hint which the processor may ignore but 
Sablotron doesn't. This also avoids the multiple namespace 
declaration problem. Note that I have also changed name() to 
local-name(). I have not tested this with the other processors 
but I would doubt it will cause them any problems.

Kev.



 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.