I have editted the template 'printliste' to write down the name of every node under the parent node 'currentPage' but it shows nothing, despite there being 700 pages under the root in the website, and at least 7 pages that should be showing up on the menu.
Ah of course, I read that in the description of the new schema but it didnt click. Since today is my first time ever reading xslt ill have to ask for some help translating my script into the new schema, sorry!
$current/node holds no data
Since upgrading to 4.5.2 I have had problems with my navigation bar.
I have isolated the xslt page that generates the menu and found the specific template as well.
Here is the 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"
exclude-result-prefixes="msxml umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:param name="currentPage"/>
<xsl:variable name="level" select="1"/>
<xsl:template match="/">
<div class="navtree">
<table cellspacing="0"><tr><td id="navleft"></td>
<td id="navcentre">
<ul><li>
<xsl:if test="$currentPage/@nodeName = 'Home'">
<xsl:attribute name="class">current</xsl:attribute>
</xsl:if>
<a href="/">Home</a></li></ul>
<xsl:call-template name="printListe">
<xsl:with-param name="node" select="$currentPage/ancestor-or-self::*[@isDoc] [@level = 1]"/>
<xsl:with-param name="id" select="string('treemenu1')"/>
</xsl:call-template>
</td>
<td id="navright"></td>
</tr></table>
</div>
</xsl:template>
<xsl:template name="printListe">
<xsl:param name="node"/>
<xsl:param name="id"/>
<ul>
<xsl:for-each select="$currentPage/node">
<xsl:value-of select="current()/@nodeName"/>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
I have editted the template 'printliste' to write down the name of every node under the parent node 'currentPage' but it shows nothing, despite there being 700 pages under the root in the website, and at least 7 pages that should be showing up on the menu.
Can anybody see a reason for this?
Thanks,
Max.
Max,
Thats becuase in new schema you dont have node replace it with $currentPage/*[@isDoc]
Regards
Ismail
Ah of course, I read that in the description of the new schema but it didnt click. Since today is my first time ever reading xslt ill have to ask for some help translating my script into the new schema, sorry!
here is the full script:
<?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="level" select="1"/>
<xsl:template match="/">
<div class="navtree">
<table cellspacing="0"><tr><td id="navleft"></td>
<td id="navcentre">
<ul><li>
<xsl:if test="$currentPage/@nodeName = 'Home'">
<xsl:attribute name="class">current</xsl:attribute>
</xsl:if>
<a href="/">Home</a></li></ul>
<xsl:call-template name="printListe">
<xsl:with-param name="node" select="$currentPage/ancestor-or-self::*[@isDoc] [@level = 1]"/>
<xsl:with-param name="id" select="string('treemenu1')"/>
</xsl:call-template>
</td>
<td id="navright"></td>
</tr></table>
</div>
</xsl:template>
<xsl:template name="printListe">
<xsl:param name="node"/>
<xsl:param name="id"/>
<xsl:if test="$node/node [string(./umbracoNaviHide) != '1' and string(../../../@nodeName) != 'Blog']">
<ul>
<xsl:if test="$id != ''">
<xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
</xsl:if>
<xsl:for-each select="$node/node [string(./umbracoNaviHide) != '1']">
<xsl:sort select="@sortOrder" order="ascending" data-type="number" />
<li>
<xsl:if test="$currentPage/ancestor-or-self::*[@isDoc]/@id = current()/@id">
<xsl:attribute name="class">current</xsl:attribute>
</xsl:if>
<a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a>
<xsl:if test="count(./node) > 0">
<xsl:call-template name="printListe">
<xsl:with-param name="node" select="."/>
</xsl:call-template>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
run your xslt through excellent http://our.umbraco.org/projects/developer-tools/xsltupdater-for-umbraco will do most of the grunt work for you
Already done that, my file is what it saved.
I think iv got it worked out though :) Thanks for your help!!
is working on a reply...