This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: xsl-call template problem


<xsl:template name="test" match='dxl:document[@form="frmTask"]'>
The named template doesnt have a match attribute .. and xsl:call-templates is used to call a named template.. match attribute is significant only when you call xsl:apply-templates

more explaination from Evan Lenz..

The only time the match attribute is ever significant is when
xsl:apply-templates is called (explicitly or from the built-in template
rules). The only time the name attribute is ever significant is when
xsl:call-template is called (only explicitly). The remaining attribute that
you can use is mode, which is only ever significant when there is a match
attribute (and when xsl:apply-templates is called).

In conclusion, named templates and template rules have orthogonal
functionality. No conflicts result from overloading a template for both. In
other words, adding a match attribute to a named template won't break
xsl:call-template, and adding a name attribute to a template rule won't
break xsl:apply-templates.

Hope this helps
Vasu



From: "Christer Nordvik" <christer.nordvik@trafsys.no>
Reply-To: xsl-list@lists.mulberrytech.com
To: <xsl-list@lists.mulberrytech.com>
Subject: [xsl] xsl-call template problem
Date: Wed, 14 Aug 2002 08:31:54 +0200

Hi.

I have a problem with <xsl:call-template>. When I use:

<xsl:template match='dxl:database'><xsl:text/>
 <xsl:element name='Message'> <xsl:text>
</xsl:text>
   <xsl:apply-templates/>
 </xsl:element>
</xsl:template>

<xsl:template name="test" match='dxl:document[@form="frmTask"]'>
 <xsl:element name="ContentProviderInfo">
   <xsl:value-of select='dxl:item[@name="ContentProviderInfo"]/dxl:text'
/>
 </xsl:element>
</xsl:template>

Everything works great, but if I want to use the call template tag like:

<xsl:template match='dxl:database'><xsl:text/>
 <xsl:element name='Message'>
   <xsl:call-template name = "test" />
 </xsl:element>
</xsl:template>

<xsl:template name="test" match='dxl:document[@form="frmTask"]'>
 <xsl:element name="ContentProviderInfo">
   <xsl:value-of select='dxl:item[@name="ContentProviderInfo"]/dxl:text'
/>
 </xsl:element>
</xsl:template>

Then it won't work(doesn't find the data). I know there is some
difference here in context node and nodelist from what I have been
reading, but I can't understand the difference. I haven't seen any
examples of xsl:call-template calling a template that iterates through
the current XML document.

Any help would be greatly appreciated!

Best Regards,
Christer Nordvik


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. http://www.hotmail.com


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]