XSLT issues on 4.5.2 with a previously working macro
I'm porting a site over from an older version of Umbraco and attempting to update it to the most recent version of XSLT schema. The macro i'm trying to rewrite provides prev/next functionality for my news section. Here is the XSLT file:
The problem is count($currentPage/preceding-sibling::node) always returns 0 when there are siblings on either side of the current node. This markup worked in 4.0 so i'm not sure if i'm missing some kind of attribute or what to match the new schema format.
Glad this helped you out. It's a very common piece of functionality and as frustrating as the new markup changes are in 4.5, I wouldn't mind sticking it in the wiki.
XSLT issues on 4.5.2 with a previously working macro
I'm porting a site over from an older version of Umbraco and attempting to update it to the most recent version of XSLT schema. The macro i'm trying to rewrite provides prev/next functionality for my news section. Here is the XSLT file:
[CODE]
<?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"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:template match="/">
<xsl:variable name="picFile" select="count($currentPage/preceding-sibling::node)"/>
<xsl:copy-of select="$picFile" />
<xsl:if test="count($currentPage/preceding-sibling::node) != 0">
<strong>Previous Article:</strong>
<a href="{umbraco.library:NiceUrl($currentPage/preceding-sibling::node[1]/@id)}">
<xsl:value-of select="$currentPage/preceding-sibling::node[1]/data ['entryTitle']"/>
</a>
<br />
</xsl:if>
<xsl:if test="count($currentPage/following-sibling::node) != 0">
<strong>Next Article:</strong>
<a href="{umbraco.library:NiceUrl($currentPage/following-sibling::node[1]/@id)}">
<xsl:value-of select="$currentPage/following-sibling::node[1]/data ['entryTitle']"/>
</a>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
[/CODE]
The problem is count($currentPage/preceding-sibling::node) always returns 0 when there are siblings on either side of the current node. This markup worked in 4.0 so i'm not sure if i'm missing some kind of attribute or what to match the new schema format.
Any help appreciated. Thanks.
If someone could tell me how to post XSLT snippets here i'd be happy to repost my code. I keep getting an error trying to edit that post.
Well, seeing that I wouldn't get any help here, i thought i'd keep beating my head against the wall. Here is the solution if anyone cares.
If I had 70 karma points, I'd high-five! your answer - I had the same problem with the new 4.5 mark-up, your solution helped, cheers!
Perhaps we should stick it in the wiki somewhere..
Glad this helped you out. It's a very common piece of functionality and as frustrating as the new markup changes are in 4.5, I wouldn't mind sticking it in the wiki.
is working on a reply...