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
Hey all
I have the following structure
Home
>>>> content page
>>>> usefull links (this has a doc type of "textpage"
>>>>>>>> link item 1 (doctype "tmLinksPage"
>>>>>>>> link item 2 (doctype "tmLinksPage"
and using the following code i can prodcuce a list of link items on the home page but when i navigate to child page of home they dont appear...
<?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:variable name="noOfItems" select="5" /> <xsl:param name="MaxNoChars" select="25" /> <xsl:template match="/"> <h2>Usefull Links</h2> <ul> <xsl:for-each select="$currentPage//ancestor-or-self::tmLinksPage[@isDoc]"> <xsl:sort select="@createDate" order="ascending"/> <li> <a href="{umbraco.library:StripHtml(current()/linkURL)}" target="_blank" Title="Click here to visit {umbraco.library:StripHtml(current()/linkTitle)}"><xsl:value-of select="umbraco.library:TruncateString(umbraco.library:StripHtml(current()/linkTitle), $MaxNoChars, '...')" /></a> </li> </xsl:for-each> </ul> <p><a href="">View all</a></p> </xsl:template></xsl:stylesheet>
any ideas?
need to change your for-each construct
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level = '1']//* [name() = 'tmLinksPage'">
so, using above construct, you're always first travelling up site, starting from currentPage, up to node at level 1 (which will be your 'Home' page), and then search for all documents of type tmLinksPage
Hope this helps.
Regards,
/Dirk
Just a small type Dirk (missing a closing ]), thanks for the post..
<xsl:for-eachselect="$currentPage/ancestor-or-self::* [@level = '1']//* [name() = 'tmLinksPage']">
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Content displays on home page but not child of home
Hey all
I have the following structure
Home
>>>> content page
>>>> content page
>>>> usefull links (this has a doc type of "textpage"
>>>>>>>> link item 1 (doctype "tmLinksPage"
>>>>>>>> link item 2 (doctype "tmLinksPage"
and using the following code i can prodcuce a list of link items on the home page but when i navigate to child page of home they dont appear...
<?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:variable name="noOfItems" select="5" />
<xsl:param name="MaxNoChars" select="25" />
<xsl:template match="/">
<h2>Usefull Links</h2>
<ul>
<xsl:for-each select="$currentPage//ancestor-or-self::tmLinksPage[@isDoc]">
<xsl:sort select="@createDate" order="ascending"/>
<li>
<a href="{umbraco.library:StripHtml(current()/linkURL)}" target="_blank" Title="Click here to visit {umbraco.library:StripHtml(current()/linkTitle)}"><xsl:value-of select="umbraco.library:TruncateString(umbraco.library:StripHtml(current()/linkTitle), $MaxNoChars, '...')" /></a>
</li>
</xsl:for-each>
</ul>
<p><a href="">View all</a></p>
</xsl:template>
</xsl:stylesheet>
any ideas?
need to change your for-each construct
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level = '1']//* [name() = 'tmLinksPage'">
so, using above construct, you're always first travelling up site, starting from currentPage, up to node at level 1 (which will be your 'Home' page), and then search for all documents of type tmLinksPage
Hope this helps.
Regards,
/Dirk
Just a small type Dirk (missing a closing ]), thanks for the post..
<xsl:for-eachselect="$currentPage/ancestor-or-self::* [@level = '1']//* [name() = 'tmLinksPage']">
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.