Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • syn-rg 282 posts 425 karma points
    Jun 10, 2011 @ 05:56
    syn-rg
    0

    Print this Page not working when parent node is redirected

    I have a Print this Page macro which has three options:

    1. Print all pages in the content tree
    2. Print the current page, it's parent and all it's siblings
    3. Print the current page.

    However if a parent node is redirected none of the child nodes will print.

    What do I need to adjust in my XSLT to get this working on child nodes whose parent nodes have been redirected?
    Note: The parent node is being redirected to the first child node.

    Here's my XSLT:

    <?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"
    exclude-result-prefixes="msxml umbraco.library">


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

    Current Page's parent, sibling with families
    Current page and all children
    Current page Only

    -->
    <xsl:param name="currentPage"/>

    <xsl:template match="/">

    <!-- Parent and sibling families -->

    <xsl:for-each select="$currentPage/parent/node [string(data [@alias='umbracoNaviHide']) != '1' and (umbraco.library:IsProtected(@id, @path) = false() or umbraco.library:HasAccess(@id, @path) = true()) and @nodeTypeAlias != 'Site' and @nodeTypeAlias != 'Poll' and @nodeTypeAlias != 'PollAnswer' and @nodeTypeAlias != 'Polls' and @nodeTypeAlias != 'nitroGalleryPhoto' and @nodeTypeAlias != 'PrintPage' and @nodeTypeAlias != 'DateFolder' and @nodeTypeAlias != 'Latest News' and @nodeTypeAlias != 'LatestNewsPost' and @nodeTypeAlias != 'whatsNew' and @nodeTypeAlias != 'quickLinks' and @nodeTypeAlias != 'imageSearchResults' and @nodeTypeAlias != 'search' and @nodeTypeAlias != 'documentFinder' and @nodeTypeAlias != 'documentLightbox' and @nodeTypeAlias != 'documentSearchResults' and @nodeTypeAlias != 'siteIndex' and @nodeTypeAlias != 'sitemap' and @nodeTypeAlias != 'webmaster' and @nodeTypeAlias != 'contactForm' and @nodeTypeAlias != 'nitroGallery']">
    <div id="print">
    <p>
    <a>
    <xsl:attribute name="href">PrintPages.aspx?nodeid=<xsl:value-of select="@id"/></xsl:attribute>
    <xsl:value-of select="@nodeName"/>
    </a>(<xsl:value-of select="count(child::node) + 1" />)
    </p>
    </div>
    </xsl:for-each>



    <xsl:call-template name="printPages">
    <xsl:with-param name="nodeName" select="$currentPage/parent::node/@nodeName"/>
    <xsl:with-param name="nodeId" select="$currentPage/@id"/>
    <xsl:with-param name="type" select="3"/>
    <xsl:with-param name="pageCount" select="count($currentPage/parent::node/descendant-or-self::node/node [string(data [@alias='umbracoNaviHide']) != '1' and (umbraco.library:IsProtected(@id, @path) = false() or umbraco.library:HasAccess(@id, @path) = true()) and @nodeTypeAlias != 'Site' and @nodeTypeAlias != 'Poll' and @nodeTypeAlias != 'PollAnswer' and @nodeTypeAlias != 'Polls' and @nodeTypeAlias != 'nitroGalleryPhoto' and @nodeTypeAlias != 'PrintPage' and @nodeTypeAlias != 'DateFolder' and @nodeTypeAlias != 'Latest News' and @nodeTypeAlias != 'LatestNewsPost' and @nodeTypeAlias != 'whatsNew' and @nodeTypeAlias != 'quickLinks' and @nodeTypeAlias != 'imageSearchResults' and @nodeTypeAlias != 'search' and @nodeTypeAlias != 'documentFinder' and @nodeTypeAlias != 'documentLightbox' and @nodeTypeAlias != 'documentSearchResults' and @nodeTypeAlias != 'siteIndex' and @nodeTypeAlias != 'sitemap' and @nodeTypeAlias != 'webmaster' and @nodeTypeAlias != 'contactForm' and @nodeTypeAlias != 'nitroGallery']) + 0"/>
    </xsl:call-template>

    <!-- Current Page All Children -->
    <xsl:if test="count($currentPage/descendant::node [string(data [@alias='umbracoNaviHide']) != '1' and (umbraco.library:IsProtected(@id, @path) = false() or umbraco.library:HasAccess(@id, @path) = true()) and @nodeTypeAlias != 'Site' and @nodeTypeAlias != 'Poll' and @nodeTypeAlias != 'PollAnswer' and @nodeTypeAlias != 'Polls' and @nodeTypeAlias != 'nitroGalleryPhoto' and @nodeTypeAlias != 'PrintPage' and @nodeTypeAlias != 'DateFolder' and @nodeTypeAlias != 'Latest News' and @nodeTypeAlias != 'LatestNewsPost' and @nodeTypeAlias != 'whatsNew' and @nodeTypeAlias != 'quickLinks' and @nodeTypeAlias != 'imageSearchResults' and @nodeTypeAlias != 'search' and @nodeTypeAlias != 'documentFinder' and @nodeTypeAlias != 'documentLightbox' and @nodeTypeAlias != 'documentSearchResults' and @nodeTypeAlias != 'siteIndex' and @nodeTypeAlias != 'sitemap' and @nodeTypeAlias != 'webmaster' and @nodeTypeAlias != 'contactForm' and @nodeTypeAlias != 'nitroGallery']) &gt; 0">
    <xsl:call-template name="printPages">
    <xsl:with-param name="nodeName" select="$currentPage/@nodeName"/>
    <xsl:with-param name="nodeId" select="$currentPage/@id"/>
    <xsl:with-param name="type" select="2"/>
    <xsl:with-param name="pageCount" select="count($currentPage/descendant::node [string(data [@alias='umbracoNaviHide']) != '1' and (umbraco.library:IsProtected(@id, @path) = false() or umbraco.library:HasAccess(@id, @path) = true()) and @nodeTypeAlias != 'Site' and @nodeTypeAlias != 'Poll' and @nodeTypeAlias != 'PollAnswer' and @nodeTypeAlias != 'Polls' and @nodeTypeAlias != 'nitroGalleryPhoto' and @nodeTypeAlias != 'PrintPage' and @nodeTypeAlias != 'DateFolder' and @nodeTypeAlias != 'Latest News' and @nodeTypeAlias != 'LatestNewsPost' and @nodeTypeAlias != 'whatsNew' and @nodeTypeAlias != 'quickLinks' and @nodeTypeAlias != 'imageSearchResults' and @nodeTypeAlias != 'search' and @nodeTypeAlias != 'documentFinder' and @nodeTypeAlias != 'documentLightbox' and @nodeTypeAlias != 'documentSearchResults' and @nodeTypeAlias != 'siteIndex' and @nodeTypeAlias != 'sitemap' and @nodeTypeAlias != 'webmaster' and @nodeTypeAlias != 'contactForm' and @nodeTypeAlias != 'nitroGallery']) + 1"/>
    </xsl:call-template>
    </xsl:if>
    <!-- Current Page Only -->
    <xsl:call-template name="printPages">
    <xsl:with-param name="nodeName" select="'Current page'"/>
    <xsl:with-param name="nodeId" select="$currentPage/@id"/>
    <xsl:with-param name="type" select="1"/>
    <xsl:with-param name="pageCount" select="1"/>
    </xsl:call-template>


    </xsl:template>

    <xsl:template name="printPages">
    <xsl:param name="nodeName"/>
    <xsl:param name="nodeId"/>
    <xsl:param name="type"/>
    <xsl:param name="pageCount"/>
    <div id="print">
    <p>
    <a>
    <xsl:attribute name="href">PrintPages.aspx?nodeid=<xsl:value-of select="$nodeId"/>&amp;type=<xsl:value-of select="$type"/></xsl:attribute>
    <xsl:value-of select="$nodeName"/>
    </a>(<xsl:value-of select="$pageCount" />)
    </p>
    </div>

    </xsl:template>

    </xsl:stylesheet>

    Cheers,
    JV

Please Sign in or register to post replies

Write your reply to:

Draft