Gives me an XML result and I can loop that out in another XSLT file to show the images.. but for the life of me I can't get the sibling links to be shown .. have spent about 4 hours trying different variations to following-sibling / preceding-sibling syntax to get nothing. The code below looks to me like it should work but I get nothing other then the current folder name displayed.
The reason you can't access the siblings is that they're not present in the XML you get from GetMedia() - you only get the folder you ask for with its descendants.
I did think about going via the parent node .. but I kind of figured the sibling functions would basically do that sort of step for me, and I couldn't see any references anywhere that confilected with what I was trying to do.
The other reason is that generally multiple templates do my head in more then just general XSLT. For example I copied and pasted (yep lazy gettign you to do all my work) your code above and it gives this error.
"Expected end of the expression, found '='.@nodeTypeAlias -->=<-- 'Folder' "
and I'm not sure what that means. as the line I think it reffrers to looks syntaticaly correct to my eyes.
Regarding "multiple templates" in XSLT - I did a presentation on this at Codegarden '10 called "XSLT beyond <for-each>", which demonstrates how that works ... should be able to find it on stream.umbraco.org
Prceeding - Following Siblings from Media Library ID
I'm passing an Media folder ID via a Query string and want to print out a list of the sibling folders with links for a menu.
I can see that thecode
Gives me an XML result and I can loop that out in another XSLT file to show the images.. but for the life of me I can't get the sibling links to be shown .. have spent about 4 hours trying different variations to following-sibling / preceding-sibling syntax to get nothing. The code below looks to me like it should work but I get nothing other then the current folder name displayed.
Hi Jamie,
The reason you can't access the siblings is that they're not present in the XML you get from GetMedia() - you only get the folder you ask for with its descendants.
You need to grab the parent folder instead, e.g.:
<xsl:param name="currentPage" /> <xsl:param name="mediafolder" select="umbraco.library:RequestQueryString('gallery')" /> <xsl:param name="galleriesFolder" select="umbraco.library:GetMedia(PARENT_FOLDER_ID, true())" /> <xsl:template match="/"> <xsl:if test="normalize-space($mediafolder)"> <xsl:variable name="folder" select="$galleriesFolder/*[@nodeTypeAlias = 'Folder'][@id = $mediafolder]" /> <xsl:if test="$folder"> <ul> <xsl:apply-templates select="$folder/*[@nodeTypeAlias = 'Folder']" /> </ul> </xsl:if> </xsl:if> </xsl:template> <xsl:template match="@nodeTypeAlias = 'Folder'"> <li> <xsl:choose> <xsl:when test="@id = $mediafolder"> <xsl:attribute name="class">selected</xsl:attribute> <xsl:value-of select="@nodeName" /> </xsl:when> <xsl:otherwise> <a href="?gallery={@id}" class="external"> <xsl:value-of select="@nodeName" /> </a> </xsl:otherwise> </xsl:choose> </li> </xsl:template>/Chriztian
Thanks Chriztian,
I did think about going via the parent node .. but I kind of figured the sibling functions would basically do that sort of step for me, and I couldn't see any references anywhere that confilected with what I was trying to do.
The other reason is that generally multiple templates do my head in more then just general XSLT.
For example I copied and pasted (yep lazy gettign you to do all my work) your code above and it gives this error.
"Expected end of the expression, found '='. @nodeTypeAlias -->=<-- 'Folder' "
and I'm not sure what that means. as the line I think it reffrers to looks syntaticaly correct to my eyes.
Jamie
Hi Jamie,
Arg, sorry about that - bad error on my part. It should read like this:
Regarding "multiple templates" in XSLT - I did a presentation on this at Codegarden '10 called "XSLT beyond <for-each>", which demonstrates how that works ... should be able to find it on stream.umbraco.org
/Chriztian
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.