如何在XSLT HREF属性中显示特殊字符
我想在XSLT表中显示一个链接,该链接与Frensh特殊特征有关: 该链接由以下动态组成:https://website.com/sites/the_name_of_attachment_in_xml
XSLT链接:
<a><xsl:attribute name="href">https://website.com/sites/<xsl:value-of select="Attachments" disable-output-escaping="yes"/></xsl:attribute>
<xsl:value-of select="Attachments" disable-output-escaping="yes"/>
</a>
html结果是:
<a href="https://website.com/sites/ExampleName.pdf">ExampleName.pdf</a>
问题是:何时引入了引入的名称extient Special optiment特殊特征。 例如:pr é
sendation, 链接将是:
<a href="https://website.com/sites/Pr&#233;sentation.pdf">Présentation.pdf</a>
链接中的“é”
字符被“&amp; amp;#233;”
i
i使用disable> disable-output-escaping = = “是的
要显示正确的字符,它仅适用于 &lt; xsl:select select =“ artivements” disable-output-eScaping =“ yes”/&gt; 但是我没有在HREF属性中使用,我看到了其他解决方案,这些解决方案告诉XSLT代码更改
&lt; XSL:输出方法=“ html” /&gt; < /code> to
&lt; xsl:utput:output:utput method =“ xhtml” /&gt; < /code>,但它不起作用,我会出现错误。
我想要的结果是:
<a href="https://website.com/sites/Présentation.pdf">Présentation.pdf</a>
如何使用XSLT显示使用特殊字符的校正链接?
这是XSLT代码:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" />
<xsl:template match="/">
<table id="tableRepeat" border="1" width="100%" style="border-collapse:collapse;color:black;font-size:100%;font-family:arial,helvetica,sans-serif;">
<thead>
<tr>
<td>Attachments</td>
</tr>
</thead>
<tbody>
<xsl:for-each select="//Items/Item">
<tr>
<td>
<!-- this is how i display my link -->
<a>
<xsl:attribute name="href">https://website.com/sites/<xsl:value-of select="Attachments" disable-output-escaping="yes"/>
</xsl:attribute>
<xsl:value-of select="Attachments" disable-output-escaping="yes"/>
</a>
<!-- end: this is how i display my link -->
</td>
</tr>
</xsl:for-each>
</tbody>
</table>
</xsl:template>
</xsl:stylesheet>
因为我没有得到正确的URL,所以它显示了我在此
equestUrl=https://website.com/sites/training/Lists/.../pr%26
pr%26
中找不到的页面,它在这里停止
i want to display a link in xslt table that contient frensh special charactres:
the link is dynamic composed from : https://website.com/sites/the_name_of_attachment_in_xml
the xslt link:
<a><xsl:attribute name="href">https://website.com/sites/<xsl:value-of select="Attachments" disable-output-escaping="yes"/></xsl:attribute>
<xsl:value-of select="Attachments" disable-output-escaping="yes"/>
</a>
the html result is:
<a href="https://website.com/sites/ExampleName.pdf">ExampleName.pdf</a>
the issue is when the introduced name contient special charactere
for example : pré
sentation,
the link will be:
<a href="https://website.com/sites/Présentation.pdf">Présentation.pdf</a>
the "é"
charactere in the link is replaced by "é"
i used disable-output-escaping="yes
to display correct charactere it worked just for
<xsl:value-of select="Attachments" disable-output-escaping="yes"/>
but didn't work in href attribute, i see other solution that tell to change in xslt code the
<xsl:output method="html" />
to <xsl:output method="xhtml" />
, but it didn't work form me i get error.
the result i want is:
<a href="https://website.com/sites/Présentation.pdf">Présentation.pdf</a>
How can i display the correcte link with special charactere using xslt?
this is xslt code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" />
<xsl:template match="/">
<table id="tableRepeat" border="1" width="100%" style="border-collapse:collapse;color:black;font-size:100%;font-family:arial,helvetica,sans-serif;">
<thead>
<tr>
<td>Attachments</td>
</tr>
</thead>
<tbody>
<xsl:for-each select="//Items/Item">
<tr>
<td>
<!-- this is how i display my link -->
<a>
<xsl:attribute name="href">https://website.com/sites/<xsl:value-of select="Attachments" disable-output-escaping="yes"/>
</xsl:attribute>
<xsl:value-of select="Attachments" disable-output-escaping="yes"/>
</a>
<!-- end: this is how i display my link -->
</td>
</tr>
</xsl:for-each>
</tbody>
</table>
</xsl:template>
</xsl:stylesheet>
because i didn't get the right url, it shows me page not found with this
equestUrl=https://website.com/sites/training/Lists/.../pr%26
pr%26
it stop here
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论