What concept am I missing that I'm not getting what I'm expecting? Also, why would @field be blank (not showing 'location') when matching the 2nd time around?
xsl
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="text"/>
<!-- sample XSLT snippet -->
<xsl:template match="xml">
<xsl:apply-templates select="*" />
<!-- three nodes selected here -->
<xsl:call-template name="rshandle" />
</xsl:template>
<xsl:template match="foo">
<!-- will be called once -->
<xsl:text>
foo element encountered
</xsl:text>
</xsl:template>
<xsl:template match="*">
<!-- will be called twice -->
<xsl:text>
other element ecountered
</xsl:text>
</xsl:template>
<xsl:template name="rshandle" match="foo">
<!-- will be called once -->
<xsl:value-of select="@field" />
<xsl:text>
oops i did it again!
</xsl:text>
</xsl:template>
</xsl:stylesheet>
xml
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="calltemplatematch.xslt"?>
<!-- sample XML snippet -->
<xml>
<foo field="location"/>
<bar />
<baz />
</xml>
expecting
other element ecountered
other element ecountered
location
oops i did it again!
actual
location
oops i did it again!
other element ecountered
other element ecountered
oops i did it again!