2
votes

I am running umbraco v 4.0.3. My web server is Windows Server 2003.

I noticed that one of my pages was being displayed with content from a parent node in addition to the of the control it hosted. Since the page only serves as a host for an ascx control, it has no content of its own.

The content area of the node is empty, so I am at a loss of where this content is coming from.

I have done the following things to attempt to resolve the problem, but none of them resulted in the page in question changing at all. The page persists.

  • I've published the node again.
  • I've clicked the unpublish button, and then published the node.
  • I've cleared my browsers cache.
  • I've used multiple browsers.
  • I've used the incognito mode on Chrome.
  • I've changed the template the node is based on, which should have prevented the macro from running, but it didn't.
  • I've added content to the node. The new content didn't show up.
  • I've changed the node's name. When I reload the page under it's old name, it's still there.
  • I've touched web.config to restart the application. There was no change.
  • I've stopped and started the website.
  • I've right clicked on the top node of the site, and choose "republish"
  • I've manually deleted the umbraco.conf file under the data folder.
  • I've even deleted the node.

Nothing I do changes what appears when I navigate to the page. At this point, I should get a 404, but the page still loads and still runs the macro.

At this point, I am at a loss of what to do, but I'm guessing it has something to do with IIS or Dot.Net and caching.

Does anybody have an idea how to fix this?

EDIT

I have found that if I removed an XSLT macro reference from the template upon which the deleted page was built, the duplication of the parent page goes away when the deleted page loads in the browser. Since this was my primary problem, I've recreated the page and have gone on. I am still perplexed as to why the page I deleted was able to be loaded from multiple browsers.

The macro I removed is used in the majority of the 1,500+ pages of our web site, and on none of them does it reproduce the parent's document on the child, nor does it seem possible to me that an XSLT macro can reach outside of the XML cache. I've reviewed the code, and didn't see any references to an additional data store. I confess that XSLT is quite new to me.

The code for the macro whose reference I removed is listed below.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:Stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
<xsl:stylesheet 
  version="1.0" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  xmlns:msxml="urn:schemas-microsoft-com:xslt"
  xmlns:umbraco.library="urn:umbraco.library"
  xmlns:custom="urn:custom.library"
  exclude-result-prefixes="msxml umbraco.library custom">


<xsl:output method="xml" omit-xml-declaration="yes"/>

<msxml:script language="C#" implements-prefix="custom">

  public System.Xml.XPath.XPathNodeIterator SplitMultiPageText(string unsplitText, 
                                                               string pageDelimeter) {
    System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
    string[] splitPages = System.Text.RegularExpressions.Regex.Split(unsplitText, pageDelimeter);

    System.Xml.XmlElement pagesElement = xmlDoc.CreateElement("pages");

    foreach (string page in splitPages) {
      System.Xml.XmlElement pageElement = xmlDoc.CreateElement("page");
      pageElement.AppendChild(xmlDoc.CreateCDataSection(page));
      pagesElement.AppendChild(pageElement);
    }

    return pagesElement.CreateNavigator().Select(".");
  }

</msxml:script>

<xsl:param name="currentPage"/>

<xsl:variable name="content" select="/macro/content" />
<xsl:variable name="pageNumber" select="/macro/pageNumber" />
<xsl:variable name="joinContent">
  <xsl:choose>
    <xsl:when test="/macro/joinContent = ''">
      <xsl:value-of select="boolean(false)" />
    </xsl:when>
    <xsl:otherwise><xsl:value-of select="/macro/joinContent" /></xsl:otherwise>
  </xsl:choose>
</xsl:variable>

<xsl:variable name="splitExpr">&lt;hr class=&quot;pagebreak&quot; /&gt;</xsl:variable>

<xsl:template match="/">

  <xsl:variable name="pages" select="custom:SplitMultiPageText($content, $splitExpr)" />
  <xsl:variable name="pageCount" select="count($pages/page)" />

  <xsl:choose>
    <xsl:when test="$pageCount = 1 or string($joinContent) = 'true'">


      <xsl:for-each select="$pages/page">
        <xsl:value-of
          select="umbraco.library:RenderMacroContent(., $currentPage/@id)"
          disable-output-escaping="yes" />
      </xsl:for-each>

    </xsl:when>
    <xsl:otherwise>
      <p class="multiPageNotice">This document is split among multiple pages. To view
      the other pages, use the <strong>page selector</strong> near the bottom of the screen.</p>
      <xsl:for-each select="$pages/page">
        <xsl:if test="position() = $pageNumber or ( $pageNumber = '' and position() = 1 )">
          <xsl:value-of
            select="umbraco.library:RenderMacroContent(., $currentPage/@id)"
            disable-output-escaping="yes" />
        </xsl:if>
      </xsl:for-each>
    </xsl:otherwise>
  </xsl:choose>


  <xsl:if test="$pageCount &gt; 1 and string($joinContent) != 'true'">
    <div class="pageSelector">
      <p>Page: </p>
      <ul>
        <xsl:for-each select="$pages/page">
          <li>
            <xsl:choose>
              <xsl:when test="position() = $pageNumber or ( $pageNumber = '' and position() = 1 )">
                <xsl:value-of select="position()" />
              </xsl:when>
              <xsl:otherwise>
                <a href="{umbraco.library:NiceUrl($currentPage/@id)}/page/{position()}">
                  <xsl:value-of select="position()" />
                </a>
              </xsl:otherwise>
            </xsl:choose>
          </li>
        </xsl:for-each>
      </ul>
    </div>
  </xsl:if>

</xsl:template>

</xsl:stylesheet>
1
I still don't know why it is doing what it is, but I identified what was causing the content to be replicated from the parent node. There is a macro, which is in every template we have, that, when removed, the problem of duplicated content goes away. I don't, however, understand why a deleted page is still showing up. The macro is <umbraco:Macro runat="server" Alias="Paginate" macroAlias="Paginate" content="[#bodyContent]" pageNumber="[@page]" joinContent="true" />.Andrew Neely

1 Answers

1
votes

Given your comment, it's possible that the macro persists content to a store that is independent of the application/umbraco config, e.g. an xml file or a db-based session. This would obviously persist the data outside of the application restarting. Obviously, we would have to see the code for the macro though.