Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
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 " ">]><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, '...')" /><a href="{umbraco.library:NiceUrl(@id)}"> Read more </a></p> </div> </xsl:for-each></xsl:template></xsl:stylesheet>
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>
Thanks Rich, turned out i had a duplicate entry which was causing confusion, all working now.
Cheers,
S
Glad you got it working :)
Rich
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
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 " ">
]>
<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, '...')" /><a href="{umbraco.library:NiceUrl(@id)}"> Read more </a></p>
</div>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
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>
Thanks Rich, turned out i had a duplicate entry which was causing confusion, all working now.
Cheers,
S
Glad you got it working :)
Rich
is working on a reply...