使用xsl右对齐来自xml文件的数值数据 [英] right justify numeric data from xml file using xsl

查看:81
本文介绍了使用xsl右对齐来自xml文件的数值数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正面临着使用xsl对xml文件中的数值数据进行右对齐的问题。我尝试使用以下命令执行此操作:

concat(substring("",1,7 - string-length( BankSc / RvwScore ), BankSc / RvwScore

但是当它输出到浏览器时,白色空格被删除并且 所有的更改都消失了。
我尝试使用xml:space =" preserve"属性,但它不工作。
请建议一些......


i am facing a problem in right justifying numeric data from xml file by using xsl. i have tried doing it by using the following command:
     
  concat(substring("       ",1,7 - string-length(BankSc/RvwScore),BankSc/RvwScore)

But when it is output to the browser, the white spaces are removed and all the changes are gone.
I tried using xml:space="preserve" attribute too but it isnt working.
please suggest something......

推荐答案

您是否尝试过使用变量?

< xsl:variable name =" spaces">
< xsl:text xml:space =" preserve">< / xsl:text>
< / xsl:variable>

然后你可以像这样重新输入你的命令:
concat(substring(
Have you tried using a variable?

<xsl:variable name="spaces">
    <xsl:text xml:space="preserve">          </xsl:text>
</xsl:variable>

Then you can retype your command like this:
concat(substring(


空格,1,7 - 字符串长度(BankSc / RvwScore),BankSc / RvwSco重新

这对您有用吗?

BTW,您在进行XML到XML的翻译或XML到HTML吗? HTML不会在浏览器中保留空格。

-Chris
spaces,1,7 - string-length(BankSc/RvwScore),BankSc/RvwScore)

Does that work for you?

BTW, are you doing a XML to XML translation or XML to HTML? HTML will not preserve white space in the browser.

-Chris


这篇关于使用xsl右对齐来自xml文件的数值数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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