XML containing link throws error in Visual Studio when running XSLT Debugger

有些话、适合烂在心里 提交于 2020-01-15 11:26:08

问题


I'm an XSLT noob, so my apologies if there is an obvious answer to the following question. I'm working on a stylesheet. The xml to which I'd like to apply it contains links. These throw errors in the VS XML debugger and seem to keep the XML transform from happening correctly in browsers. Can someone please tell me what I'm doing wrong?

Here is the XML:

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Some title</title>
    <description>a link should be here</description>
  </channel>
</rss>

When I replace "a link should be here" with a URL, I see the issue.

For XSLT content, anything gets the point across, such as the following from the w3schools site:

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Edited by XMLSpy® -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
  <body>
    <h2>My CD Collection</h2>
    <table border="1">
      <tr bgcolor="#9acd32">
        <th>Title</th>
        <th>Artist</th>
      </tr>
      <tr>
        <td>.</td>
        <td>.</td>
      </tr>
    </table>
  </body>
</html>
</xsl:template>
</xsl:stylesheet>

Thanks in advance for any help.


回答1:


I've seen xml get tricked up with URLs that have "&" in them. XML wants it to be & followed by amp; and not just &. Strict parsers will crap out when trying to parse it.

Example:

&

would be replaced with

&amp;



回答2:


XML is tricky.

Make sure all brackets are closed, also make sure your special characters in the URL such as & it converted into &amp;



来源:https://stackoverflow.com/questions/26150333/xml-containing-link-throws-error-in-visual-studio-when-running-xslt-debugger

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!