I'm trying toinsert abackground image inmyxsltfile. I havea documentwhereit worksfinebut I can notget it toworkhere(Umbraco4.11.8) Here isa partof the code:
<xsl:if test="$media"> <xsl:variable name="url" select="$media/umbracoFile" /> <div style="width:200px;height:200px;background:url({$url}) no-repeat;">Billede skulle gerne være som et baggrundsbillede nu</div> </xsl:if> </xsl:if> </xsl:template>
<xsl:iftest="$media"> <xsl:variablename="url"select="$media/umbracoFile"/> <divstyle="width:200px;height:200px;background-image:url('<xsl:value-of select="$url"/>')no-repeat;">Billede skulle gerne være som et baggrundsbillede nu</div> </xsl:if> </xsl:if> </xsl:template>
I hopethe switch to<xsl:value-ofselect=""/>makes the difference.
<xsl:if test="$media"> <xsl:variable name="url" select="$media/umbracoFile" /> <div style="width:200px;height:200px;background:url({$url}) no-repeat;">Billede skulle gerne være som et baggrundsbillede nu</div> </xsl:if> </xsl:if>
It only spit out the xxx and not the vvv in this line
<xsl:if test="$media"> <xsl:variable name="url"select="$media/umbracoFile"/> <div style="width:200px;height:200px;background:url('<xsl:value-ofselect="$url"/>') no-repeat;">Billede skulle gerne være som et baggrundsbillede nu</div> </xsl:if> </xsl:if>
<xsl:if test="$media"> <xsl:variable name="url" select="$media/umbracoFile" /> <div style="width:200px;height:200px;background:url('{$url}') no-repeat;">Billede skulle gerne være som et baggrundsbillede nu</div> </xsl:if> </xsl:if>
Butsomethingcould indicatethat you are on page, that hasan emptybaggrundsbilledefield, be surethatthe current pagehascontent in the baggrundsbillede field.
Andyou useamediapickerasdatatype of twopicktheimageon thesite.There is nothing thatjustpops into my eyes, but Ican easily havemissing something looking through your code.
I havechecked itso many times.I also thoughtitwas the problem, but unfortunately:-) Thank youfor your promptresponse. I mustsee if I canfind anotherway tosolve the problem. Thanks for your time
Mysiteis builtwitha frontpagewhere Ikeep allmydocument types, so Ihave a longhtmlpage tomy site. If I'mon mydocument type"Forside" addedproperty "background image", it works,(it shows the images) but Ineed to havedifferent images on each documenttypeI pullinto the frontpage, and thereforeI will need to be able to chooseimage on thedocument type"Sektion4".
<xsl:if test="$media"> <xsl:variable name="url" select="$media/umbracoFile" /> <div style="width:200px;height:200px;background:url('{$url}') no-repeat;">Billede skulle gerne være som et baggrundsbillede nu</div> </xsl:if> </xsl:if>
Place an background images in my xslt
Hi
I'm trying to insert a background image in my xslt file.
I have a document where it works fine but I can not get it to work here (Umbraco 4.11.8)
Here is a part of the code:
Hope you can help me :-)
/Kate
Hi Kate,
I can remember that I have done something similar on a project a few years ago.
On this project I used <xsl: value-of select="" /> to print the image
I hope the switch to <xsl:value-of select="" /> makes the difference.
/Dennis
It did not help.
I think the problem is here:
It only spit out the xxx and not the vvv in this line
Does that make any sense to you :-)
/Kate
Okay what if you try this one.
/Dennis
Nope, sorry
Maybe it is better if I send you the full code :-)
Just give me a moment to clean it up a bit :-)
Here it is:
Hmm know it's a strange question.
But something could indicate that you are on page, that has an empty baggrundsbillede field, be sure that the current page has content in the baggrundsbillede field.
And you use a media picker as data type of two pick the image on the site. There is nothing that just pops into my eyes, but I can easily have missing something looking through your code.
/Dennis
I have checked it so many times. I also thought it was the problem, but unfortunately :-)
Thank you for your prompt response.
I must see if I can find another way to solve the problem.
Thanks for your time
okay, I've figured out what the problem is - I think!
Do you still want to help?
Yeah Kate, what was the probem. I will love to hear about this way I also learn new things, and I will try my best to help you finding a solution.
My site is built with a frontpage where I keep all my document types, so I have a long html page to my site.
If I'm on my document type "Forside" added property "background image", it works,(it shows the images) but I need to have different images on each document type I pull into the frontpage, and thereforeI will need to be able to choose image on the document type "Sektion4".
Does that make sense?
I think i got it. I just need to test it an extra time :-)
Okay did you any opportunity to post a screenshot that show your content structure, maybe it will be easier to help then.
Okay Kate, let me know if you have find a working solution.
/Dennis
Her is my content strukture
And the page "Forside" is the only page on my website. Just like this exampel: http://vaerksted.info
So what i did was that I chance from this
to this
I have made a test and it works fine :-D
Thanks for your help, you got me on the right track
You are very welcome Kate,
Good that we together came up with a solution. I will be ready to help you another time, with your XSLT, if I can.
/Dennis
Thanks, that would be great :-)
is working on a reply...