如何将字符串连接到 xsl:value-of select="...? [英] How to concat a string to xsl:value-of select="...?

查看:31
本文介绍了如何将字符串连接到 xsl:value-of select="...?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<a>
    <xsl:attribute name="href"> 
     <xsl:value-of select="/*/properties/property[@name='report']/@value" />
    </xsl:attribute>
</a>    

有没有办法把另一个字符串连接到

Is there any way to concat another string to

<xsl:value-of select="/*/properties/property[@name='report']/@value"  />

除了报告属性值外,我还需要将一些文本传递给 href 属性

I need to pass some text to href attribute in addition to the report property value

推荐答案

您可以在此处使用名为 concat 的命名相当合理的 xpath 函数

You can use the rather sensibly named xpath function called concat here

<a>
   <xsl:attribute name="href">
      <xsl:value-of select="concat('myText:', /*/properties/property[@name='report']/@value)" />
   </xsl:attribute>
</a>  

当然,这里不一定非得是文本,也可以是另一个xpath表达式来选择元素或属性.并且您可以在 concat 表达式中包含任意数量的参数.

Of course, it doesn't have to be text here, it can be another xpath expression to select an element or attribute. And you can have any number of arguments in the concat expression.

请注意,您可以在此处使用属性值模板(由大括号表示)来简化您的表达式

Do note, you can make use of Attribute Value Templates (represented by the curly braces) here to simplify your expression

<a href="{concat('myText:', /*/properties/property[@name='report']/@value)}"></a>

这篇关于如何将字符串连接到 xsl:value-of select="...?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆