xsl-list
[Top] [All Lists]

[xsl] How to remove the automatically generated empty namespace by xsl

2006-04-14 10:55:37
Hi , 

I am new to xslt, so my doubt might be naive. The problem i am facing is - when 
i try to use <xsl:element .. /> in main template it gets generated fine.
But when i call another template from this one and then use <xsl:element 
name="abc />, it generates <abc xmlns="">  .

Here is a sample xsl : (see the two abc tags)

<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
                xmlns:a="http://www.abcd.com/abCD";
                xmlns:fpml="http://www.fpml.org/2004/FpML-4-1";
                 exclude-result-prefixes="goml fpml map">
             <xsl:output method="xml" indent="yes"/>
                    
             <xsl:template match="/">
                <Tag1 xmlns="http://www.abc.com/wahtever";
                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
                        xsi:schemaLocation="http://www.abc.com/wahtever 
myschema.xsd">
                     <xsl:element name="abc" />                
                     <xsl:call-template name="tem1" />
                          
                </Tag1>
              </xsl:template>
    <xsl:template name="tem1">
        <xsl:element name="abc" /> 
    </xsl:template>
</xsl:stylesheet>


Output : 
<?xml version="1.0" encoding="UTF-8"?>
<Tag1 xmlns:a="http://www.abcd.com/abCD"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns="http://www.abc.com/wahtever"; 
xsi:schemaLocation="http://www.abc.com/wahtever myschema.xsd">
<abc/>
<abc xmlns=""/>
</Tag1                      

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>