Hiya. I realy didnt want to be a pain in the neck with this guys sorry.
I tried pasting the code above in and got this
Error occured
System.OverflowException: Value was either too large or too small for an Int32. at System.Convert.ToInt32(Double value) at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider) at System.Xml.Xsl.Runtime.XmlQueryRuntime.ChangeTypeXsltArgument(XmlQueryType xmlType, Object value, Type destinationType) at System.Xml.Xsl.Runtime.XmlQueryContext.InvokeXsltLateBoundFunction(String name, String namespaceUri, IList`1[] args) at (XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current) at Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer) at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, TextWriter results) at umbraco.presentation.webservices.codeEditorSave.SaveXslt(String fileName, String oldName, String fileContents, Boolean ignoreDebugging)
<!-- Input the documenttype you want here --> <!-- Typically '1' for topnavigtaion and '2' for 2nd level --> <!-- Use div elements around this macro combined with css --> <!-- for styling the navigation --> <xsl:variable name="level" select="1"/>
<xsl:template match="/">
<!-- The fun starts here --> <ul> <xsl:for-each select="$currentPage/ancestor-or-self::* [@isDoc and @level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']"> <li> <a href="{umbraco.library:NiceUrl(@id)}"> <span class="l"></span> <span class="r"></span> <span class="t"><xsl:value-of select="@nodeName"/></span> </a> </li> </xsl:for-each> </ul>
</xsl:template>
</xsl:stylesheet>
This worked for me. From scratch I just created a new xslt with the template Navigation Prototype then copied your <li> ... </li> from your first post.
Then changed the output method to html.
All seems fine and in firefox with firebug I can see this in the html
List item style not displaying when used in xslt.
Hiya Guys. Bit of a long shot this one.
I have a style which works fine in html but when I try to implement the style in the standard topnavigation macro it breaks.
Ive tried editing the tag in the xslt file to output html 4 and ive looked at my stylesheet over and over again.
This works fine as part of the master page : -
<ul class="art-menu">
<li><a href="#" class=" active"><span class="l"></span><span class="r"></span><span class="t">Home</span></a></li>
</ul>
In the xslt i have it like this :-
<xsl:template match="/">
<ul class="art-menu">
<!-- The fun starts here -->
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level = $level]/* [string(umbracoNaviHide) != '1' and @isDoc]">
<li>
<a href="{umbraco.library:NiceUrl(@id)}"><span class="l"></span><span class="r"></span><span class="t"> <xsl:value-of select="@nodeName"/> </span> </a>
</li>
</xsl:for-each>
</xsl:template>
</ul>
Any thoughts?
Thanks
G
Tags with no content between them are converted in xslt (i.e. <span></span> will be come <span/>)
Try inserting a non-breaking space (i.e. <span> </span>)
Hiya, Tried this - didnt work! LOL. Good suggestion thanks!
I thought about it and realized that I had the same issue with my website about a year ago.
Here's the solution.
<xsl:text disable-output-escaping="yes">
<span class="l"></span>
<span class="r"></span>
</xsl:text>
Hi Glenn,
I think if you try changing
to
it will work.
Ben
Hiya!
like this?
<xsl:text disable-output-escaping="yes">
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level = $level]/* [string(umbracoNaviHide) != '1' and @isDoc]">
<li><a href="{umbraco.library:NiceUrl(@id)}"> <span class="l"> </span> <span class="r"> </span> <span class="t"><xsl:value-of select="@nodeName"/> </span></a></li>
</xsl:for-each>
</xsl:text>
Thanks.
I tried <xsl:output method="html" omit-xml-declaration="yes"/> and that didnt work sadly.
I tried again now using the above code with < > for < > and that didnt work either.
:) Feeling a bit stupid as both what you have said make some sense! Whys it not working??
You got it a bit out of sequence. Do the following:
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:text disable-output-escaping="yes">
<span class="l"></span>
<span class="r"></span>
</xsl:text>
<span class="t">
<xsl:value-of select="@nodeName"/>
</span>
</a>
</li>
Just noticed you have the second <ul> after the </xsl:template> try putting it inside the template and see if that helps
Ben
Glenn,
Aghy is is correct about the </ul> tag...
Do what I posted above and move the </ul> to just before </xsl:template>
Hiya. I realy didnt want to be a pain in the neck with this guys sorry.
I tried pasting the code above in and got this
Error occured
System.OverflowException: Value was either too large or too small for an Int32.
at System.Convert.ToInt32(Double value)
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
at System.Xml.Xsl.Runtime.XmlQueryRuntime.ChangeTypeXsltArgument(XmlQueryType xmlType, Object value, Type destinationType)
at System.Xml.Xsl.Runtime.XmlQueryContext.InvokeXsltLateBoundFunction(String name, String namespaceUri, IList`1[] args)
at (XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current)
at Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer)
at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, TextWriter results)
at umbraco.presentation.webservices.codeEditorSave.SaveXslt(String fileName, String oldName, String fileContents, Boolean ignoreDebugging)
Check the ignore error box and save again.
Or you can wrap the code in an xsl:if statement to check for a value.
It's a common error and can be ignored if your confident that the id will be available to the xslt.
Could you paste your entire xslt here? I'll give it a once over.
<?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:HelloWorldExt="urn:HelloWorldExt"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets HelloWorldExt ">
<xsl:output method="html" omit-xml-declaration="yes" />
<xsl:param name="currentPage"/>
<!-- Input the documenttype you want here -->
<!-- Typically '1' for topnavigtaion and '2' for 2nd level -->
<!-- Use div elements around this macro combined with css -->
<!-- for styling the navigation -->
<xsl:variable name="level" select="1"/>
<xsl:template match="/">
<!-- The fun starts here -->
<ul>
<xsl:for-each select="$currentPage/ancestor-or-self::* [@isDoc and @level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<span class="l"></span>
<span class="r"></span>
<span class="t"><xsl:value-of select="@nodeName"/></span>
</a>
</li>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
This worked for me. From scratch I just created a new xslt with the template Navigation Prototype then copied your <li> ... </li> from your first post.
Then changed the output method to html.
All seems fine and in firefox with firebug I can see this in the html
Ben
Brilliant!
is working on a reply...