xsl-list
[Top] [All Lists]

RE: apply-template doesn't hit template

2004-09-13 07:06:02
I think the problem is with:

<xsl:template select="kcm">

Surely the attribute should be 'match'...

R


Reuben Wright
Implementation Consultant

***********************************************
CSW Group Ltd
4240 Nash Court
Oxford Business Park South
Oxford
OX4 2RU
Tel: +44/0 1865 337400  Fax: +44/0 1865 337433
Web: <http://www.csw.co.uk>

Registered in England No. 4198197 

Legal Disclaimer: <http://www.csw.co.uk/disclaimer.htm>
***********************************************

 

-----Original Message-----
From: Michael Kay [mailto:mhk(_at_)mhk(_dot_)me(_dot_)uk] 
Sent: 13 September 2004 14:30
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] apply-template doesn't hit template

Sometimes when you can't find a bug, it's because you're 
looking in the wrong place. 

What makes you so sure your bug isn't in the bits of code you 
haven't shown us?

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

-----Original Message-----
From: Frans Englich [mailto:frans(_dot_)englich(_at_)telia(_dot_)com]
Sent: 13 September 2004 13:59
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] apply-template doesn't hit template


Hello all,

I have an embarrassing simple apply-templates/template 
problem. Here's 
my source document:

<kcmtests>

<kcm kcfg="true" [...]>
[...]
</kcm>

<kcm kcfg="false" [...]>
[...]
</kcm>

<kcm kcfg="false" [...]>
[...]
</kcm>

</kcmtests>

There's 21 kcm elements, all of them have "kcfg='true'".

<xsl:template select="kcm">
    <xsl:message>template hits</xsl:message>
    <!-- This message is never seen -->
</xsl:template>

<xsl:template match="/">
    <xsl:apply-templates select="//kcm[(_at_)kcfg='true']"/>
    <xsl:message>
            <xsl:value-of select="count(//kcm[(_at_)kcfg='true'])"/>
            <!-- This reports 0, which is correct -->
    </xsl:message>

    <xsl:apply-templates select="//kcm[(_at_)kcfg='false']"/>
    <xsl:message>
            <xsl:value-of select="count(//kcm[(_at_)kcfg='false'])"/>
            <!-- This reports 21, which is correct -->
    </xsl:message>
</xsl:template>


What I want to achieve is to in one place select entries(the root 
template), and then with the first template format them for 
representation -- but it doesn't hit. Instead, the selected 
items(the 
21 kcm) is printed right out in the output(their content, no 
elements).

I have two questions:

1. Why doesn't the template hit?

2. Why are the content simply sent to the output? Is it because I 
selected them, but no template matched?

The above XSL is that simple, I've commented out everything 
else for 
testing purposes.


Thanks in advance,

                    Frans







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