Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Amigo 245 posts 600 karma points
    Feb 02, 2011 @ 15:05
    Amigo
    0

    images via xsl

    i have the latest version og umbraco installed.

    but i have problems with this xsl:
      <xsl:if test="$mediaNode/umbracoFile">
                            <img src="{$mediaNode/umbracoFile}" alt="[image]" height="{umbracoHeight}" width="{umbracoWidth}" />
                    </xsl:if>

    this is not working:
    alt="[image]" height="{umbracoHeight}" width="{umbracoWidth}"

    i wonder why?

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Feb 02, 2011 @ 15:11
    Tom Fulton
    1

    Try placing $mediaNode before the attributes so it knows where to pull them from:

    alt="[image]" height="{$mediaNode/umbracoHeight}" width="{$mediaNode/umbracoWidth}"

  • Amigo 245 posts 600 karma points
    Feb 02, 2011 @ 15:24
    Amigo
    0

    still not working...
    here is my entire code:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <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:template match="/">
            <xsl:variable name="mediaId" select="number($currentPage/logo)" />
            <xsl:if test="$mediaId > 0">
                <xsl:variable name="mediaNode" select="umbraco.library:GetMedia($mediaId, 0)" />
                    <img src="{$mediaNode/umbracoFile}" alt="" height="{$mediaNode/umbracoHeight}" width="{$mediaNode/umbracoWidth}" />
            </xsl:if>
    </xsl:template>

    </xsl:stylesheet>

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Feb 02, 2011 @ 15:25
    Tom Fulton
    0

    Which part isn't working?  Is the image showing and the width/height attributes just aren't getting set?

  • Amigo 245 posts 600 karma points
    Feb 02, 2011 @ 15:27
    Amigo
    0

    width and height are empty...

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Feb 02, 2011 @ 15:29
    Tom Fulton
    1

    Hmm, that should work...try re-saving your image in the Media section?

    Otherwise, try outputting the media's XML so we can make sure the values are there:

    <textarea><xsl:copy-of select="$mediaNode"/></textarea>
  • Jan Skovgaard 11280 posts 23678 karma points MVP 12x admin c-trib
    Feb 02, 2011 @ 15:35
    Jan Skovgaard
    0

    Hi Amigo

    Try refreshing the XML cache by choosing "replublish entire site" by right clicking the node named "Content" in the Content section.

    /Jan

  • Amigo 245 posts 600 karma points
    Feb 03, 2011 @ 14:16
    Amigo
    0

    hmmm still not working after refresh and resave image....

    i really wonder why....

  • Jan Skovgaard 11280 posts 23678 karma points MVP 12x admin c-trib
    Feb 03, 2011 @ 14:19
    Jan Skovgaard
    0

    Hi Amigo

    Have you tried to see what XMl you get returned by making a <textarea> with a copy of the variable to see what XML gets returned? If so could you please post the XML in here?

    /Jan

  • Amigo 245 posts 600 karma points
    Feb 03, 2011 @ 14:40
    Amigo
    0

    Hi Jan,

    ok, what i get out is:
    <File id="1053" version="0c10ba34-4fb5-4b66-8cfa-25f40fc0e90b" parentID="1052" level="2" writerID="0" nodeType="1033" template="0" sortOrder="1" createDate="2011-02-02T14:03:51" updateDate="2011-02-02T14:03:50" nodeName="xxx_logo" urlName="xxx_logo" writerName="admin" nodeTypeAlias="File" path="-1,1052,1053"><umbracoFile>/media/44/xxx_logo.jpg</umbracoFile><umbracoExtension>jpg</umbracoExtension><umbracoBytes>21194</umbracoBytes></File>

  • Amigo 245 posts 600 karma points
    Feb 03, 2011 @ 14:44
    Amigo
    0

    Hi Jan,

    Now it works, i renamed the image and uploadet a new one....

    Thanks a lot both of you ;-)

  • Jan Skovgaard 11280 posts 23678 karma points MVP 12x admin c-trib
    Feb 03, 2011 @ 15:15
    Jan Skovgaard
    0

    Hi Amigo

    Happy to hear you got it solved. Sometimes stuff just needs to be refreshed one way or the other and booom! it works :-)

    Remember to mark the post as solved.

    /Jan

  • 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.

Please Sign in or register to post replies