Subject: RE: [xsl] How to remove the automatically generated empty namespace by xsl From: "mike@xxxxxxxxxxxx" <mike@xxxxxxxxxxxx> Date: Fri, 14 Apr 2006 16:31:25 -0400 |
The thing to remember is that you control which namespace the element goes in, and the XSLT processor then decides what namespace declarations to emit to make this happen. If you say <xsl:element name="x"/> without specifying the namespace attribute, then you are asking for the element to go in the "null namespace", and the xmlns="" is added to achieve this. If you want the element to be in the same namespace as its parent element in the result tree then you need to specify this explicitly using the namespace attribute of xsl:element. Michael Kay http://www.saxonica.com/ Original Message: ----------------- From: Ramakant Akhairamka rakhaira@xxxxxxxxxxx Date: Fri, 14 Apr 2006 20:50:12 +0530 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] How to remove the automatically generated empty namespace by xsl 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 -------------------------------------------------------------------- mail2web - Check your email from the web at http://mail2web.com/ .
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] How to remove the automat, G. Ken Holman | Thread | [xsl] Can we have a <xsl:attribute>, bharathi kongara |
Re: [xsl] How to remove the automat, G. Ken Holman | Date | RE: [xsl] Re: xsl:choose and multip, mike@xxxxxxxxxxxx |
Month |