Subject: RE: [xsl] apply-template doesn't hit template From: "Vasu Chakkera" <vasucv@xxxxxxxxxxx> Date: Mon, 13 Sep 2004 13:15:51 +0000 |
<xsl:template select="kcm"> <xsl:message>template hits</xsl:message> <!-- This message is never seen --> </xsl:template>
this should be <xsl:template match="kcm"> <xsl:message>template hits</xsl:message> <!-- This message is never seen --> </xsl:template>
I havent seen rest of your code. See if this works... Vasu
From: Frans Englich <frans.englich@xxxxxxxxx> Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] apply-template doesn't hit template Date: Mon, 13 Sep 2004 12:58:39 +0000
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[@kcfg='true']"/> <xsl:message> <xsl:value-of select="count(//kcm[@kcfg='true'])"/> <!-- This reports 0, which is correct --> </xsl:message>
<xsl:apply-templates select="//kcm[@kcfg='false']"/> <xsl:message> <xsl:value-of select="count(//kcm[@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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] apply-template doesn't hi, Michael Kay | Thread | Re: [xsl] apply-template doesn't hi, Frans Englich |
Re: [xsl] Name test, David Carlisle | Date | Re: [xsl] Namespace problem, Marc Schneider |
Month |