上面的注释已经建议处理默认命名空间
http://www.example.org
使用前缀或不使用前缀,但是如果输出XML中的元素需要与命名空间对应的前缀,则可以使用以下模板获取输出。
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ns0="http://www.example.org" >
<xsl:output method="xml" />
<xsl:strip-space elements="*" />
<xsl:template match="ns0:response_1">
<ns0:response_2>
<xsl:apply-templates />
</ns0:response_2>
</xsl:template>
<xsl:template match="ns0:configItem">
<ns0:lines>
<ns0:lineId><xsl:value-of select="ns0:lineId" /></ns0:lineId>
<ns0:item><xsl:value-of select="../ns0:item" /></ns0:item>
<ns0:configId><xsl:value-of select="ns0:configId" /></ns0:configId>
</ns0:lines>
</xsl:template>
<xsl:template match="ns0:lines[not(ns0:configItem)]">
<ns0:lines>
<ns0:lineId><xsl:value-of select="ns0:lineId" /></ns0:lineId>
<ns0:item><xsl:value-of select="ns0:item" /></ns0:item>
</ns0:lines>
</xsl:template>
<xsl:template match="ns0:lineId | ns0:item" />
</xsl:stylesheet>