[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] xsl:call-template , strange behaviour


Subject: Re: [xsl] xsl:call-template , strange behaviour
From: Colin Paul Adams <colin@xxxxxxxxxxxxxxxxxx>
Date: 06 Jun 2005 05:23:58 +0100

>>>>> "Mukul" == Mukul Gandhi <mukul_gandhi@xxxxxxxxx> writes:

    Mukul> I have written this stylesheet - <?xml version="1.0"?>
    Mukul> <xsl:stylesheet
    Mukul> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    Mukul> xmlns:temp="http://whatever" version="2.0">
 
    Mukul>  <xsl:output method="xml" indent="yes" />

    Mukul>  <xsl:template match="/"> <xsl:call-template name="test" />
    Mukul> <xsl:call-template name="temp:test" /> </xsl:template>

    Mukul>  <xsl:template name="test"> <a/> </xsl:template>
 
    Mukul>  <xsl:template name="temp:test"> <b/> </xsl:template>
 
    Mukul> </xsl:stylesheet>

    Mukul> With both Xalan-J 2.6 and Saxon 8.4, I get the output -
    Mukul> <?xml version="1.0" encoding="utf-8"?> <a
    Mukul> xmlns:temp="http://whatever"/> <b
    Mukul> xmlns:temp="http://whatever"/>

    Mukul> I am curious, why element <a> gets associated with the
    Mukul> namespace 'temp' ..?

This is basic XML namespaces - you declared a default namespace on the
document element (here xsl:stylesheet), and then you wrote an element
without a namespace ( <a/> ), so it is in the default namespace.
-- 
Colin Adams
Preston Lancashire


Current Thread
Keywords
xml