<a>
<xsl:attribute name="href">
<xsl:value-of select="/*/properties/property[@name='report']/@value" />
</xsl:attribute>
</a>
有没有什么办法cancat另一个字符串
<xsl:value-of select="/*/properties/property[@name='report']/@value" />
我需要通过一些文字href属性除了报告属性值
您可以使用名为CONCAT这里相当理智命名XPath函数
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat('myText:', /*/properties/property[@name='report']/@value)" />
</xsl:attribute>
</a>
当然,它并没有在这里是文字,也可以是另一个XPath表达式选择一个元素或属性。 你可以有任意数量的在CONCAT表达的论点。
待办事项,您可以使用属性值模板(用花括号表示)这里来简化你的表达
<a href="{concat('myText:', /*/properties/property[@name='report']/@value)}"></a>
三个答案:
很简单:
<img>
<xsl:attribute name="src">
<xsl:value-of select="//your/xquery/path"/>
<xsl:value-of select="'vmLogo.gif'"/>
</xsl:attribute>
</img>
使用 'CONCAT':
<img>
<xsl:attribute name="src">
<xsl:value-of select="concat(//your/xquery/path,'vmLogo.gif')"/>
</xsl:attribute>
</img>
快捷方式的属性通过@TimC的建议
<img src="{concat(//your/xquery/path,'vmLogo.gif')}" />
使用方法 :
<a href="wantedText{/*/properties/property[@name='report']/@value)}"></a>
到Concat的一个静态文本字符串添加到选定值的最简单方法是使用 元件。
<a>
<xsl:attribute name="href">
<xsl:value-of select="/*/properties/property[@name='report']/@value" />
<xsl:text>staticIconExample.png</xsl:text>
</xsl:attribute>
</a>
最简单的方法是
<TD>
<xsl:value-of select="concat(//author/first-name,' ',//author/last-name)"/>
</TD>
当XML结构
<title>The Confidence Man</title>
<author>
<first-name>Herman</first-name>
<last-name>Melville</last-name>
</author>
<price>11.99</price>
没有最可读的解决方案,但你可以从-价值的纯文本混合的结果:
<a>
<xsl:attribute name="href">
Text<xsl:value-of select="/*/properties/property[@name='report']/@value"/>Text
</xsl:attribute>
</a>