如何使用xslt解码html字符串 [英] How to decode a html string using xslt

查看:70
本文介绍了如何使用xslt解码html字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用xslt来设置RSS源。我想要显示存储在Feed上标记中的图像。问题是编码在页面上显示为文本而不是呈现。以下是字符串部分的示例。



1)。 < description>& lt; img src =http& amp;#58;&#47;&#47; buavhw.blu.livefilestore.com&#47; y1ppCokLxFJSG2cmyPdvg ...



我不得不在上面的字符串中添加额外的编码,以便它在这里正确显示。下面的字符串是它直接粘贴到文本框时的显示方式。 < img src =http&#58;&#47;&#47; buavhw.blu.livefilestore.com& amp;#47;&#47;< ;#47; y1ppCokLxFJSG2cmyPdvg ...



如果我从预览窗口再次复制并粘贴它,它只会变成以下字符串。



<3>)。 < description>< img src =http://buavhw.blu.livefilestore.com/y1ppCokLxFJSG2cmyPdvg ...

解决方案

我建议你在xsl:value = of tag中使用especial属性,那就是
disable-output-escaping =yes
使用像这样:

 < xsl:value-of select =descriptiondisable-output-escaping =yes/> 


I am trying to style an rss feed using xslt. I want to display an image that is stored in the tag on the feed. The problem is it is encoded to display as text on the page instead of being rendered. The following is an example of part of the string.

1). <description>&lt;img src="http&amp;#58;&amp;#47;&amp;#47;buavhw.blu.livefilestore.com&amp;#47;y1ppCokLxFJSG2cmyPdvg...

I had to add extra coding to the string above to get it to appear properly here. The string below is how it appears when I paste it directly into the text box.

2). <description><img src="http&#58;&#47;&#47;buavhw.blu.livefilestore.com&#47;y1ppCokLxFJSG2cmyPdvg...

If I copy and paste it again from the preview window it only then becomes the following string.

3). <description><img src="http://buavhw.blu.livefilestore.com/y1ppCokLxFJSG2cmyPdvg...

解决方案

I'd suggest you to use an especial property in xsl:value=of tag and that is disable-output-escaping="yes" use like this:

<xsl:value-of select="description" disable-output-escaping="yes"/>

这篇关于如何使用xslt解码html字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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