xsl-list
[Top] [All Lists]

RE: [xsl] How to remove "xmlns" attribute when calling a named template

2007-06-12 12:08:15
Thanks a lot...that helped me out.

Harsh

-----Original Message-----
From: Michael Kay [mailto:mike(_at_)saxonica(_dot_)com] 
Sent: Tuesday, June 12, 2007 1:45 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] How to remove "xmlns" attribute when calling a named
template


If you put the test element in the same namespace as its parent, then
the
xmlns="" will not appear. It's there because you asked for the test
element
to be in no namespace.

Either write

<test xmlns="http://www.amfam.com/xsd/message/rateprocessingservice/v3";>

in your stylesheet, or move the default namespace declaration up to the
xsl:stylesheet level.

Michael Kay
http://www.saxonica.com/

-----Original Message-----
From: Chaudhary, Harsh [mailto:HCHAUDHA(_at_)amfam(_dot_)com] 
Sent: 12 June 2007 19:14
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] How to remove "xmlns" attribute when calling a 
named template

Hi all,
 
I am calling a named template in my XSL file. It works well 
except for that there always appears an xmlns="" attribute in 
the output. Here are my snippets:
 
XSL file:
 
<?xml version="1.0" encoding="UTF-8"?>
 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
 
    <xsl:template name="testTemplate">
        
        <test>This is a test</test>        
        
    </xsl:template>
    <xsl:template match="/">
 

        <request   
            xmlns="somexmlns" 
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
 
xsi:schemaLocation="http://www.amfam.com/xsd/message/rateproce
ssingservi
ce/v3/somexsd.xsd">
            
            <xsl:call-template name="testTemplate"/> 
</request> </xsl:template> </xsl:stylesheet>
 
OUTPUT:
 
  <?xml version="1.0" encoding="UTF-8" ?>
- <request
xmlns="http://www.amfam.com/xsd/message/rateprocessingservice/v3";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://www.amfam.com/xsd/message/rateproce
ssingservi
ce/v3/RPSRequest.xsd">
  <test xmlns="">This is a test</test>
  </request>
 
I would like to remove the xmlns attribute from the <test> element.
Would really appreciate some help on this.
 
Thanks,
Harsh.

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



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

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