xsl如何实现递归复制?

    <xsl:template match="*" mode="addSeatSelectionToAirProduct">
        <xsl:element name="{local-name()}">
            <xsl:apply-templates select="@*" mode="addSeatSelectionToAirProduct"/>
            <xsl:apply-templates select="*|text()" mode="addSeatSelectionToAirProduct"/>
        </xsl:element>
    </xsl:template>
    
    <xsl:template match="@*" mode="addSeatSelectionToAirProduct">
        <xsl:copy/>
    </xsl:template>

其中<xsl:apply-templates select="*|text()" mode="addSeatSelectionToAirProduct"/>

里面的|表示匹配多种类型,*表示匹配当前元素节点、匹配当前属性、匹配子节点、匹配后代节点,text()表示匹配文本类型。

但是有个问题,最后文本节点是怎么实现copy的呢?并没有写

<xsl:template match="text()" mode="addSeatSelectionToAirProduct">
        <xsl:copy/>
</xsl:template>
posted on 2018-01-22 11:38  坚守梦想  阅读(491)  评论(0编辑  收藏  举报