Copied to clipboard

Flag this post as spam?

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


  • Mehtab Malik 21 posts 70 karma points
    Jul 31, 2013 @ 18:46
    Mehtab Malik
    0

    new schema of XSLT is not working

    I updated my xslts using the package and then upgraded umbraco 4.0.3 to 4.5.2 and planning to do upgrade till version 6.x. The upgrade completed fine but my xslts are not working. An exmaple of the xslt is below

    XSLT before upgrade 

    <?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="imageFolder" select="/macro/imageFolder"/>
           
    <xsl:variable name="imageFolderContents" select="umbraco.library:GetMedia($imageFolder/node/@id, 'true')"/>
           
    <div style="clear:both; " class="slideshow">
               
    <xsl:for-each select="$imageFolderContents/node [@nodeTypeAlias='Image']">
                   
    <xsl:if test="string(current()/data [@alias='umbracoFile']) != ''">
                       
    <a href="http://www.marhall.com/booking.aspx">
                           
    <img alt="{current()/@nodeName}">
                               
    <xsl:attribute name="src"><xsl:value-of select="current()/data [@alias='umbracoFile']"/><!--                 <xsl:value-of select="umbraco.library:UrlEncode(current()/data [@alias = 'umbracoFile'])" disable-output-escaping="yes" />--></xsl:attribute>
                           
    </img>
                       
    </a>
                   
    </xsl:if>
               
    </xsl:for-each>
           
    </div>
       
    </xsl:template>
    </xsl:stylesheet>
    XSLT after upgrade 
    <?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="imageFolder" select="/macro/imageFolder"/>
           
    <xsl:variable name="imageFolderContents" select="umbraco.library:GetMedia($imageFolder/node/@id, 'true')"/>
           
    <div style="clear:both; " class="slideshow">
               
    <xsl:for-each select="$imageFolderContents/Image">
                   
    <xsl:variable name="filePath" select="umbracoFile"/>
                   
    <xsl:if test="normalize-space($filePath)">
                       
    <a href="http://www.marhall.com/booking.aspx">
                           
    <!-- Change the link if this is a specific file -->
                           
    <xsl:if test="$filePath = '/media/42595/marhall_spadayhpbanner_jul131 (4).jpg'">
                               
    <xsl:attribute name="href">http://gifts.skchase.com/marhall/summerspa/</xsl:attribute>
                           
    </xsl:if>
                           
    <img src="{$filePath}" alt="{current()/@nodeName}"/>
                       
    </a>
                   
    </xsl:if>
               
    </xsl:for-each>
           
    </div>
       
    </xsl:template>
    </xsl:stylesheet>

    I have spent lots of time on it and would appreciate any help

    I guess the issue is lying on this line $imageFolderContents/Image   this is always empty.

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jul 31, 2013 @ 21:16
    Dennis Aaen
    0

    Hi Mehtab,

    I will try my best to help you to convert the old XSLT to the new XML schema. Maybe something like this will work for you.

    <?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="imageFolder" select="/macro/imageFolder"/>
            <xsl:variable name="imageFolderContents" select="umbraco.library:GetMedia($imageFolder/@id, 'true')"/>
            <div style="clear:both; " class="slideshow">
                <xsl:for-each select="$imageFolderContents/Image [@isDoc]">
                    <xsl:if test="string(current()/umbracoFile) != ''">
                        <a href="http://www.marhall.com/booking.aspx">
                            <img alt="{current()/@nodeName}">
                                <xsl:attribute name="src">
                                    <xsl:value-of select="current()/umbracoFile"/>
                                </xsl:attribute>
                            </img>
                        </a>
                    </xsl:if>
                </xsl:for-each>
            </div>
        </xsl:template>
    </xsl:stylesheet>

    /Dennis

  • Mehtab Malik 21 posts 70 karma points
    Jul 31, 2013 @ 21:43
    Mehtab Malik
    0

    Thanks for the comment bu that does not make a difference. I had the default setting on for  <UseLegacyXmlSchema>false</UseLegacyXmlSchema> as I did not want to use old schema of xslt. Any other ideas? thanks

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jul 31, 2013 @ 22:31
    Dennis Aaen
    0

    Hi Mehtab again,

    As I said I will try my best, to help you out solving your problem..

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [
        <!ENTITY nbsp "&#x00A0;">

    ]>
    <xsl:stylesheetversion="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:outputmethod="xml"omit-xml-declaration="yes"/>
       
    <xsl:paramname="currentPage"/>
       
    <xsl:templatematch="/">
           
    <xsl:variablename="imageFolder"select="/macro/imageFolder"/>
           
    <xsl:variablename="imageFolderContents"select="umbraco.library:GetMedia($imageFolder,true())"/>
           
    <divstyle="clear:both;"class="slideshow">
               
    <xsl:for-eachselect="$imageFolderContents/Image">
                       
    <ahref="http://www.marhall.com/booking.aspx">
                           
    <imgalt="./@nodeName}">
                               
    <xsl:attributename="src">
                                   
    <xsl:value-ofselect="./umbracoFile"/>
                               
    </xsl:attribute>
                           
    </img>
                       
    </a>
               
    </xsl:for-each>
           
    </div>
       
    </xsl:template>
    </xsl:stylesheet>

    Hope this code is better than the first one.

    /Dennis

  • Mehtab Malik 21 posts 70 karma points
    Jul 31, 2013 @ 23:19
    Mehtab Malik
    0

    Thanks for the comment again. It's still not working. I guess the problem might be lying with the upgrade. Please see the content of the ImageFolder in the watch window

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jul 31, 2013 @ 23:34
    Dennis Aaen
    0

    Yeah I think you are right the problem could be lying with the upgrade, because in the new XML schema, their is no called node more or data alias. So it could indicate that something is wrong with the upgrade, or the change to the new XML schema hasenĀ“t being enabled correctly.

    Maybe a silly question, but have you followed this guide http://our.umbraco.org/wiki/reference/xslt/45-xml-schema/switching-between-old-and-new-schema to switch to the new XML schema?

    /Dennis

  • Mehtab Malik 21 posts 70 karma points
    Jul 31, 2013 @ 23:52
    Mehtab Malik
    0

    I have followed all the steps  http://our.umbraco.org/wiki/reference/xslt/45-xml-schema/switching-between-old-and-new-schema on this page but still seeing the same unfortunately. Do you have any link for upgrading from 4.0.3 to 4.5.2 with schema upgrade as well. Thanks

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Aug 01, 2013 @ 00:10
    Dennis Aaen
    0

    Maybe these resources can help you upgrading your Umbraco to 4.5.2

    Lee Kelleher has written a upgrade guide where he proposes an upgrade path maybe this could be usefull http://code.leekelleher.com/umbraco/archive/

    Other resourses can be http://our.umbraco.org/documentation/Installation/Upgrading/genera or http://our.umbraco.org/documentation/Installation/Upgrading/version-specific but these ones you probably already know.

    I think you should upgrade to at least version 4.11.8 of Umbraco because in version 4.5.2 and some versons before and up to version 4.11.8 some security issues have been found, so make sure that you follow the guidlines found in this blogpost at least if you are going to use the version 4.5.2 http://umbraco.com/follow-us/blog-archive/2013/5/1/security-update-two-major-vulnerabilities-found.aspx

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft