[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: apply-template doesn't hit template

Subject: RE: apply-template doesn't hit template
From: "Vasu Chakkera" <vasucv@xxxxxxxxxxx>
Date: Mon, 13 Sep 2004 13:15:51 +0000
xsl apply template namespace

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

watch out the above construct. xsl template doesnt have a select attribute...

this should be
<xsl:template match="kcm">
	<xsl:message>template hits</xsl:message>
	<!-- This message is never seen -->

( I can imagine you kicking yourself )

I havent seen rest of your code. See if this works...

From: Frans Englich <frans.englich@xxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  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:


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

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

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


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 match="/">
	<xsl:apply-templates select="//kcm[@kcfg='true']"/>
		<xsl:value-of select="count(//kcm[@kcfg='true'])"/>
		<!-- This reports 0, which is correct -->

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

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

Thanks in advance,


Use MSN Messenger to send music and pics to your friends http://www.msn.co.uk/messenger

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.