This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: problems with match
- From: "Michael Kay" <michael dot h dot kay at ntlworld dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Thu, 25 Jul 2002 14:19:04 +0100
- Subject: RE: [xsl] problems with match
- Reply-to: xsl-list at lists dot mulberrytech dot com
> Why does this not work?
>
> <xsl:template match="/">
> the main body
> <xsl:call-template name="title"/>
> </xsl:template>
>
> <xsl:template name="title" match="/root/output">
> <b>Auftrag #<xsl:value-of select="data/ordernr" /> (<xsl:value-of
> select="data/shopname" />) </b>
> </xsl:template>
>
> I mean the template name=title -> last section
>
> Why must I apply the value-of select like this, although I
> have a "match" in the <xsl:template name="title" - tag?:
You have written a template that can be called either by name, or by
match. When you call it by name, there is no guarantee that the context
node will match the match pattern. In fact, the context node is
unchanged, it is the root node, so data/shopname finds nothing.
Michael Kay
Software AG
home: Michael.H.Kay@ntlworld.com
work: Michael.Kay@softwareag.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list