Copied to clipboard

Flag this post as spam?

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


  • Stephen 204 posts 246 karma points
    Aug 28, 2011 @ 16:54
    Stephen
    0

    XLST being visualised but not wokring

    I've written some XSLT to display sub pages on my home page if true false etc and when i run the visualiser it displays the content as it should, when i run the marco in the page in the browser i get "<Macro: doShowOnHomepage (,)> "

    Where have i gone wrong?

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


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

        <xsl:param name="currentPage"/>
    <xsl:param name="MaxNoChars" select="200" />
    <xsl:template match="/">

      
      <xsl:for-each select="$currentPage//ancestor-or-self::doTextpage[@isDoc and showOnHomepage = '1']">     
      <div class="redPanel">
        <h2><xsl:value-of select="@nodeName" /></h2>
        <p><xsl:value-of select="umbraco.library:TruncateString(umbraco.library:StripHtml(current()/bodyText), $MaxNoChars, '...')" /><href="{umbraco.library:NiceUrl(@id)}"Read more </a></p>
      
        </div>
        </xsl:for-each>

    </xsl:template>

    </xsl:stylesheet>

  • Rich Green 2246 posts 4008 karma points
    Aug 28, 2011 @ 18:31
    Rich Green
    0

    Hi,

    I think your XSLT might depend on where you are on the site.

    You can try swapping your loop code out for

    <xsl:variable name="currentSiteRoot" select="$currentPage/ancestor-or-self::* [@isDoc]" />

    <xsl:for-each select="$currentSiteRoot/descendant::* [@isDoc and name()='doTextPage' and string(showOnHomePage) = '1']">

    </xsl:for-each>

    Rich

      
      

  • Stephen 204 posts 246 karma points
    Aug 28, 2011 @ 20:49
    Stephen
    0

    Thanks Rich, turned out i had a duplicate entry which was causing confusion, all working now.

    Cheers,

     

    S

  • Rich Green 2246 posts 4008 karma points
    Aug 28, 2011 @ 21:08
    Rich Green
    0

    Glad you got it working :)

    Rich

Please Sign in or register to post replies

Write your reply to:

Draft