将Ids或类添加到XSL

时间:2012-01-24 19:31:50

标签: css xml styles xslt

我正在尝试将ID或类添加到下面的以下附件中(对于每个黄色部分)。我找到了“日期”,“标题”和“更多”类,但我很难看到bodyiong,img,category和已发布的部分。点击链接查看输出....

blog pic

    <xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema"
               version="1.0" exclude-result-prefixes="xsl ddwrt msxsl rssaggwrt" 
               xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
               xmlns:rssaggwrt="http://schemas.microsoft.com/WebParts/v3/rssagg/runtime"
               xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
               xmlns:rssFeed="urn:schemas-microsoft-com:sharepoint:RSSAggregatorWebPart"
               xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/"
               xmlns:rss1="http://purl.org/rss/1.0/" xmlns:atom="http://www.w3.org/2005/Atom"
               xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
               xmlns:atom2="http://purl.org/atom/ns#">
  <xsl:param name="rss_FeedLimit">5</xsl:param>
  <xsl:param name="rss_ExpandFeed">false</xsl:param>
  <xsl:param name="rss_LCID">1033</xsl:param>
  <xsl:param name="rss_WebPartID">RSS_Viewer_WebPart</xsl:param>
  <xsl:param name="rss_alignValue">left</xsl:param>
  <xsl:param name="rss_IsDesignMode">True</xsl:param>
  <xsl:template match="rss">
    <xsl:call-template name="RSSMainTemplate"/>

  </xsl:template>
  <xsl:template match="rdf:RDF">
    <xsl:call-template name="RDFMainTemplate"/>

  </xsl:template>
  <xsl:template match="atom:feed">
    <xsl:call-template name="ATOMMainTemplate"/>

  </xsl:template>
  <xsl:template match="atom2:feed">
    <xsl:call-template name="ATOM2MainTemplate"/>

  </xsl:template>
  <xsl:template name="RSSMainTemplate" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
    <xsl:variable name="Rows" select="channel/item"/>
    <xsl:variable name="RowCount" select="count($Rows)"/>
    <div class="slm-layout-main" >
      <xsl:call-template name="RSSMainTemplate.body">
        <xsl:with-param name="Rows" select="$Rows"/>

        <xsl:with-param name="RowCount" select="count($Rows)"/>

      </xsl:call-template>
    </div>
  </xsl:template>
  <xsl:template name="RSSMainTemplate.body" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
    <xsl:param name="Rows"/>
    <xsl:param name="RowCount"/>
    <xsl:for-each select="$Rows">
      <xsl:variable name="CurPosition" select="position()" />
      <xsl:variable name="RssFeedLink" select="$rss_WebPartID" />
      <xsl:variable name="CurrentElement" select="concat($RssFeedLink,$CurPosition)" />
      <xsl:if test="($CurPosition &lt;= $rss_FeedLimit)">
        <div class="item link-item postSection" > <a class="postHeaderLink" href="{concat(&quot;javascript:ToggleItemDescription('&quot;,$CurrentElement,&quot;')&quot;)}" > <xsl:value-of select="title"/> </a>
          <xsl:if test="$rss_ExpandFeed = true()">
            <xsl:call-template name="RSSMainTemplate.description">
              <xsl:with-param name="DescriptionStyle" select="string('display:block;')"/>

              <xsl:with-param name="CurrentElement" select="$CurrentElement"/>

            </xsl:call-template>
          </xsl:if>
          <xsl:if test="$rss_ExpandFeed = false()">
            <xsl:call-template name="RSSMainTemplate.description">
              <xsl:with-param name="DescriptionStyle" select="string('display:none;')"/>

              <xsl:with-param name="CurrentElement" select="$CurrentElement"/>

            </xsl:call-template>
          </xsl:if>
        </div>
      </xsl:if>
    </xsl:for-each>
  </xsl:template>
  <xsl:template name="RSSMainTemplate.description" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
    <xsl:param name="DescriptionStyle"/>
    <xsl:param name="CurrentElement"/>
    <div id="{$CurrentElement}" class="description" align="{$rss_alignValue}" style="{$DescriptionStyle} text-align:{$rss_alignValue};">
      <div class="postDate">
        <xsl:choose>
          <!-- some RSS2.0 contain pubDate tag, some others dc:date -->
          <xsl:when test="string-length(pubDate) &gt; 0">
            <xsl:variable name="pubDateLength" select="string-length(pubDate) - 3" />
            <xsl:value-of select="ddwrt:FormatDate(substring(pubDate,0,$pubDateLength),number($rss_LCID),3)"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="ddwrt:FormatDate(string(dc:date),number($rss_LCID),3)"/>
          </xsl:otherwise>
        </xsl:choose>
      </div>
      <xsl:if test="string-length(description) &gt; 0">
        <xsl:variable name="SafeHtml">
        <xsl:call-template name="GetSafeHtml">
          <xsl:with-param name="Html" select="description"/>

        </xsl:call-template>
        </xsl:variable>
        <xsl:value-of select="$SafeHtml" disable-output-escaping="yes"/>
      </xsl:if>
      <div class="description"> <a href="{ddwrt:EnsureAllowedProtocol(string(link))}">More...</a> </div>
    </div>
  </xsl:template>
  <xsl:template name="RDFMainTemplate" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
    <xsl:variable name="Rows" select="rss1:item"/>
    <xsl:variable name="RowCount" select="count($Rows)"/>
    <div class="slm-layout-main" >
      <div class="groupheader item medium"> <a href="{ddwrt:EnsureAllowedProtocol(string(rss1:channel/rss1:link))}"> <xsl:value-of select="rss1:channel/rss1:title"/> </a> </div>
      <xsl:call-template name="RDFMainTemplate.body">
        <xsl:with-param name="Rows" select="$Rows"/>

        <xsl:with-param name="RowCount" select="count($Rows)"/>

      </xsl:call-template>
    </div>
  </xsl:template>
  <xsl:template name="RDFMainTemplate.body" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
    <xsl:param name="Rows"/>
    <xsl:param name="RowCount"/>
    <xsl:for-each select="$Rows">
      <xsl:variable name="CurPosition" select="position()" />
      <xsl:variable name="RssFeedLink" select="$rss_WebPartID" />
      <xsl:variable name="CurrentElement" select="concat($RssFeedLink,$CurPosition)" />
      <xsl:if test="($CurPosition &lt;= $rss_FeedLimit)">
        <div class="item link-item postSection" > <a class="postHeaderLink" href="{concat(&quot;javascript:ToggleItemDescription('&quot;,$CurrentElement,&quot;')&quot;)}" > <xsl:value-of select="rss1:title"/> </a>
          <xsl:if test="$rss_ExpandFeed = true()">
            <xsl:call-template name="RDFMainTemplate.description">
              <xsl:with-param name="DescriptionStyle" select="string('display:block;')"/>

              <xsl:with-param name="CurrentElement" select="$CurrentElement"/>

            </xsl:call-template>
          </xsl:if>
          <xsl:if test="$rss_ExpandFeed = false()">
            <xsl:call-template name="RDFMainTemplate.description">
              <xsl:with-param name="DescriptionStyle" select="string('display:none;')"/>

              <xsl:with-param name="CurrentElement" select="$CurrentElement"/>

            </xsl:call-template>
          </xsl:if>
        </div>
      </xsl:if>
    </xsl:for-each>
  </xsl:template>
  <xsl:template name="RDFMainTemplate.description" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
    <xsl:param name="DescriptionStyle"/>
    <xsl:param name="CurrentElement"/>
    <div id="{$CurrentElement}" class="description" align="{$rss_alignValue}" style="{$DescriptionStyle} text-align:{$rss_alignValue};"> <xsl:value-of select="ddwrt:FormatDate(string(dc:date),number($rss_LCID),3)"/>
      <xsl:if test="string-length(rss1:description) &gt; 0">
        <xsl:variable name="SafeHtml">
        <xsl:call-template name="GetSafeHtml">
          <xsl:with-param name="Html" select="rss1:description"/>

        </xsl:call-template>
        </xsl:variable>
        <xsl:value-of select="$SafeHtml" disable-output-escaping="yes"/>
      </xsl:if>
      <div class="description"> <a href="{ddwrt:EnsureAllowedProtocol(string(rss1:link))}">More...</a> </div>
    </div>
  </xsl:template>
  <xsl:template name="ATOMMainTemplate" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
    <xsl:variable name="Rows" select="atom:entry"/>
    <xsl:variable name="RowCount" select="count($Rows)"/>
    <div class="slm-layout-main" >
      <div class="groupheader item medium"> <a href="{ddwrt:EnsureAllowedProtocol(string(atom:link/@href))}"> <xsl:value-of select="atom:title"/> </a> </div>
      <xsl:call-template name="ATOMMainTemplate.body">
        <xsl:with-param name="Rows" select="$Rows"/>

        <xsl:with-param name="RowCount" select="count($Rows)"/>

      </xsl:call-template>
    </div>
  </xsl:template>
  <xsl:template name="ATOMMainTemplate.body" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
    <xsl:param name="Rows"/>
    <xsl:param name="RowCount"/>
    <xsl:for-each select="$Rows">
      <xsl:variable name="CurPosition" select="position()" />
      <xsl:variable name="RssFeedLink" select="$rss_WebPartID" />
      <xsl:variable name="CurrentElement" select="concat($RssFeedLink,$CurPosition)" />
      <xsl:if test="($CurPosition &lt;= $rss_FeedLimit)">
        <div class="item link-item postSection" > <a class="postHeaderLink" href="{concat(&quot;javascript:ToggleItemDescription('&quot;,$CurrentElement,&quot;')&quot;)}" > <xsl:value-of select="atom:title"/> </a>
          <xsl:if test="$rss_ExpandFeed = true()">
            <xsl:call-template name="ATOMMainTemplate.description">
              <xsl:with-param name="DescriptionStyle" select="string('display:block;')"/>

              <xsl:with-param name="CurrentElement" select="$CurrentElement"/>

            </xsl:call-template>
          </xsl:if>
          <xsl:if test="$rss_ExpandFeed = false()">
            <xsl:call-template name="ATOMMainTemplate.description">
              <xsl:with-param name="DescriptionStyle" select="string('display:none;')"/>

              <xsl:with-param name="CurrentElement" select="$CurrentElement"/>

            </xsl:call-template>
          </xsl:if>
        </div>
      </xsl:if>
    </xsl:for-each>
  </xsl:template>
  <xsl:template name="ATOMMainTemplate.description" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
    <xsl:param name="DescriptionStyle"/>
    <xsl:param name="CurrentElement"/>
    <div id="{$CurrentElement}" class="description" align="{$rss_alignValue}" style="{$DescriptionStyle} text-align:{$rss_alignValue};"> <xsl:value-of select="ddwrt:FormatDate(string(atom:updated),number($rss_LCID),3)"/>
      <div class="postDate">
        <xsl:choose>
          <xsl:when test="string-length(atom:summary) &gt; 0">
            <xsl:variable name="SafeHtml">
            <xsl:call-template name="GetSafeHtml">
              <xsl:with-param name="Html" select="atom:summary"/>

            </xsl:call-template>
            </xsl:variable>
            <xsl:value-of select="$SafeHtml" disable-output-escaping="yes"/>
          </xsl:when>
          <xsl:when test="string-length(atom:content) &gt; 0">
            <xsl:variable name="SafeHtml">
            <xsl:call-template name="GetSafeHtml">
              <xsl:with-param name="Html" select="atom:content"/>

            </xsl:call-template>
            </xsl:variable>
            <xsl:value-of select="$SafeHtml" disable-output-escaping="yes"/>
          </xsl:when>
        </xsl:choose>
      </div>
      <div class="description"> <a href="{ddwrt:EnsureAllowedProtocol(string(atom:link/@href))}">More...</a> </div>
    </div>
  </xsl:template>
  <xsl:template name="ATOM2MainTemplate" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
    <xsl:variable name="Rows" select="atom2:entry"/>
    <xsl:variable name="RowCount" select="count($Rows)"/>
    <div class="slm-layout-main" >
      <div class="groupheader item medium"> <a href="{ddwrt:EnsureAllowedProtocol(string(atom2:link/@href))}"> <xsl:value-of select="atom2:title"/> </a> </div>
      <xsl:call-template name="ATOM2MainTemplate.body">
        <xsl:with-param name="Rows" select="$Rows"/>

        <xsl:with-param name="RowCount" select="count($Rows)"/>

      </xsl:call-template>
    </div>
  </xsl:template>
  <xsl:template name="ATOM2MainTemplate.body" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
    <xsl:param name="Rows"/>
    <xsl:param name="RowCount"/>
    <xsl:for-each select="$Rows">
      <xsl:variable name="CurPosition" select="position()" />
      <xsl:variable name="RssFeedLink" select="$rss_WebPartID" />
      <xsl:variable name="CurrentElement" select="concat($RssFeedLink,$CurPosition)" />
      <xsl:if test="($CurPosition &lt;= $rss_FeedLimit)">
        <div class="item link-item postSection" > <a class="postHeaderLink" href="{concat(&quot;javascript:ToggleItemDescription('&quot;,$CurrentElement,&quot;')&quot;)}" > <xsl:value-of select="atom2:title"/> </a>
          <xsl:if test="$rss_ExpandFeed = true()">
            <xsl:call-template name="ATOM2MainTemplate.description">
              <xsl:with-param name="DescriptionStyle" select="string('display:block;')"/>

              <xsl:with-param name="CurrentElement" select="$CurrentElement"/>

            </xsl:call-template>
          </xsl:if>
          <xsl:if test="$rss_ExpandFeed = false()">
            <xsl:call-template name="ATOM2MainTemplate.description">
              <xsl:with-param name="DescriptionStyle" select="string('display:none;')"/>

              <xsl:with-param name="CurrentElement" select="$CurrentElement"/>

            </xsl:call-template>
          </xsl:if>
        </div>
      </xsl:if>
    </xsl:for-each>
  </xsl:template>
  <xsl:template name="ATOM2MainTemplate.description" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
    <xsl:param name="DescriptionStyle"/>
    <xsl:param name="CurrentElement"/>
    <div id="{$CurrentElement}" class="description" align="{$rss_alignValue}" style="{$DescriptionStyle} text-align:{$rss_alignValue};"> <xsl:value-of select="ddwrt:FormatDate(string(atom2:updated),number($rss_LCID),3)"/>
      <div class="postDate">
        <xsl:choose>
          <xsl:when test="string-length(atom2:summary) &gt; 0">
            <xsl:variable name="SafeHtml">
            <xsl:call-template name="GetSafeHtml">
              <xsl:with-param name="Html" select="atom2:summary"/>

            </xsl:call-template>
            </xsl:variable>
            <xsl:value-of select="$SafeHtml" disable-output-escaping="yes"/>
          </xsl:when>
          <xsl:when test="string-length(atom2:content) &gt; 0">
            <xsl:variable name="SafeHtml">
            <xsl:call-template name="GetSafeHtml">
              <xsl:with-param name="Html" select="atom2:content"/>

            </xsl:call-template>
            </xsl:variable>
            <xsl:value-of select="$SafeHtml" disable-output-escaping="yes"/>
          </xsl:when>
        </xsl:choose>
      </div>
      <div class="description"> <a href="{ddwrt:EnsureAllowedProtocol(string(atom2:link/@href))}">More...</a> </div>
    </div>
  </xsl:template>
  <xsl:template name="GetSafeHtml">
    <xsl:param name="Html"/>
    <xsl:choose>
      <xsl:when test="$rss_IsDesignMode = 'True'">
        <xsl:value-of select="$Html"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="rssaggwrt:MakeSafe($Html)"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
</xsl:stylesheet>

以下是HTML中的输出:

    <!DOCTYPE HTML>
<html>
<head>
</head>

<body>
<div class="ms-rtestate-read ms-rte-wpbox">
  <div class="ms-rtestate-notify  ms-rtestate-read 5b3f0d13-9a94-4cb5-8d0b-09bcd8a3bfe4" id="div_5b3f0d13-9a94-4cb5-8d0b-09bcd8a3bfe4">
    <table cellspacing="0" cellpadding="0" style="width:100%">
      <tbody>
        <tr>
          <td valign="top" class="s4-wpcell-plain" id="MSOZoneCell_WebPartWPQ7"><table cellspacing="0" cellpadding="0" border="0" width="100%" class="s4-wpTopTable">
              <tbody>
                <tr>
                  <td><table cellspacing="0" cellpadding="0" border="0" width="100%">
                      <tbody>
                        <tr class="ms-WPHeader">
                          <td align="left" class="ms-wpTdSpace">&nbsp;</td>
                          <td class="ms-WPHeaderTd" id="WebPartTitleWPQ7" title="Latest News! - Displays an RSS feed."><h3 class="ms-standardheader ms-WPTitle" style="text-align:justify;"><a href="*******Can't show this link*******News/default.aspx" accesskey="W"><nobr><span>Latest News!</span><span id="WebPartCaptionWPQ7"></span></nobr></a></h3></td>
                          <td align="right" onclick="OpenWebPartMenu('WebPartWPQ7_Menu', this, 'WebPartWPQ7','False'); TrapMenuClick(event); return false;" class="ms-WPHeaderTdMenu"><span style="display:none;">
                            <menu class="ms-SrvMenuUI" id="WebPartWPQ7_Menu">
                              <ie:menuitem type="option" text="Minimize" onmenuclick="javascript:MSOLayout_MinimizeRestore(MenuWebPart)" id="MSOMenu_Minimize" title="Collapse this web part."> </ie:menuitem>
                              <ie:menuitem type="option" text="Restore" onmenuclick="javascript:MSOLayout_MinimizeRestore(MenuWebPart)" id="MSOMenu_Restore" title="Expand this web part."> </ie:menuitem>
                              <ie:menuitem type="option" text="Close" onmenuclick="javascript:MSOLayout_RemoveWebPart(MenuWebPart)" id="MSOMenu_Close" title="Close this Web Part. You can still find it under closed Web Parts section in the insert ribbon. These changes will apply to all users."> </ie:menuitem>
                              <ie:menuitem type="option" text="Delete" onmenuclick="if(confirm('You are about to permanently delete this Web Part. Are you sure you want to do this?')) {MSOWebPartPage_partDeleted = MenuWebPartID;MSOWebPartPage_MenuDoPostBack('ctl00$m', MenuWebPartID + ';MSOMenu_Delete');}" iconsrc="/_layouts/images/DelItem.gif" id="MSOMenu_Delete" title="Delete this Web Part from the page. These changes will apply to all users."> </ie:menuitem>
                              <ie:menuitem type="separator"></ie:menuitem>
                              <ie:menuitem type="option" text="Edit Web Part" onmenuclick="javascript:MSOTlPn_ShowToolPane2Wrapper('Edit', 16, MenuWebPartID)" iconsrc="/_layouts/images/EditItem.gif" id="MSOMenu_Edit" title="Change properties of this shared Web Part. These changes will apply to all users."> </ie:menuitem>
                              <ie:menuitem type="option" text="Connections" onmenuclick="" id="MSOMenu_Connections" title="Show connections options for this Web Part. These changes will apply to all users."> </ie:menuitem>
                              <ie:menuitem type="separator"></ie:menuitem>
                              <ie:menuitem type="option" text="Export..." onmenuclick="javascript:MSOWebPartPage_ExportCheckWarning('\u002fsites\u002fdermres\u002f_vti_bin\u002fexportwp.aspx?pageurl=http\u00253A\u00252F\u00252Fdermdev2\u00253A80\u00252Fsites\u00252Fdermres\u00252FSitePages\u00252FHome\u00252Easpx\u0026guidstring='+ escape(MenuWebPartID), MenuWebPart.getAttribute('HasPers') == 'true')" id="MSOMenu_Export" title="Export this Web Part. These changes will apply to all users."> </ie:menuitem>
                              <ie:menuitem style="display:none" type="option" text="Help" onmenuclick="MSOWebPartPage_SetNewWindowLocation(MenuWebPart.getAttribute('helpLink'), MenuWebPart.getAttribute('helpMode'))" iconsrc="/_layouts/images/HelpIcon.gif" id="MSOMenu_Help"> </ie:menuitem>
                            </menu>
                            </span>
                            <div onmouseover="this.className='ms-WPMenuDivHover'" onmouseout="this.className='ms-WPMenuDiv'" class="ms-WPMenuDiv"><a menuid="WebPartWPQ7_Menu" onfocus="UpdateWebPartMenuFocus(this, 'ms-wpselectlinkfocus', 'ms-WPEditTextVisible');" onblur="UpdateWebPartMenuFocus(this, 'ms-wpselectlink', 'ms-WPEditText');" class="ms-wpselectlink" title="Latest News! Web Part Menu" href="#" onkeydown="WebPartMenuKeyboardClick(document.getElementById('WebPartWPQ7_MenuLink'), 13, 40, event)" id="WebPartWPQ7_MenuLink" onclick="OpenWebPartMenuFromLink('WebPartWPQ7_Menu', this, 'WebPartWPQ7','False'); return false;"><img style="border-width:0px;" alt="Latest News! Web Part Menu" src="/_layouts/images/wpmenuarrow.png" class="ms-WPHeaderMenuImg"></a></div></td>
                          <td class="ms-WPHeaderTdSelection"><span class="ms-WPHeaderTdSelSpan">
                            <input type="checkbox" onclick="TrapMenuClick(event); return false;" onmouseup="WpCbxSelect(event); return false;" onkeyup="WpCbxKeyHandler(event);" onfocus="this.className='ms-WPHeaderCbxVisible'" onblur="this.className='ms-WPHeaderCbxHidden'" title="Select or deselect Latest News! Web Part" class="ms-WPHeaderCbxHidden" id="SelectionCbxWebPartWPQ7">
                            </span></td>
                          <td align="left" class="ms-wpTdSpace">&nbsp;</td>
                        </tr>
                      </tbody>
                    </table></td>
                </tr>
                <tr>
                  <td valign="top" class=""><div style="" allowdelete="false" allowremove="false" class="ms-WPBody noindex ms-wpContentDivSpace" width="100%" id="WebPartWPQ7" haspers="false" webpartid2="5b3f0d13-9a94-4cb5-8d0b-09bcd8a3bfe4" webpartid="4925e295-451f-4c05-8411-a3d05fbed1c1">
                      <table cellspacing="0" cellpadding="0" border="0" width="100%">
                        <tbody>
                          <tr>
                            <td><div style="padding-top:5px;" id="rssFeedWPDiv_ctl00_m_g_5b3f0d13_9a94_4cb5_8d0b_09bcd8a3bfe4">
                                <table cellspacing="0" cellpadding="0" border="0" width="100%">
                                  <tbody>
                                    <tr>
                                      <td><!--?xml version="1.0" encoding="utf-8"?-->
                                        <div xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:rssfeed="urn:schemas-microsoft-com:sharepoint:RSSAggregatorWebPart" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rss1="http://purl.org/rss/1.0/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:atom2="http://purl.org/atom/ns#" class="slm-layout-main">
                                          <div class="item link-item"><a href="javascript:ToggleItemDescription('g_5b3f0d13_9a94_4cb5_8d0b_09bcd8a3bfe41')">Happy Hippos!</a>
                                            <div align="left" style="display:block; text-align:left;" class="description" id="g_5b3f0d13_9a94_4cb5_8d0b_09bcd8a3bfe41">Friday, January 20, 2012
                                              -
                                              <div class="postDescription"><b></b>
                                                <div class="ExternalClass7307B3207C5F4D249548C7AF6EAFC3D5">
                                                  <p class="postImage">&#8203;<img style="margin:5px;width:233px;height:178px" src="*******Can't show this link*******News/Lists/Photos/HappyHippo.JPG" alt="HappyHippo.JPG"></p>
                                                  <p>Happy Hippos!</p>
                                                  <p>Vestibulum ante ip<span style="text-decoration:underline">sum primis in faucibus orci luctus et ultrices pos</span>uere
                                                    cubilia Curae; Aliquam ac lorem nisi. Aliquam vitae lacus sapien. Nam 
                                                    ornare, tellus id tristique <strong>elementum, ipsum velit gravida elit, vitae 
                                                    condimentum neque ante tincidunt est. Nulla facilisi. Sed</strong> pulvinar neque
                                                    vitae dolor pretium gravida. Pellentesque habitant morbi tristique 
                                                    senectus et netus et malesuada fames ac turpis egestas.&nbsp;</p>
                                                  <p>writing more.......................<br>
                                                    <br>
                                                  </p>
                                                </div>
                                              </div>
                                              <div class="postCategory"><b>Posted In:</b> <a href="*******Can't show this link*******_layouts/listform.aspx?PageType=4&amp;ListId={E1ED84A3-3668-4A94-B5A8-4F8EE21F6759}&amp;ID=6&amp;RootFolder=*">Announcements</a>; <a href="*******Can't show this link*******_layouts/listform.aspx?PageType=4&amp;ListId={E1ED84A3-3668-4A94-B5A8-4F8EE21F6759}&amp;ID=5&amp;RootFolder=*">Current Issues</a>; <a href="*******Can't show this link*******_layouts/listform.aspx?PageType=4&amp;ListId={E1ED84A3-3668-4A94-B5A8-4F8EE21F6759}&amp;ID=7&amp;RootFolder=*">Lastest News</a>; <a href="*******Can't show this link*******_layouts/listform.aspx?PageType=4&amp;ListId={E1ED84A3-3668-4A94-B5A8-4F8EE21F6759}&amp;ID=4&amp;RootFolder=*">What's New?</a></div>
                                              <div></div>
                                              <div class="description"><a href="*******Can't show this link*******Lists/Posts/ViewPost.aspx?ID=7">More...</a></div>
                                            </div>
                                          </div>
                                        </div></td>
                                    </tr>
                                  </tbody>
                                </table>
                              </div></td>
                          </tr>
                        </tbody>
                      </table>
                    </div></td>
                </tr>
              </tbody>
            </table></td>
        </tr>
      </tbody>
    </table>
  </div>
  <div style="display:none" id="vid_5b3f0d13-9a94-4cb5-8d0b-09bcd8a3bfe4"></div>
</div>
</body>
</html>

1 个答案:

答案 0 :(得分:0)

内容的html表示将通过xslt处理器的专有扩展(主要是rssaggwrt:MakeSafe,即对部分Feed内容进行操作)即时生成。如果您无法使用扩展程序库进行配置或调整,则可能必须遵循以下策略:

  • 让浏览器呈现页面
  • 将xslt操作应用于包含rss Feed内容的最里面的html元素。这可能涉及序列化内容(例如,使用jquery属性innerHTML),将内容规范化为有效的xml,重新解析。
  • 使用转换输出
  • 替换原始dom子树

如果你只想用类来注释dom元素,你可能最好使用在原始样式表的输出上运行的jquery处理程序。