DNN新闻源中的System.Xml.Xsl.XslLoadException

时间:2013-07-25 21:20:20

标签: xml xslt rss dotnetnuke rss-reader

我在DotNetNuke中安装了一个RSS阅读器模块。我必须配置XSL以便以可读格式获取输出。 RSS如下:

<feed xmlns="http://www.w3.org/2005/Atom" xmlns:atlassian="http://streams.atlassian.com/syndication/general/1.0"><id>http://oncprojectracking.org/activity?maxResults=5&amp;title=undefined</id><link href="http://oncprojectracking.org/activity?maxResults=5&amp;title=undefined" rel="self" /><title type="text">undefined</title><atlassian:timezone-offset>-0400</atlassian:timezone-offset><updated>2013-07-25T19:58:16.899Z</updated><entry xmlns:activity="http://activitystrea.ms/spec/1.0/"><id>urn:uuid:876b6dc4-7ecc-39c8-8862-d9793f1bc5b6</id><title type="html">&lt;a href="http://oncprojectracking.org/secure/ViewProfile.jspa?name=sharonj.giarrizzo-wilson" class="activity-item-user activity-item-author">Sharon J. Giarrizzo-Wilson&lt;/a> changed the Assignee to '&lt;a href="http://oncprojectracking.org/secure/ViewProfile.jspa?name=mhinterberg%40ofmq.com" class="activity-item-user">Michelle Hinterberg&lt;/a>' on       &lt;a href="http://oncprojectracking.org/browse/CQM-778">CQM-778 - CMS72v2/NQF0438 Denominator Exception for Antithrombotic Therapy not done should be limited to &amp;lt;=1 day after start of Non-Elective Inpatient Encounter if you don&amp;#39;t have an ED Encounter prior to the inpatient encounter&lt;/a>
  </title><author xmlns:usr="http://streams.atlassian.com/syndication/username/1.0"><name>Sharon J. Giarrizzo-Wilson</name><uri>http://oncprojectracking.org/secure/ViewProfile.jspa?name=sharonj.giarrizzo-wilson</uri><link xmlns:media="http://purl.org/syndication/atommedia" rel="photo" href="http://oncprojectracking.org/secure/useravatar?avatarId=10122&amp;s=16" media:height="16" media:width="16" /><link xmlns:media="http://purl.org/syndication/atommedia" rel="photo" href="http://oncprojectracking.org/secure/useravatar?avatarId=10122&amp;s=48" media:height="48" media:width="48" /><usr:username>sharonj.giarrizzo-wilson</usr:username><activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type></author><published>2013-07-25T18:57:37.443Z</published><updated>2013-07-25T18:57:37.443Z</updated><link href="http://oncprojectracking.org/browse/CQM-778" rel="alternate" /><link href="http://oncprojectracking.org/images/icons/issuetypes/genericissue.png" rel="http://streams.atlassian.com/syndication/icon" title="Logic" /><link href="http://oncprojectracking.org/s/en_US-46i7uf-1988229788/6099/7/1.0/_/download/resources/jira.webresources:global-static/wiki-renderer.css" rel="http://streams.atlassian.com/syndication/css" /><generator uri="http://oncprojectracking.org" /><atlassian:application>com.atlassian.jira</atlassian:application><activity:verb>http://activitystrea.ms/schema/1.0/update</activity:verb><activity:object><id>urn:uuid:932c25ac-4b15-3dc2-969c-8b6fd5ce73d9</id><title type="text">CQM-778</title><summary type="text">CMS72v2/NQF0438 Denominator Exception for Antithrombotic Therapy not done should be limited to &lt;=1 day after start of Non-Elective Inpatient Encounter if you don't have an ED Encounter prior to the inpatient encounter</summary><link rel="alternate" href="http://oncprojectracking.org/browse/CQM-778" /><activity:object-type>http://streams.atlassian.com/syndication/types/issue</activity:object-type></activity:object><atlassian:timezone-offset>-0400</atlassian:timezone-offset></entry><entry xmlns:activity="http://activitystrea.ms/spec/1.0/"><id>urn:uuid:68578e9f-2534-30d8-8bb1-86d937b8e41f</id><title type="html">&lt;a href="http://oncprojectracking.org/secure/ViewProfile.jspa?name=sharonj.giarrizzo-wilson" class="activity-item-user activity-item-author">Sharon J. Giarrizzo-Wilson&lt;/a> changed the Assignee to '&lt;a href="http://oncprojectracking.org/secure/ViewProfile.jspa?name=chengjianche" class="activity-item-user">Chengjian Che&lt;/a>' on       &lt;a href="http://oncprojectracking.org/browse/CQM-775">CQM-775 - IPP definition will exclude some patients from ever being considered.&lt;/a>
  </title><author xmlns:usr="http://streams.atlassian.com/syndication/username/1.0"><name>Sharon J. Giarrizzo-Wilson</name><uri>http://oncprojectracking.org/secure/ViewProfile.jspa?name=sharonj.giarrizzo-wilson</uri><link xmlns:media="http://purl.org/syndication/atommedia" rel="photo" href="http://oncprojectracking.org/secure/useravatar?avatarId=10122&amp;s=16" media:height="16" media:width="16" /><link xmlns:media="http://purl.org/syndication/atommedia" rel="photo" href="http://oncprojectracking.org/secure/useravatar?avatarId=10122&amp;s=48" media:height="48" media:width="48" /><usr:username>sharonj.giarrizzo-wilson</usr:username><activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type></author><published>2013-07-25T18:54:55.077Z</published><updated>2013-07-25T18:54:55.077Z</updated><link href="http://oncprojectracking.org/browse/CQM-775" rel="alternate" /><link href="http://oncprojectracking.org/images/icons/issuetypes/genericissue.png" rel="http://streams.atlassian.com/syndication/icon" title="Logic" /><link href="http://oncprojectracking.org/s/en_US-46i7uf-1988229788/6099/7/1.0/_/download/resources/jira.webresources:global-static/wiki-renderer.css" rel="http://streams.atlassian.com/syndication/css" /><generator uri="http://oncprojectracking.org" /><atlassian:application>com.atlassian.jira</atlassian:application><activity:verb>http://activitystrea.ms/schema/1.0/update</activity:verb><activity:object><id>urn:uuid:79a1ad6c-8f35-3cb3-88a0-ae77c0700953</id><title type="text">CQM-775</title><summary type="text">IPP definition will exclude some patients from ever being considered.</summary><link rel="alternate" href="http://oncprojectracking.org/browse/CQM-775" /><activity:object-type>http://streams.atlassian.com/syndication/types/issue</activity:object-type></activity:object><atlassian:timezone-offset>-0400</atlassian:timezone-offset></entry><entry xmlns:activity="http://activitystrea.ms/spec/1.0/"><id>urn:uuid:d2c02478-7beb-3fe6-afe3-5eaf608463e5</id><title type="html">&lt;a href="http://oncprojectracking.org/secure/ViewProfile.jspa?name=sharonj.giarrizzo-wilson" class="activity-item-user activity-item-author">Sharon J. Giarrizzo-Wilson&lt;/a> changed the Assignee to '&lt;a href="http://oncprojectracking.org/secure/ViewProfile.jspa?name=mhinterberg%40ofmq.com" class="activity-item-user">Michelle Hinterberg&lt;/a>' on       &lt;a href="http://oncprojectracking.org/browse/CQM-773">CQM-773 - CMS188v3/NQF0147 Patient with Any Infection (AND) a respiratory infection will not be excluded&lt;/a>
  </title><author xmlns:usr="http://streams.atlassian.com/syndication/username/1.0"><name>Sharon J. Giarrizzo-Wilson</name><uri>http://oncprojectracking.org/secure/ViewProfile.jspa?name=sharonj.giarrizzo-wilson</uri><link xmlns:media="http://purl.org/syndication/atommedia" rel="photo" href="http://oncprojectracking.org/secure/useravatar?avatarId=10122&amp;s=16" media:height="16" media:width="16" /><link xmlns:media="http://purl.org/syndication/atommedia" rel="photo" href="http://oncprojectracking.org/secure/useravatar?avatarId=10122&amp;s=48" media:height="48" media:width="48" /><usr:username>sharonj.giarrizzo-wilson</usr:username><activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type></author><published>2013-07-25T18:54:11.130Z</published><updated>2013-07-25T18:54:11.130Z</updated><link href="http://oncprojectracking.org/browse/CQM-773" rel="alternate" /><link href="http://oncprojectracking.org/images/icons/issuetypes/genericissue.png" rel="http://streams.atlassian.com/syndication/icon" title="Logic" /><link href="http://oncprojectracking.org/s/en_US-46i7uf-1988229788/6099/7/1.0/_/download/resources/jira.webresources:global-static/wiki-renderer.css" rel="http://streams.atlassian.com/syndication/css" /><generator uri="http://oncprojectracking.org" /><atlassian:application>com.atlassian.jira</atlassian:application><activity:verb>http://activitystrea.ms/schema/1.0/update</activity:verb><activity:object><id>urn:uuid:4ef04280-a9a2-3140-ae43-a7026e199727</id><title type="text">CQM-773</title><summary type="text">CMS188v3/NQF0147 Patient with Any Infection (AND) a respiratory infection will not be excluded</summary><link rel="alternate" href="http://oncprojectracking.org/browse/CQM-773" /><activity:object-type>http://streams.atlassian.com/syndication/types/issue</activity:object-type></activity:object><atlassian:timezone-offset>-0400</atlassian:timezone-offset></entry><entry xmlns:activity="http://activitystrea.ms/spec/1.0/"><id>urn:uuid:78aede70-9e52-3097-9797-54c70c55796d</id><title type="html">&lt;a href="http://oncprojectracking.org/secure/ViewProfile.jspa?name=sharonj.giarrizzo-wilson" class="activity-item-user activity-item-author">Sharon J. Giarrizzo-Wilson&lt;/a> changed the Assignee to '&lt;a href="http://oncprojectracking.org/secure/ViewProfile.jspa?name=cynthial.barton" class="activity-item-user">Cynthia L. Barton&lt;/a>' on       &lt;a href="http://oncprojectracking.org/browse/CQM-772">CQM-772 - CMS73 NQF373 does not include Bivalirudin in value set - can it be added?&lt;/a>
  </title><author xmlns:usr="http://streams.atlassian.com/syndication/username/1.0"><name>Sharon J. Giarrizzo-Wilson</name><uri>http://oncprojectracking.org/secure/ViewProfile.jspa?name=sharonj.giarrizzo-wilson</uri><link xmlns:media="http://purl.org/syndication/atommedia" rel="photo" href="http://oncprojectracking.org/secure/useravatar?avatarId=10122&amp;s=16" media:height="16" media:width="16" /><link xmlns:media="http://purl.org/syndication/atommedia" rel="photo" href="http://oncprojectracking.org/secure/useravatar?avatarId=10122&amp;s=48" media:height="48" media:width="48" /><usr:username>sharonj.giarrizzo-wilson</usr:username><activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type></author><published>2013-07-25T18:52:15.883Z</published><updated>2013-07-25T18:52:15.883Z</updated><link href="http://oncprojectracking.org/browse/CQM-772" rel="alternate" /><link href="http://oncprojectracking.org/images/icons/issuetypes/genericissue.png" rel="http://streams.atlassian.com/syndication/icon" title="Logic" /><link href="http://oncprojectracking.org/s/en_US-46i7uf-1988229788/6099/7/1.0/_/download/resources/jira.webresources:global-static/wiki-renderer.css" rel="http://streams.atlassian.com/syndication/css" /><generator uri="http://oncprojectracking.org" /><atlassian:application>com.atlassian.jira</atlassian:application><activity:verb>http://activitystrea.ms/schema/1.0/update</activity:verb><activity:object><id>urn:uuid:06847a8a-7012-3f11-8732-dee23020ec2d</id><title type="text">CQM-772</title><summary type="text">CMS73 NQF373 does not include Bivalirudin in value set - can it be added?</summary><link rel="alternate" href="http://oncprojectracking.org/browse/CQM-772" /><activity:object-type>http://streams.atlassian.com/syndication/types/issue</activity:object-type></activity:object><atlassian:timezone-offset>-0400</atlassian:timezone-offset></entry><entry xmlns:activity="http://activitystrea.ms/spec/1.0/"><id>urn:uuid:b4d1ff48-05a7-35af-a018-f428605a769c</id><title type="html">&lt;a href="http://oncprojectracking.org/secure/ViewProfile.jspa?name=sharonj.giarrizzo-wilson" class="activity-item-user activity-item-author">Sharon J. Giarrizzo-Wilson&lt;/a> changed the Assignee to '&lt;a href="http://oncprojectracking.org/secure/ViewProfile.jspa?name=mhinterberg%40ofmq.com" class="activity-item-user">Michelle Hinterberg&lt;/a>' on       &lt;a href="http://oncprojectracking.org/browse/CQM-771">CQM-771 - CMS188v3/NQF0147 Logic for No ED &amp;gt; NonICU &amp;gt; ICU path does not limit transfers to ICU to within 24hrs after arrival&lt;/a>
  </title><content type="html">&lt;blockquote>
   &lt;p>Another one for PN-6.&lt;/p>   &lt;/blockquote>
</content><author xmlns:usr="http://streams.atlassian.com/syndication/username/1.0"><name>Sharon J. Giarrizzo-Wilson</name><uri>http://oncprojectracking.org/secure/ViewProfile.jspa?name=sharonj.giarrizzo-wilson</uri><link xmlns:media="http://purl.org/syndication/atommedia" rel="photo" href="http://oncprojectracking.org/secure/useravatar?avatarId=10122&amp;s=16" media:height="16" media:width="16" /><link xmlns:media="http://purl.org/syndication/atommedia" rel="photo" href="http://oncprojectracking.org/secure/useravatar?avatarId=10122&amp;s=48" media:height="48" media:width="48" /><usr:username>sharonj.giarrizzo-wilson</usr:username><activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type></author><published>2013-07-25T18:50:59.377Z</published><updated>2013-07-25T18:50:59.377Z</updated><link href="http://oncprojectracking.org/browse/CQM-771?focusedCommentId=14964&amp;page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14964" rel="alternate" /><link href="http://oncprojectracking.org/images/icons/issuetypes/genericissue.png" rel="http://streams.atlassian.com/syndication/icon" title="Logic" /><link href="http://oncprojectracking.org/s/en_US-46i7uf-1988229788/6099/7/1.0/_/download/resources/jira.webresources:global-static/wiki-renderer.css" rel="http://streams.atlassian.com/syndication/css" /><generator uri="http://oncprojectracking.org" /><atlassian:application>com.atlassian.jira</atlassian:application><activity:verb>http://activitystrea.ms/schema/1.0/update</activity:verb><activity:object><id>urn:uuid:e9eeb6ef-dfba-3ea7-b55f-c9c3a6391cd5</id><title type="text">CQM-771</title><summary type="text">CMS188v3/NQF0147 Logic for No ED > NonICU > ICU path does not limit transfers to ICU to within 24hrs after arrival</summary><link rel="alternate" href="http://oncprojectracking.org/browse/CQM-771" /><activity:object-type>http://streams.atlassian.com/syndication/types/issue</activity:object-type></activity:object><atlassian:timezone-offset>-0400</atlassian:timezone-offset></entry></feed>

我使用的XSL文件如下:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
  <html>
  <body>
    <table border="1">
      <tr bgcolor="#9acd32">
        <th>Title</th>
        <th>Author</th>
        <th>Updated</th>
      </tr>
      <xsl:for-each select="feed/entry">
      <tr>
        <td><xsl:value-of select="title"/></td>
        <td><xsl:value-of select="author"/></td>
        <td><xsl:value-of select="updated"/></td>
      </tr>
      </xsl:for-each>
    </table>
  </body>
  </html>
</xsl:template>
</xsl:stylesheet>

我收到以下错误。

System.Xml.Xsl.XslLoadException XSLT编译错误。有什么帮助吗?

1 个答案:

答案 0 :(得分:0)

这是因为您尚未定义xsl名称空间。变化

<xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform">

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

您还需要添加一个'atom'命名空间,以使'for-each'和'value-of'指令有效,并且您可能希望禁用标题字段上的输出转义以在其中生成标记显示为标记。我建议这个:

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
        xmlns:atom="http://www.w3.org/2005/Atom">
  <xsl:output method="html"/>
  <xsl:template match="/">
    <html xmlns="http://www.w3.org/1999/xhtml">
      <body>
        <table border="1">
          <tr bgcolor="#9acd32">
            <th>Title</th>
            <th>Author</th>
            <th>Updated</th>
          </tr>
          <xsl:for-each select="atom:feed/atom:entry">
            <tr>
              <td>
                <xsl:value-of select="atom:title" disable-output-escaping="yes"/>
              </td>
              <td>
                <xsl:value-of select="atom:author"/>
              </td>
              <td>
                <xsl:value-of select="atom:updated"/>
              </td>
            </tr>
          </xsl:for-each>
        </table>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>