简体   繁体   English

向XSL添加ID或类

[英]Adding Ids or Classes to XSL

I'm trying to add ids or classes to the following attachment below (for each yellow section). 我试图将ID或类添加到下面的附件中(每个黄色部分)。 I've found the "date", "title", and "more" class, but I'm have trouble seeiong body, img, category and published sections.Click the link to see the output.... 我找到了“日期”,“标题”和“更多”类,但在查找正文,img,类别和已发布的部分时遇到了麻烦。单击链接以查看输出。...

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>

Here is the output in HTML: 这是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>

the html representation of the content will be generated on-the-fly by proprietary extensions to the xslt processor (mainly rssaggwrt:MakeSafe which operates on parts of the feed content). 内容的html表示将通过xslt处理器的专有扩展(主要是对部分提要内容进行操作的rssaggwrt:MakeSafe if you can't configure or tweak with the extension library you might have to follow a strategy like: 如果您无法配置或调整扩展库,则可能必须遵循以下策略:

  • let the browser render the page 让浏览器呈现页面
  • apply your xslt ops on the innermost html element containing rss feed content. 将您的xslt ops应用于包含rss feed内容的最里面的html元素。 this may involve serializing the content (eg. using jquery property innerHTML ), normalizing content to valid xml, re-parsing. 这可能涉及序列化内容(例如,使用jquery属性innerHTML ),将内容规范化为有效xml,重新解析。
  • replace the original dom subtree with the transform output 用转换输出替换原始的dom子树

if you only wish to annotate dom elements with classes you're probably better off with a jquery handler operating on the output of the original stylesheet. 如果只希望使用类对dom元素进行注释,则最好使用在原始样式表的输出上运行的jquery处理程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM