我有这个代码:
<a>
<xsl:attribute name="href">
<xsl:value-of select="$foo"/>
</xsl:attribute>
bar
</a>
问题是转换后我得到:
<a href="
 PooValue 
" >bar</a>
我的 xsl:output 带有 indent="no"。
Visual Studio 缩进所有文件。因此,将代码放在一行中,但是
<a><xsl:attribute name="href"><xsl:value-of select="$foo"/></xsl:attribute>bar</a>
first 不是很可读,VS 会改变我的缩进,所以我想要另一个解决方案。有点儿 :
<xsl:attribute name="href" select="concat(mystuff)" />
但它不存在,也不再具有可读性。
其他解决方案可能是:
<a href="{$foo}" >bar</a>
但是,我如何使用下面的 xsl 处理:
<a>
<xsl:attribute name="href">
<xsl:choose >
<xsl:when test="$atest">
<xsl:value-of select="$foo"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$foo2"/>
</xsl:otherwise>
</xsl:choose >
</xsl:attribute>
bar
</a>
使用:
<xsl:value-of select="normalize-space($foo)"/>
将没有效果原因:在和


之间创建
<xsl:attribute name="href">
<xsl:value-of select="normalize-space($foo)"/>
我xslt 1.0
C# .net 4
一起工作XslCompiledTransform
更多细节:我把我的 XslCompiledTransform 的结果放在一个