0

我有以下 XML:

<item>
<title>Testing WebForm</title>
<link>http://linkurlhere.com</link>
<description>
<div class="field field-name-body field-type-text-with-summary 
field-label-hidden"><div class="field-items"><div class="field-item even"     
property="content:encoded"><div style="background-color: white; width: 100%;">
<div id="prize" style="background-color: yellow; color: #660000; font-weight: 
bold; width: 200px;">Prize here</div>
</div>
<div id="startDate">Start Date: January 1, 2013</div>
<div id="endDate">End Date: January 1, 2014</div>
<p></p>
<p>Thanks for playing please take the survey - mock intro</p>
</div></div></div></description>
</item>

我正在使用以下 XSLT 渲染它:

    <xsl:template match="rss/channel">
    <div id="surveyList">
        <p> Please
            click on the survey below and complete the survey.</p>
        <xsl:for-each select="item">
            <div id="surveyItem">
                <div id="thePrize">
                    <xsl:apply-templates select="description"  />
                </div>
                <a id="surveyLink">
                    <xsl:attribute name="href">
                        <xsl:value-of select="link"
                        disable-output-escaping="yes" />
                    </xsl:attribute>
                    <xsl:attribute name="target">_blank</xsl:attribute>
                    <xsl:attribute name="title">Click to complete this survey</xsl:attribute>
                    <xsl:value-of select="title" disable-output-escaping="yes" />
                </a>
                <br />
            </div>
        </xsl:for-each>
    </div>
</xsl:template>

<xsl:template match="rss/channel/item/description" name="description">
    <xsl:value-of select=".//div[@id='prize']" disable-output-escaping="yes" />
</xsl:template>

当我通过诸如 Altova 之类的 IDE 运行它并对其进行转换时,它会正确显示 div 奖品文本。但是,当我构建 webapp 并将其部署在本地 tomcat 6.0 或实际的 web 服务器上时,奖品不会显示,并且当我查看页面时它不在源代码中。

我尝试了多种浏览器都无济于事。这是我的 XSLT 页面的简单设置问题吗?

谢谢。

下面更新了完整的 XML,包括 RSS 元素:

    <?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://drupal-survey.url"  xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>drupal-survey.url</title>
 <link>http://drupal-survey.url</link>
 <description></description>
 <language>en</language>
<item>
 <title>Testing WebForm</title>
 <link>urlLink here</link>
 <description>
<div class="field field-name-body field-type-text-with-summary field-label-hidden">
<div class="field-items"><div class="field-item even" property="content:encoded">
<div style="background-color: white; width: 100%;">
<div id="prize" style="background-color: yellow; color: #660000; font-weight: bold; width: 200px;">$1000 Gift Card to McDonald&#039;s</div>
</div>
<div id="startDate">Start Date: January 1, 2013</div>
<div id="endDate">End Date: January 1, 2014</div>
<p>Thanks for playing please take the survey - mock intro</p>
</div></div></div></description>
<pubDate>Mon, 25 Feb 2013 19:12:48 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">6 at http://drupal-survey.url</guid>
</item>
<item>
<title>sss162 test</title>
<link>http://drupal-survey.url/sss162/test</link>
<description><div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even" property="content:encoded"><p>This is a testing paragraph</p>
<p>this is also</p>
</div></div></div></description>
<pubDate>Thu, 10 May 2012 19:24:43 +0000</pubDate>
<dc:creator>sss162</dc:creator>
<guid isPermaLink="false">4 at http://drupal-survey.url</guid>
</item>
<item>
<title>Orientation Survey</title>
<link>http://drupal-survey.url</link>
<description><div class="field field-name-body field-type-text-with-summary field-label-hidden">
<div class="field-items"><div class="field-item even" property="content:encoded"><div id="startDate">Start Date: January 1, 2013</div>
<div id="endDate">End Date: January 1, 2014</div>
<p>This may be the brief explanation paragraph.</p>
</div></div></div></description>
<pubDate>Thu, 10 May 2012 17:11:38 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">2 at http://drupal-survey.url</guid>
</item>
</channel>
</rss>
4

0 回答 0