Re: Unwanted xmlns attribute and how to put element name into element attribute

Martin Honnen <[email protected]> Tue, 26 May 2009 12:35:57 +0200
Newsgroups gmane.comp.mozilla.devel.layout.xslt
Organization Liberty Development
Message-ID <[email protected]>
Pavol Misik wrote:

> <xsl:stylesheet version="1.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="xml" indent="yes"/>
> 
> <xsl:template match="/">
>    <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
>    <window id="export-window" title="Example"
>            xmlns:html="http://www.w3.org/1999/xhtml"
> 
> xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

Move those namespace declarations to the xsl:stylesheet root element if 
you want them to be in scope for literal result elements in all templates:

   <xsl:stylesheet
     xmlns:xs="http://www.w3.org/1999/XSL/Transform"
     version="1.0"
     xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
     xmlns:html="http://www.w3.org/1999/xhtml">

That way you won't get those

>   <xsl:template match="node">
>     <treeitem>

xmlns="" later on here.


> 2. Does it exist way how to get name of element that match template and 
> use it in template? I want to do something like I highlighted by   >>> 
> and <<<. I want to put name of element to attribute value.
> 
>   <xsl:template match="applicationInfo">
>     <treeitem container="true" open="true">
>       <treerow>
>         <treecell label="  >>>applicationInfo<<<  "/>

           <treecell label="{name()}"/>

-- 

	Martin Honnen
	http://msmvps.com/blogs/martin_honnen/