Performance: call-template vs apply-template

后端 未结 3 605
闹比i
闹比i 2021-01-31 03:24

in XSLT processing, is there a performance difference between apply-template and call-template? In my stylesheets there are many instances where I can use either, which is the b

3条回答
  •  不思量自难忘°
    2021-01-31 03:56

    apply-template and call-template do not perform the same task, performance comparison is not really relevant here. call-template takes a template name as a parameter whereas apply-template takes an xpath expression. Apply-template is therefore much more powerful since you do not really know which template will be executed. You will get performance issues if you use complex xpath expressions. Avoid "//" in your xpath expressions since every node of your input document will be evaluated.

提交回复
热议问题