I've got the following XSLT code which lists out the folders and their file items from a specified node.
This all works fine but I'd like to parameterise the page and optionally filter its output by a tag value.
Being an XLST numpty I'm stumped with the syntax for the conditional I should be putting in under the 'test=$tag' clause - can someone please help ?
<xsl:templatematch="/"> <!-- Root folder in Media that holds the folders to output --> <xsl:variablename="mediaRootFolderId"select="5948"/>
<!-- Pass in true() to get XML for all nodes below --> <xsl:variablename="mediaRootNode"select="umbraco.library:GetMedia($mediaRootFolderId, true())"/>
<xsl:choose> <xsl:whentest="$tag">
</xsl:when>
<xsl:otherwise> <!-- If we didn't get an error, output Folder elements that contain Image elements --> <xsl:apply-templatesselect="$mediaRootNode[not(error)]/Folder[File]"> <xsl:sortselect="@nodeName"/> </xsl:apply-templates>
Thanks for the offer but I posted this problem, went away for a few hours then [as I've done before] came back & solved the problem.
In answer to your question; Yes, the code lists out media folders & files and if a tag value is specified then the output is restricted to filoes with that tag.
xsl:apply-templates Conditional Syntax
I've got the following XSLT code which lists out the folders and their file items from a specified node.
This all works fine but I'd like to parameterise the page and optionally filter its output by a tag value.
Being an XLST numpty I'm stumped with the syntax for the conditional I should be putting in under the 'test=$tag' clause - can someone please help ?
Hi Chris,
Could you elaborate a bit and maybe explain a specific scenario? Are you trying to only process some of the files?
/Chriztian
Hi Chriztian,
Thanks for the offer but I posted this problem, went away for a few hours then [as I've done before] came back & solved the problem.
In answer to your question;
Yes, the code lists out media folders & files and if a tag value is specified then the output is restricted to filoes with that tag.
Chris C.
Hey, could you perhaps post your fixed code? As i have a somewhat, similar problem.
I'm afraid I didn't solve the problem - only thought I did for a while
I posted up my 'solution' tried it out at work and realised it was never going to work.
I've abandoned using Umbraco tags against media items, they seem to be poorly documented and the functions unreliable.
Sorry I can't help.
Chris C.
is working on a reply...