Incremental computation needs complex algorithm design and tough software maintenance. A bidirectioanal analysis technique is proposed to implement XQuery incremental computation program automatic generation based on the syntax of XQuery language. It can implement program transformation by bottom-up upward modification propagation analysis and top-down downward structure analysis, generate incremental computation program code automatically in light of the input data modification of the computation to obtain new result. The execution performance of the incremental computation program is better than that of recomputation.