我有以下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'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>