[xsl] Trouble understanding the Test expression in xsl:if

Subject: [xsl] Trouble understanding the Test expression in xsl:if
From: Keith Gilbert <kgilbert@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 27 May 2009 14:28:05 -0500
I'm having trouble getting my head around this:

My shortened XML data:

<category>
	<category_name>apples</category_name>
	<product>red delicious</product>
</category>
	<category_name>oranges</category_name>
	<product>sunkist</product>
</category>

My simplified XSLT:

<xsl:template match="category">
	<xsl:apply=templates/>
</xsl:template>

<xsl:template match="category_name">
	<xsl:if test="category_name = apples">
		<xsl:call-template name=apple_template/>
	</xsl:if>
</xsl:template>


For the life of me I can't figure out how to evaluate the value of "category_name" in the xsl:if line. I understand (I think) how to use xsl:value-of, but that doesn't seem to work inside the xsl:if. Any thoughts?


~ Keith

Current Thread