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
I'm working on a jscript slideshow, but I want to add a number on each picture.
How can I get a number for each slide so I can make a navigation. For each slide a node is created, where the data. The xslt is as follows:
<div id="slider"> <div id="mask-gallery"> <ul id="gallery"> <xsl:for-each select="umbraco.library:GetXmlNodeById($source)/* [@isDoc and string(umbracoNaviHide) != '1']"> <li> <xsl:if test="afbeeldingSlide > 0"> <xsl:variable name="mediaNode" select="umbraco.library:GetMedia(afbeeldingSlide, 0)" /> <xsl:if test="$mediaNode/umbracoFile"> <img src="{$mediaNode/umbracoFile}" height="{$mediaNode/umbracoHeight}" width="{$mediaNode/umbracoWidth}" /> </xsl:if> </xsl:if> </li> </xsl:for-each> </ul> </div> <div id="mask-excerpt"> <ul id="excerpt"> <xsl:for-each select="umbraco.library:GetXmlNodeById($source)/* [@isDoc and string(umbracoNaviHide) != '1']"> <xsl:if test="tekstSlide != ''"> <li> <h1> <xsl:value-of select="(tekstSlide)" disable-output-escaping="yes"/> </h1> <xsl:if test="string(linkNaarPaginaSlide) != ''"> <a href="{umbraco.library:NiceUrl(linkNaarPaginaSlide)}" id="slidebtn" title="{knoptekstSlide}"> <div class="btn-linkslideleft"> </div> <div class="btn-linkslidecenter"><xsl:value-of select="(knoptekstSlide)" disable-output-escaping="yes"/></div> <div class="btn-linkslideright"> </div> </a> </xsl:if> </li> </xsl:if> </xsl:for-each> </ul> </div> </div><div id="slidenav"> <a href="#" id="btn-prev"><img src="/images/navslide-left.png" title="Vorige" /></a> <a href="#" id="btn-next"><img src="/images/navslide-right.png" title="Volgende" /></a></div>
I tried the following thing, but no succes... Please help me on this one
<div id="pagingnav"> <xsl:variable name="allNodes" select="umbraco.library:GetXmlNodeById(1126)" /> <xsl:variable name="numbOfNodes" select="count"/> <xsl:for-each select="($numbOfNodes)"> <xsl:variable name="thisNum" select="text()" /> <xsl:variable name="thisNode" select="$allNodes[position() = $thisNum]" /> <a href="#" rel="item{thisNode}"><xsl:value-of select="(thisNode)" disable-output-escaping="yes"/></a> </xsl:for-each></div>
Hey
Replace
<ahref="#"rel="item{thisNode}"><xsl:value-ofselect="(thisNode)"disable-output-escaping="yes"/></a>
with
<ahref="#"rel="item{$thisNode}"><xsl:value-ofselect="($thisNode)"disable-output-escaping="yes"/></a>
The sneaky little dollar sign is missing...
Cheers
Nigel
Thanks Nigel, that was some code I missed, but that doesn't do the trick.
I know that it have something to do with this line:
<xsl:variablename="numbOfNodes"select="count"/>
That must be something like this:
<xsl:variablename="numbOfNodes"select="count($allNodes)"/>
But then I get the following error:
System.Xml.Xsl.XslLoadException: Expression must evaluate to a node-set.
Hi Niels,
May be you could try something like
<divid="pagingnav"> <xsl:variablename="allNodes"select="umbraco.library:GetXmlNodeById(1126)"/> <xsl:for-eachselect="$allNodes"> <a href="#"> <xsl:attribute name="rel"> <xsl:value-of select="position()" /> </xsl:attribute> <xsl:value-of select="position()" /> </a> </xsl:for-each></div>
Hi Fuji, It returned a number but only one (there are 4 childnodes). So i guess that only the parent node gets a number. I tried to fix it with:
<xsl:variablename="allNodes"select="umbraco.library:GetXmlNodeById(1126)/node"/>
But it didn't worked.
If am not wrong you are already picking your source id where you are displaying your nodeName and Url right?
So i guess you could just leave it like this
<xsl:variable name="allNodes" select="umbraco.library:GetXmlNodeById($source)"/> <xsl:for-each select="$allNodes"> <ahref="#"> <xsl:attributename="rel"> <xsl:value-ofselect="position()"/> </xsl:attribute> <xsl:value-ofselect="position()"/> </a> </xsl:for-each>
Yes, thats true, but it only returns this:
<a rel="1" href="#">1</a>
But there are 4 subnodes/childs. But there not showing. I would like to see the following output:
<a rel="1" href="#">1</a><a rel="2" href="#">2</a><a rel="3" href="#">3</a><a rel="4" href="#">4</a>
Niels can you show us your full xslt 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:variable name="source" select="/macro/source"/><xsl:template match="/"><!-- The fun starts here --><div id="slider"> <div id="mask-gallery"> <ul id="gallery"> <xsl:for-each select="umbraco.library:GetXmlNodeById($source)/* [@isDoc and string(umbracoNaviHide) != '1']"> <li> <xsl:if test="afbeeldingSlide > 0"> <xsl:variable name="mediaNode" select="umbraco.library:GetMedia(afbeeldingSlide, 0)" /> <xsl:if test="$mediaNode/umbracoFile"> <img src="{$mediaNode/umbracoFile}" height="{$mediaNode/umbracoHeight}" width="{$mediaNode/umbracoWidth}" /> </xsl:if> </xsl:if> </li> </xsl:for-each> </ul> </div> <div id="mask-excerpt"> <ul id="excerpt"> <xsl:for-each select="umbraco.library:GetXmlNodeById($source)/* [@isDoc and string(umbracoNaviHide) != '1']"> <xsl:if test="tekstSlide != ''"> <li> <h1> <xsl:value-of select="(tekstSlide)" disable-output-escaping="yes"/> </h1> <xsl:if test="string(linkNaarPaginaSlide) != ''"> <a href="{umbraco.library:NiceUrl(linkNaarPaginaSlide)}" id="slidebtn" title="{knoptekstSlide}"> <div class="btn-linkslideleft"> </div> <div class="btn-linkslidecenter"><xsl:value-of select="(knoptekstSlide)" disable-output-escaping="yes"/></div> <div class="btn-linkslideright"> </div> </a> </xsl:if> </li> </xsl:if> </xsl:for-each> </ul> </div> </div><div id="slidenav"> <a href="#" id="btn-prev"><img src="/images/navslide-left.png" title="Vorige" /></a> <a href="#" id="btn-next"><img src="/images/navslide-right.png" title="Volgende" /></a></div><div id="links"><xsl:variable name="allNodes" select="umbraco.library:GetXmlNodeById($source)"/> <xsl:for-each select="$allNodes"> <a href="#"> <xsl:attribute name="rel"> <xsl:value-of select="position()"/> </xsl:attribute> <xsl:value-of select="position()"/> </a> </xsl:for-each></div> </xsl:template></xsl:stylesheet>
Can you try this
<xsl:variablename="source"select="/macro/source"/>
<xsl:variablename="allNodes"select="umbraco.library:GetXmlNodeById($source)"/>
<xsl:templatematch="/"><!-- The fun starts here --><divid="slider"> <divid="mask-gallery"> <ulid="gallery"> <xsl:for-eachselect="umbraco.library:GetXmlNodeById($source)/* [@isDoc and string(umbracoNaviHide) != '1']"> <li> <xsl:iftest="afbeeldingSlide > 0"> <xsl:variablename="mediaNode"select="umbraco.library:GetMedia(afbeeldingSlide, 0)"/> <xsl:iftest="$mediaNode/umbracoFile"> <imgsrc="{$mediaNode/umbracoFile}"height="{$mediaNode/umbracoHeight}"width="{$mediaNode/umbracoWidth}"/> </xsl:if> </xsl:if> </li> </xsl:for-each> </ul> </div> <divid="mask-excerpt"> <ulid="excerpt"> <xsl:for-eachselect="umbraco.library:GetXmlNodeById($source)/* [@isDoc and string(umbracoNaviHide) != '1']"> <xsl:iftest="tekstSlide != ''"> <li> <h1> <xsl:value-ofselect="(tekstSlide)"disable-output-escaping="yes"/> </h1> <xsl:iftest="string(linkNaarPaginaSlide) != ''"> <ahref="{umbraco.library:NiceUrl(linkNaarPaginaSlide)}"id="slidebtn"title="{knoptekstSlide}"> <divclass="btn-linkslideleft"></div> <divclass="btn-linkslidecenter"><xsl:value-ofselect="(knoptekstSlide)"disable-output-escaping="yes"/></div> <divclass="btn-linkslideright"></div> </a> </xsl:if> </li> </xsl:if> </xsl:for-each> </ul> </div> </div><divid="slidenav"> <ahref="#"id="btn-prev"><imgsrc="/images/navslide-left.png"title="Vorige"/></a> <ahref="#"id="btn-next"><imgsrc="/images/navslide-right.png"title="Volgende"/></a></div><divid="links"> <xsl:for-eachselect="$allNodes"> <ahref="#"> <xsl:attributename="rel"> <xsl:value-ofselect="position()"/> </xsl:attribute> <xsl:value-ofselect="position()"/> </a> </xsl:for-each></div> </xsl:template>
Still the only output I get is:
<arel="1"href="#">1</a>
I made a mistake there, if am not mistaken you are picking your source from a website structured like this right?
.Content
-- Default
--- Folder ---- Sub Folder 1---- Sub Folder 2---- Sub Folder 3---- Sub Folder 4
<xsl:variable name="allNodes" select="umbraco.library:GetXmlNodeById($source)/* [@isDoc and string(umbracoNaviHide) != '1']"/>
//fuji
Yes just like that, stupid me. The other elements in this xslt are just the same.
Code blindness all the way.
Thank you very much, karma for you!
Great if its working Niels.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Numbering nodes for slideshow
I'm working on a jscript slideshow, but I want to add a number on each picture.
How can I get a number for each slide so I can make a navigation. For each slide a node is created, where the data. The xslt is as follows:
I tried the following thing, but no succes... Please help me on this one
Hey
Replace
<ahref="#"rel="item{thisNode}"><xsl:value-ofselect="(thisNode)"disable-output-escaping="yes"/></a>
with
<ahref="#"rel="item{$thisNode}"><xsl:value-ofselect="($thisNode)"disable-output-escaping="yes"/></a>
The sneaky little dollar sign is missing...
Cheers
Nigel
Thanks Nigel, that was some code I missed, but that doesn't do the trick.
I know that it have something to do with this line:
<xsl:variablename="numbOfNodes"select="count"/>
That must be something like this:
<xsl:variablename="numbOfNodes"select="count($allNodes)"/>
But then I get the following error:
System.Xml.Xsl.XslLoadException: Expression must evaluate to a node-set.
Hi Niels,
May be you could try something like
Hi Fuji, It returned a number but only one (there are 4 childnodes). So i guess that only the parent node gets a number. I tried to fix it with:
<xsl:variablename="allNodes"select="umbraco.library:GetXmlNodeById(1126)/node"/>
But it didn't worked.
Hi Niels,
If am not wrong you are already picking your source id where you are displaying your nodeName and Url right?
So i guess you could just leave it like this
Yes, thats true, but it only returns this:
But there are 4 subnodes/childs. But there not showing. I would like to see the following output:
Niels can you show us your full xslt code?
Can you try this
Still the only output I get is:
I made a mistake there, if am not mistaken you are picking your source from a website structured like this right?
.Content
-- Default
--- Folder
---- Sub Folder 1
---- Sub Folder 2
---- Sub Folder 3
---- Sub Folder 4
<xsl:variable name="allNodes" select="umbraco.library:GetXmlNodeById($source)/* [@isDoc and string(umbracoNaviHide) != '1']"/>
//fuji
Yes just like that, stupid me. The other elements in this xslt are just the same.
Code blindness all the way.
Thank you very much, karma for you!
Great if its working Niels.
is working on a reply...