Apache VTL(Velocity Template Language)是 Velocity 模板语言的一种变体,用于 Apache Velocity 引擎中。其中,'Copy node”是指函数节点,用于复制节点。具体解决方法如下:
#macro(copyNode $node) #foreach($child in $node.children) $child.copy() #if($child.children.size() > 0) #copyNode($child) #end #end #end
#foreach($node in $root.children) $node.copy() // 复制节点本身 #if($node.children.size() > 0) // 判断是否有子节点 #copyNode($node) // 复制子节点 #end #end
以上就是'Apache VTL - Copy node