神刀安全网

Things XSLT can't do

>how to change variable values ?

No – this is not possible.

When XSL was being designed, this question came up frequently. It was decided that the advantages of having a side-effects free language (i.e. without the ability to change the value of variables once the stylesheet has gone through the parser) outweighed the annoyance of old school programmers (who are used to changing the value of variables).

[DC: a small clarification, xsl variables are not "compile time constants" they do not get their values at compile/parse time, as normally they get their values at the time a template is applied to a node in the source tree, at run time. But once bound, their value doesn’t change, and the scope of the binding does not extend beyond the current template.]

Basically, if you parse once and only once, and ban any changes to the stylesheet, you will get (in theory) much faster processing.

转载本站任何文章请注明:转载至神刀安全网,谢谢神刀安全网 » Things XSLT can't do

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址