I am trying to list the latest blog post. The code below works fine on umbraco 4 but dosn't work on 5.4.1. The content structure is still the same. Is there been a change on how umbraco reads XSLT.
So I have ran into another
problem with the blog. If I nest the blog outside the website node the
post comments function work fine, if I move the blog inside the website the
post comment function does not work correctly. Any thought on how to get this
to work.
XSLT/macro List Latest Blog post
I am trying to list the latest blog post. The code below works fine on umbraco 4 but dosn't work on 5.4.1. The content structure is still the same. Is there been a change on how umbraco reads XSLT.
<?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" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:tagsLib="urn:tagsLib" xmlns:BlogLibrary="urn:BlogLibrary"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets tagsLib BlogLibrary ">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:param name="currentPage"/>
<!-- Input the documenttype you want here -->
<xsl:variable name="level" select="5"/>
<xsl:variable name="noOfItems" select="3" />
<xsl:template match="/">
<!-- The fun starts here -->
<br/>
<ul class="events">
<xsl:for-each select=" $currentPage/ancestor-or-self::root//node [@nodeTypeAlias ='Blog']/descendant::node[@level=5]/node[string(data[@alias='umbracoNaviHide']) != '1'] ">
<xsl:if test="position()<= $noOfItems">
<span class="footerboxevents">
<li>
<xsl:value-of select="umbraco.library:FormatDateTime(@createDate, 'dd.MM.yy')"/> <br/>
<a href="{umbraco.library:NiceUrl(@id)}">
<span style="font-size:14px;" class="footerboxevents"> <xsl:value-of select="@nodeName"/> </span>
</a>
<hr/>
</li>
</span>
</xsl:if>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
Hi Eric.
What happens if you try this for-each:
/Kim A
Thanks that did the trick. Is there a different way to write xslt for 4.5.1 vs. 4?
Glad it worked out for you Eric.
In v4.5 and 4.5.1 the XML schema has changed so you need to write some different XSLT. You can see some examples here: http://our.umbraco.org/wiki/reference/xslt/45-xml-schema and here: http://our.umbraco.org/wiki/reference/xslt/45-xml-schema/xslt-examples-updated-to-new-schema
Actually, the new schema makes very good sense, so just go for it, and ask in here if anything doesn't go as you hoped for :)
/Kim A
So I have ran into another problem with the blog. If I nest the blog outside the website node the post comments function work fine, if I move the blog inside the website the post comment function does not work correctly. Any thought on how to get this to work.
is working on a reply...