At 2007-06-12 13:14 -0500, Chaudhary, Harsh wrote:
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.
That's because you are asking it to be there.
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>
The element above is in no namespace.
</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/rateprocessingservi
ce/v3/somexsd.xsd">
The default namespace at this point is "somexmlns".
<xsl:call-template name="testTemplate"/>
When you are adding your <test> in no namespace, the xmlns="" is
required to indicate the new default namespace (that is, no
namespace) that you specified in your named template.
If you want <test> to be in "somexmlns" namespace, then do so in your
named template:
<test xmlns="somexmlns">This is a test</test>
- <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/rateprocessingservi
ce/v3/RPSRequest.xsd">
<test xmlns="">This is a test</test>
</request>
I would like to remove the xmlns attribute from the <test> element.
Then you want <test> to be in "somexmlns".
Would really appreciate some help on this.
I hope the above helps.
. . . . . . . . Ken
--
Upcoming hands-on training(Europe 2007): XSL-FO Jun 11; UBL Oct 01
World-wide corporate, govt. & user group XML, XSL and UBL training
RSS feeds: publicly-available developer resources and training
G. Ken Holman mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
Male Cancer Awareness Aug'05 http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
--~------------------------------------------------------------------
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>
--~--