xsl解析xml时的执行步骤?

shinian1007 shinian1007 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
<?xml version="1.0" encoding="UTF-8"?>
<root>
<ABC>/a/aa/aaa/aaaa</ABC>
<ABC>/b/bb</ABC>
</root>

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:for-each select="//ABC">
<xsl:call-template name="split">
<xsl:with-param name="str" select="."/>
<xsl:with-param name="op">/</xsl:with-param>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<xsl:template name="split">
<xsl:param name="str"/>
<xsl:param name="op"/>
<xsl:choose>
<xsl:when test="contains($str,$op)">
<xsl:variable name="str1" select="substring-after($str,$op)"/>
<xsl:if test="not(starts-with($str,$op))">
<xsl:variable name="str2" select="substring-before($str,$op)"/>
<xsl:value-of select="$str2"/><br/>
</xsl:if>
<xsl:call-template name="split">
<xsl:with-param name="str" select="$str1"/>
<xsl:with-param name="op" select="$op"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$str"/><br/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

这个可以以/为界限,使得数据换行,谁能告诉我执行步骤啊?谢谢
...全文

相关推荐

评论 1
收藏 已收藏
分享
返回顶部
shinian1007
XML/XSL 8,906 成员 22,677 内容