Is there anyway to output a "backspace" character in XSLT?
Like right now the current output is abc
and i would like to o开发者_JS百科utput a backspace character such that the output reduces by 1 and becomes ab
.
Ok I know it probably goes against good coding practice. But i just need it as a quick and dirty hack to solve some issue. I am aware that i could achieve that effect by changing the structure of the program such that the last character c
never gets output at all (so we do not have to backspace it) but there, I need it right now, the fast and dirty.
If you do, you'll get abc
, not ab
.
Do <xsl:value-of select="substring($text, 1, string-length($text)-1)" />
where $text
is abc
in your case; substitute it for whatever holds the text.
You can't emit a backspace character - it's probably worth taking a look at the substring()
and string-length()
functions instead
精彩评论