Copied to clipboard

Flag this post as spam?

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


  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Aug 01, 2010 @ 12:12
    Bo Damgaard Mortensen
    0

    Following XSLT stopped working after upgrading to 4.5.1

    Hi umbraco users,

    I've recently upgraded my umbraco site to version 4.5.1, while everything seems to work fine, I've come across a few problems.

    1) The following XSLT dosn't work anymore:

    <xsl:if test="$currentPage/data[@alias='navigationImage'] != ''">
      <xsl:variable name="image" select="umbraco.library:GetMedia($currentPage/data[@alias='navigationImage'],0)/data[@alias='umbracoFile']" />
      <div style="background-image:url('{$image}'); background-repeat:no-repeat; position:absolute; float:left; width:618px; height:160px;"></div>
    </xsl:if>

    It's supposed to go and grab the path to an image if there's one present to the node. The datatype is a simple mediapicker.

    The document type looks like this:

    Tabs: Content (Rich Text Editor), Navigation Content (Navigation Image [MediaPicker], Navigation Content [Rich Text Editor]), Properties

    Does anyone know why this all of a sudden doesn't work?

    Another problem is, that the Media section tree is completely empty. Seems it's unable to load the media nodes/files/folders/images correctly after the upgrade. Could this be related to the above problem with my XSLT? When I'm using my Rich Text Editor I am able to pick a media item correctly and it shows up just fine.

    Any help on this is much appreciated!

    Thanks in advance.

    Bo

     

     

  • skiltz 501 posts 701 karma points
    Aug 01, 2010 @ 12:35
    skiltz
    0

    what version did you upgrade from?  If it wasn't 4.5 then then 4.5 has a new xml schema so will need to update you xslt.

    I'm not an xslt person so.... something like...maybe

    <xsl:variable name="image" select="umbraco.library:GetMedia($currentPage/navigationImage,false)/umbracoFile" />

    maybe just do a search for the new schema :)

    or you can make you application run using the old xml schema by setting UseLegacyXmlSchema to true in umbracosettings.config.  But if I was you I would update your xslt :)

  • Kim Andersen 1447 posts 2196 karma points MVP
    Aug 01, 2010 @ 12:36
    Kim Andersen
    0

    Hi there Bo

    The new XML schema has been changed in the new version of Umbraco, but if you don't want to go through all of your XSLT, you can tell Umbraco to use the "old" schema. You can do this in the umbracoSettings.config-file. Find this part:

    <UseLegacyXmlSchema>false</UseLegacyXmlSchema>

    If your change the above to true, you'll use the old schema.

    If you do want to use the new schema, you have to change your XSLT. First of all you can try to write out the current page's XML to see what's changed with this methode:

    <textarea>
    <xsl:copy-of select="$currentPage" />
    </textarea>

    Here you'll see that there is no such thing as the data-tags with alias-attributes. So everywhere you have written:

    $currentpage/data[@alias='theAlias']

    you must remove some of it.

    This means that some of your code above must be changes from this:

    <xsl:if test="$currentPage/data[@alias='navigationImage'] != ''">

    to this:

    <xsl:if test="$currentPage/navigationImage != ''">

    Do the same in your variable, and you should be fine. If it doesn't help, just say so and we'll figure it out.

    /Kim A

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Aug 01, 2010 @ 13:07
    Bo Damgaard Mortensen
    0

    Guys that's just perfect! Thanks a lot :) I decided to go with the new schema though as it seems a bit simplified than the old one.

    My XSLT looks like this now:

    <xsl:if test="$currentPage/navigationImage != ''">
      <xsl:variable name="image" select="umbraco.library:GetMedia($currentPage/navigationImage, false)/umbracoFile" />
      <div style="background-image:url('{$image}'); background-repeat:no-repeat; position:absolute; float:left; width:618px; height:160px;"></div>
    </xsl:if>

    In case anyone searches for this topic :)


    Thanks again! It's greatly appreciated!

Please Sign in or register to post replies

Write your reply to:

Draft