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

Re: [xsl] Confirmimg - Bug in Accessing Global XSL Variables


Subject: Re: [xsl] Confirmimg - Bug in Accessing Global XSL Variables
From: "Karl Stubsjoen" <kstubs@xxxxxxxxx>
Date: Sun, 3 Sep 2006 20:16:31 -0700

I have again tested my code and it is still failing.   In short, I am
not able to override or call a template where the base template is 2
deep.  What could I possibly be doing wrong?  Again, I am testing this
with and without the namespace declerations and it works when there is
no namespace decleration!

Karl..

On 9/3/06, Karl Stubsjoen <kstubs@xxxxxxxxx> wrote:
Dimitre, I will see if I missed something or misrepresented the code I
have.  Indeed I have some sort of problem, it may be the implementer.

Karl..

On 9/3/06, Dimitre Novatchev <dnovatchev@xxxxxxxxx> wrote:
> I could not reproduce your claimed problems.
>
> With this files:
>
> base_template.xsl:
> ==============
> <xsl:stylesheet version="1.0"
>  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>  xmlns:wbt="myWebTemplater.1.0">
>
>       <!-- BASE TEMPLATE -->
>
>       <xsl:template name="wbt:A_Template">
>               BASE_TEMPLATE
>               A template in BASE
>       </xsl:template>
>
>       <xsl:template name="wbt:B_Template">
>               B_Template in BASE
>       </xsl:template>
> </xsl:stylesheet>
>
>
> master_template.xsl:
> ===============
> <xsl:stylesheet version="1.0"
>  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>  xmlns:wbt="myWebTemplater.1.0">
>
>       <!-- MASTER TEMPLATE -->
>
>       <!-- IMPORT BASE -->
>       <xsl:import href="base_template.xsl"/>
>
>
>       <!-- OVERRIDE A_Template -->
>       <xsl:template name="wbt:A_Template">
>               OVERRIDE! BASE_TEMPLATE
>
>               A template in MASTER
>       </xsl:template>
> </xsl:stylesheet>
>
> and
>
> page_template.xsl:
> ==============
> <xsl:stylesheet version="1.0"
>  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>  xmlns:wbt="myWebTemplater.1.0">
>
>       <!-- PAGE TEMPLATE -->
>
>       <!-- IMPORT MASTER TEMPLATES -->
>       <xsl:import href="master_template.xsl"/>
>
>
>
>       <!-- OVERRIDE A_Template -->
>       <!-- THIS FAILS TO OVERRIDE THE TEMPLATE -->
>       <xsl:template name="wbt:A_Template">
>               A template in PAGE
>       </xsl:template>
>
>       <xsl:template match="/">
>               <!-- THIS FAILS -->
>               <xsl:call-template name="wbt:B_Template"/>
>               <xsl:call-template name="wbt:A_Template"/>
>       </xsl:template>
>
> </xsl:stylesheet>
>
> when applying the stylesheet contained in page_template.xsl to any
> source xml (not used) file, I get the correct results:
>
> <?xml version="1.0" encoding="utf-8"?>
>               B_Template in BASE
>
>               A template in PAGE
>
>
> Anyone can do/verify this result using the XML Editor of VS 2005.
>
>
> --
> Cheers,
> Dimitre Novatchev
> ---------------------------------------
> Truly great madness cannot be achieved without significant intelligence.
> ---------------------------------------
> To invent, you need a good imagination and a pile of junk
>
>
>
> On 9/3/06, Karl Stubsjoen <kstubs@xxxxxxxxx> wrote:
> > Ok, lets give this a try.  There are 3 xslt document:
> >
> > 1) base_template.xsl
> > 2) master_template.xsl
> > 3) page_template.xsl
> >
> > Page_template Imports (inherits) master_template who imports base_template.
> >
> > The Code:
> > <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> >        xmlns:wbt="myWebTemplater.1.0">
> >
> >        <!-- BASE TEMPLATE -->
> >
> >        <xsl:template name="wbt:A_Template">
> >                BASE_TEMPLATE
> >        </xsl:template>
> >
> >        <xsl:template name="wbt:B_Template">
> >                B_Template in MASTER
> >        </xsl:template>
> >
> >
> > </xsl:stylesheet>
> >
> >
> > <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> >        xmlns:wbt="myWebTemplater.1.0">
> >
> >        <!-- MASTER TEMPLATE -->
> >
> >        <!-- IMPORT BASE -->
> >        <xsl:import href="base_template.xsl"/>
> >
> >
> >        <!-- OVERRIDE A_Template -->
> >        <xsl:template name="wbt:A_Template">
> >                OVERRIDE! BASE_TEMPLATE
> >        </xsl:template>
> >
> > </xsl:stylesheet>
> >
> >
> > <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> >        xmlns:wbt="myWebTemplater.1.0">
> >
> >        <!-- PAGE TEMPLATE -->
> >
> >        <!-- IMPORT MASTER TEMPLATES -->
> >        <xsl:import href="master_template.xsl"/>
> >
> >
> >
> >        <!-- OVERRIDE A_Template -->
> >        <!-- THIS FAILS TO OVERRIDE THE TEMPLATE -->
> >        <xsl:template name="wbt:A_Template">
> >                OVERRIDE! MASTER_TEMPLATE
> >        </xsl:template>
> >
> >        <xsl:template match="/">
> >                <!-- THIS FAILS -->
> >                <xsl:call-template name="wbt:B_Template"/>
> >        </xsl:template>
> >
> > </xsl:stylesheet>
> >
> >
> > On 9/3/06, Dimitre Novatchev <dnovatchev@xxxxxxxxx> wrote:
> > > On 9/3/06, Karl Stubsjoen <kstubs@xxxxxxxxx> wrote:
> > > > I hate to say this, but I still think there is a problem here.
> > > > Possibly I am doing something wrong so not real confident at the
> > > > moment.
> > > >
> > > > It appears that the global variable problem has been fixed in .NET 2.0
> > > > using the XslCompiledTransform Class.  However, what is not fixed is
> > > > the use of global templates.
> > > >
> > > > There does not appear to be a problem if the global template is named
> > > > without a namespace, but as soon as you introduce a namespace, the
> > > > call fails.
> > > >
> > > > There is not a problem if the template is defined in the immediate
> > > > imported base template, but when the defined template is 2 deep.
> > > >
> > > > Please confirm.
> > >
> > >
> > > Could you, please, provide an (the shortest possible but complete)
> > > example that demonstrates the problem you're having?
> > >
> > >
> > >
> > > --
> > > Cheers,
> > > Dimitre Novatchev
> > > ---------------------------------------
> > > Truly great madness cannot be achieved without significant intelligence.
> > > ---------------------------------------
> > > To invent, you need a good imagination and a pile of junk


Current Thread
Keywords