特殊字符的转义问题--高分求助##

flyshp 2004-10-19 04:34:22
<xsl:variable name="fx_rate_format" select="'#,##0.0000#####'"/>

我想把上面的 "#,##0" 转义为"#'##0"
但是 ' 比较特殊 ! 我试过的好像无法转义 ?
其实这是一个 xsl 的样式模板的问题
我也试过用 $ 和 \' 都不行,正常下的转义还可以 ,但遇到了##0的格式化时 就出现了问题!
不知道 大家 有没有 什么好办法??
...全文
306 15 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
flyshp 2004-10-20
  • 打赏
  • 举报
回复
问题真这么 剌手么 ??????????

flyshp 2004-10-20
  • 打赏
  • 举报
回复
to drugon(personal) :

是啊,实在不行只能用 js 做初始化的 后触发控制了。也就是 在显示前
引发另一种 格式化的操作。
但是 相当麻烦,改动很大,也不太合理,不好控制!!
所以引用 公共的xsl 样式 格式化,就是类似于struts 中的自定义标签 设置的
自定义属性 一样,只要修改公共参数形式,就可以出发 所有应用控件的属性!!
flyshp 2004-10-20
  • 打赏
  • 举报
回复
放上几个xsl 文件 部分代码 大家可以看得更清晰些:

(1)这是页面生成控件的样式显示
<td id="lst_bid_rate">
<input id="marketFxBidRate" type="text" name="marketFxBidRate" style="width:90px" maxlength="{$fx_rate_length}" class="rightalign">
<xsl:attribute name="value">
<xsl:call-template name="format_fx_rate">
<xsl:with-param name="fx_rate" select="bidRate"/>
</xsl:call-template>
</xsl:attribute>
<xsl:attribute name="scale">
<xsl:call-template name="get_fx_rate_scale">
<xsl:with-param name="fx_rate" select="bidRate"/>
</xsl:call-template>
</xsl:attribute>
</input>
</td>

(2)这是针对上面value 属性格式化format_fx_rate的部分代码
*************************************
<xsl:template name="format_fx_rate">
<xsl:param name="fx_rate"/>
<xsl:call-template name="format_number">
<xsl:with-param name="number_val" select="$fx_rate"/>
<xsl:with-param name="number_fmt">
<xsl:call-template name="get_fx_rate_format">
<xsl:with-param name="fx_rate" select="$fx_rate"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
*************************************
<xsl:template name="get_fx_rate_format">
<xsl:param name="fx_rate"/>
<xsl:choose>
<xsl:when test="string(number($fx_rate)) = 'NaN'">
<xsl:value-of select="$fx_rate_format"/>
</xsl:when>
<xsl:when test="number($fx_rate) < 10">
<xsl:value-of select="$fx_rate_format"/>
</xsl:when>
<xsl:when test="number($fx_rate) < 100">
<xsl:value-of select="$fx_rate_format_3"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$fx_rate_format_2"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
*************************************
<xsl:variable name="fx_rate_format" select="'#,##0.0000#####'"/>
<xsl:variable name="fx_rate_format_3" select="'#,##0.000######'"/>
<xsl:variable name="fx_rate_format_2" select="'#,##0.00#######'"/>
yujiabian 2004-10-20
  • 打赏
  • 举报
回复
我不知道怎么解决,帮你顶了
drugon 2004-10-20
  • 打赏
  • 举报
回复
我也遇到过这样的情况,最后没办法解决,只好换了一种处理的方法。
flyshp 2004-10-20
  • 打赏
  • 举报
回复
******注意*******

1. 这是一个xml数据,通过xsl样式表 显示的问题,不是单纯的Html

2. 转义不是简单的通过\ 或 \\ 就可以实现的

3. 在基类的xml 解析过程中,' 这个特殊标记很难被正常解析!
成都清香白莲 2004-10-19
  • 打赏
  • 举报
回复
我也遇到过类似的问题,好像就是几个\的问题,楼主可以试一下,看看html代码
flyshp 2004-10-19
  • 打赏
  • 举报
回复
to jamesfancy()边城狂人(James Fancy)

不是在开玩笑吧!!
icewolf_li 2004-10-19
  • 打赏
  • 举报
回复
&apos;
边城狂人 2004-10-19
  • 打赏
  • 举报
回复
用两个'
flyshp 2004-10-19
  • 打赏
  • 举报
回复
不知道 哪位高手 有这方面的经验!!
flyshp 2004-10-19
  • 打赏
  • 举报
回复
用\\ ,',' 编译都过不去的!
galewithwing 2004-10-19
  • 打赏
  • 举报
回复
似乎用两个斜杠可以吧
以前好像用过 忘了
嘿嘿 不好意思
liuyonghailiuyong 2004-10-19
  • 打赏
  • 举报
回复
帮你顶!
flyshp 2004-10-19
  • 打赏
  • 举报
回复
顶!

81,122

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧