I want to use the select function on apply-templates in order to do some search. When there is a record found match the Select pattern, how can I determine which template (name) the apply-templates will call to display the data with HTML code in it? Is there something like call-template which you can give the name of template to call? Regards,
guoqi zheng wrote: > I want to use the select function on apply-templates in order to do some > search. > > When there is a record found match the Select pattern, how can I determine > which template (name) the apply-templates will call to display the data with > HTML code in it? > > Is there something like call-template which you can give the name of > template to call? I don't understand what you are looking for. XSLT has two instructions, one is xsl:apply-templates which looks for a matching template, one is xsl:call-template which calls a template by its name. Those two instructions serve a different purpose. -- Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/
"guoqi zheng" wrote in message news:%23163zs$YIHA.5028@TK2MSFTNGP04.phx.gbl... > I want to use the select function on apply-templates in order to do some > search. > > When there is a record found match the Select pattern, how can I determine > which template (name) the apply-templates will call to display the data with > HTML code in it? > > Is there something like call-template which you can give the name of > template to call? > Normally the select path would select nodes that all have a specific name. So typically you would use:- <xsl:template match="nameOfTag"> . . . </xsl:template> If the path selects nodes with a variety of names, or you already have templates mathing the 'nameOfTag' for other reasons, you can use the mode attribute:- <xsl:apply-templates select="myPath" mode="myMode" /> . . . <xsl:template match="*" mode="myMode"> . . . </xsl:template> In this case only templates have the myMode mode value will be considered hence your match can be a loose as * and yet only used for the specific invocation to apply-templates. -- Anthony Jones - MVP ASP/ASP.NET
I think I figure it out now. 1. call-template will excute the name of the called template. 2. apply-templates will re-search for the right matching template using current selected node. "Martin Honnen" wrote in message news:uEfHlyAZIHA.4028@TK2MSFTNGP06.phx.gbl... > guoqi zheng wrote: >> I want to use the select function on apply-templates in order to do some >> search. >> >> When there is a record found match the Select pattern, how can I >> determine which template (name) the apply-templates will call to display >> the data with HTML code in it? >> >> Is there something like call-template which you can give the name of >> template to call? > > I don't understand what you are looking for. XSLT has two instructions, > one is xsl:apply-templates which looks for a matching template, one is > xsl:call-template which calls a template by its name. Those two > instructions serve a different purpose. > > > -- > > Martin Honnen --- MVP XML > http://JavaScript.FAQTs.com/