Simple retrieval of media files based on custom property
I am fairly new to XSLT and have been scouring the Forum for ages to my apologies that this is so simple.I have a set of files in my media area contained in a folder structure like this:Forms > Uniforms > winter.pdfForms > Uniforms > summer.pdfForms > Canteen > pricelist.pdfetcI have given them a True / False property called quickForm as I want to display the ones selected as a "hotlist" on my home page.<pre><xsl:param name="currentPage"/> <xsl:template match="/"> <ul> <xsl:if test="./data [@alias = 'pdfFile'] != ''"> <a href="{umbraco.library:GetMedia(./data [@alias = 'quickForm'],'false')/data [@alias = 'umbracoFile']}">Download PDF</a> </xsl:if> </ul> </xsl:template></pre>This is my current version of the code.Any help would be most appreciated
Reason whyyou can not getit to workis that you are using a version of Umbraco that is using the new XML schema. The new schema was introduced from version 4.5,
Looking forward to hear which version you are using. After that maybe I can help you to get your xslt right.
I've started to realise that it's rather confusing as there's not many examples out there with the new schema!
I have got this to display the files in my forms folder only after specifying the folder id, I still haven't got it to display the files in subfolders with my quickForm (True/False) property. Are you able to help me with that Dennis?
Simple retrieval of media files based on custom property
I am fairly new to XSLT and have been scouring the Forum for ages to my apologies that this is so simple.I have a set of files in my media area contained in a folder structure like this:Forms > Uniforms > winter.pdfForms > Uniforms > summer.pdfForms > Canteen > pricelist.pdfetcI have given them a True / False property called quickForm as I want to display the ones selected as a "hotlist" on my home page.<pre><xsl:param name="currentPage"/> <xsl:template match="/"> <ul> <xsl:if test="./data [@alias = 'pdfFile'] != ''"> <a href="{umbraco.library:GetMedia(./data [@alias = 'quickForm'],'false')/data [@alias = 'umbracoFile']}">Download PDF</a> </xsl:if> </ul> </xsl:template></pre>This is my current version of the code.Any help would be most appreciated
Sorry hope this turns out better formatted...
<xsl:param name="currentPage"/>
<xsl:template match="/">
<ul>
<xsl:if test="./data [@alias = 'pdfFile'] != ''">
<a href="{umbraco.library:GetMedia(./data [@alias = 'quickForm'],'false')/data [@alias = 'umbracoFile']}"><xsl:value-of select="@nodeName"/></a>
</xsl:if>
</ul>
</xsl:template>
Ok so the above code didn't work but has anyone got any ideas???
I just need to access my media property true / false and display those that are true - currently not displaying anything.
I've been trawling the forum and I think I'm getting close.....
Hi nadine,
Reason why you can not get it to work is that you are using a version of Umbraco that is using the new XML schema. The new schema was introduced from version 4.5,
Looking forward to hear which version you are using. After that maybe I can help you to get your xslt right.
/Dennis
Thanks so much for posting Dennis
I've started to realise that it's rather confusing as there's not many examples out there with the new schema!
I have got this to display the files in my forms folder only after specifying the folder id, I still haven't got it to display the files in subfolders with my quickForm (True/False) property. Are you able to help me with that Dennis?
Nadine
Hi nadine,
If I remember correctly, I think something like this should work for you.
The $documents//* should get the subfolders. The descendant axis retrieves all nodes below the node in reference no matter the depth. http://our.umbraco.org/wiki/reference/xslt/xpath-axes-and-their-shortcuts
I hope this can help you in some way.
/Dennis
Hi Dennis
This didn't retrieve anything, would it be because we've specified the folderID in the GetMedia function?
Nadine
It seems to fail on this statement
This rest of the code retrieved all of the folders at all levels...
Hi nadine,
Can´t rember if it´s possible to do it like this.
But I hope this will work for you.
/Dennis
Dennis you are an absolute star - it works a treat - I had tried variations of that but couldn't get that syntax right!
Thank you so much!
nadine, glad that I could help you out.
And I´m sure if you have other questions about Umbraco, people in this forum will be happy to help you.
/Dennis
is working on a reply...