My problem is, that when i try to use it inside a macro i just can't get the path for the pictures inside my <img src="......PATH HERE.....">
When i try to look at the source code the src part of the img tag is just empty. I would perfer not to show my XSLT code atm. because its really really messy. If its needed just give me a shout, then I'll post it.
Laurence that was what i needed. Just tried like 100 other ways that was almost the "{$currentPage/frontpageAbout}" you just gave me. But it worked perfectly! And there are no need ot check if it exist. Cause it always will :)
Use upload inside an <img> tag
Hello my fellow Umbraco-holics.
Its prolly just me who's turned blind+dump, but I just can't figure out the solution for my problem.
I got a document type, it contains 2 upload datatypes with the following name and alias:
Name: Frontpage About | Alias: frontpageAbout
Name: Frontpage Download | Alias: frontpageDownload
My problem is, that when i try to use it inside a macro i just can't get the path for the pictures inside my <img src="......PATH HERE.....">
When i try to look at the source code the src part of the img tag is just empty. I would perfer not to show my XSLT code atm. because its really really messy. If its needed just give me a shout, then I'll post it.
Regards,
Mark W. Nielsen
Just updated my XSLT abit, so here it is:
<?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="button_download" select="$currentPage/frontpageDownload" />
<xsl:variable name="button_about" select="$currentPage/frontpageAbout" />
<xsl:template match="/">
<!-- start writing XSLT -->
<xsl:choose>
<xsl:when test="$currentPage/@nodeName = 'UK'">
<div class="button_img" style="margin-right: 19px;">
<a href="download2.html">
<img class="frontpage_button" src="$button_download" />
</a>
</div>
<div class="button_img">
<a href="download2.html">
<img class="frontpage_button" src="$button_about" />
</a>
</div>
</xsl:when>
<xsl:when test="$currentPage/@nodeName = 'DK'">
<div class="button_img" style="margin-right: 19px;">
<a href="download2.html">
<img class="frontpage_button" src="$button_download" />
</a>
</div>
<div class="button_img">
<a href="download2.html">
<img class="frontpage_button" src="$button_about" />
</a>
</div>
</xsl:when>
<xsl:otherwise>
<div class="button_img" style="margin-right: 19px;">
<a href="download2.html">
<img class="frontpage_button" src="$button_download" />
</a>
</div>
<div class="button_img">
<a href="download2.html">
<img class="frontpage_button" src="$button_about" />
</a>
</div>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Go on, show your code! I've written some truely cringe worthy stuff before ;)
In the most basis level, you could try...
This should just get the value of frontpageAbout from your node in question. No fancy logic to check it exists or anything.
You are just missing the curly bracket syntax Mark, check out this thread (and scroll to the bottom / Chriztian's solution) it's got it covered! /Lau
Laurence that was what i needed. Just tried like 100 other ways that was almost the "{$currentPage/frontpageAbout}" you just gave me. But it worked perfectly! And there are no need ot check if it exist. Cause it always will :)
Thanks a billion!
Out of interest what is your <xsl:choose> bit doing? Each part is the same?
Also remember to bosh a alt="" on the image, even if its just alt="(null)", otherwise the screenreader reads the images URL out.
(: Lau
The is checing what the node name is, and then change the depending on what the nodename are. I just didn't corrent the links when i posted the XSLT.
And thanks for the memo on the alt=""
You can see my entire XSLT here, as the finished "product" :P
<xsl:choose>
<xsl:when test="$currentPage/@nodeName = 'UK'">
<div class="button_img" style="margin-right: 19px;">
<a href="/download.aspx">
<img alt="" class="frontpage_button" src="{$currentPage/frontpageDownload}" />
a>
div>
<div class="button_img">
<a href="/about-us.aspx">
<img alt="" class="frontpage_button" src="{$currentPage/frontpageAbout}" />
a>
div>
xsl:when>
<xsl:when test="$currentPage/@nodeName = 'DK'">
<div class="button_img" style="margin-right: 19px;">
<a href="/brochure.aspx">
<img alt="" class="frontpage_button" src="{$currentPage/frontpageDownload}" />
a>
div>
<div class="button_img">
<a href="/om-os.aspx">
<img alt="" class="frontpage_button" src="{$currentPage/frontpageAbout}" />
a>
div>
xsl:when>
<xsl:otherwise>
<div class="button_img" style="margin-right: 19px;">
<a href="/downloads.aspx">
<img alt="" class="frontpage_button" src="{$currentPage/frontpageDownload}" />
a>
div>
<div class="button_img">
<a href="/ueber-uns.aspx">
<img alt="" class="frontpage_button" src="{$currentPage/frontpageAbout}" />
a>
div>
xsl:otherwise>
xsl:choose>
is working on a reply...