小编ele*_*low的帖子

在foreach循环中构建XSLT字符串(变量)

我面临的问题似乎很简单,但在XSL的所有内容中都是新手- 我还没有找到合适的解决方案.我想要做的是通过连接foreach元素循环的结果来构建一个字符串,以后我可以将其用作HTML元素属性的值.

鉴于:

<?xml version="1.0" encoding="ISO-8859-1"?>
<catalog>
    <cd>
        <country>UK</country>
        <company>CBS Records</company>
    </cd>
    <cd>
        <country>USA</country>
        <company>RCA</company>
    </cd>
    <cd>
        <country>UK</country>
        <company>Virgin records</company>
    </cd>
</catalog>
Run Code Online (Sandbox Code Playgroud)

期望的输出: CBS;RCA;Virgin records

我需要一个有效的XSLT代码部分,它将以上述方式执行此转换.我相信我需要一个xsl-variable来保存连接结果<company>和分隔符;.如何才能做到这一点?谢谢.

html xml xslt variables

13
推荐指数
2
解决办法
2万
查看次数

标签 统计

html ×1

variables ×1

xml ×1

xslt ×1