Copied to clipboard

Flag this post as spam?

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


  • Claus Nedergaard 62 posts 104 karma points
    Mar 14, 2011 @ 15:34
    Claus Nedergaard
    0

    XSLT list news suddenly makes parsing error!

    Hi all,

     

    I have an xslt macro that has started to fail out of the blue it seems. It's been working fine until now.

    It's run on an upgraded 4.0.2 install.

    Ihave have made no chagnes on the site for a long time, so this sudden parsing error irritates me a lot.

    the xslt:

    <?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"
     exclude-result-prefixes="msxml umbraco.library">
    <xsl:output method="xml" omit-xml-declaration="yes"/>
    <xsl:param name="currentPage"/>
    <xsl:variable name="SortOrder" select="$currentPage/ancestor-or-self::node[@level=1]/descendant::node [@nodeTypeAlias = 'NewsEventsListPage']/data [@alias = 'SortOrder']" />  
    <xsl:variable name="SortBy" select="$currentPage/ancestor-or-self::node[@level=1]/descendant::node [@nodeTypeAlias = 'NewsEventsListPage']/data [@alias = 'SortBy']" />
    <xsl:variable name="NumberofItemsToDisplay" select="$currentPage/data [@alias = 'NoNewsEvents']" />
    <xsl:template match="/">
    <xsl:variable name="DataType">  
        <xsl:choose> 
            <xsl:when test="$SortBy='sortOrder'"> 
                <xsl:value-of select="'number'" /> 
            </xsl:when> 
            <xsl:otherwise> 
                <xsl:value-of select="'text'" /> 
            </xsl:otherwise> 
        </xsl:choose> 
    </xsl:variable>

    <ul id="NewsList">
    <xsl:for-each select="$currentPage/ancestor-or-self::node[@level=1]/descendant::node [@nodeTypeAlias = 'NewsEventsListPage']/node [string(data [@alias='umbracoNaviHide']) != '1']">
    <xsl:sort select="@*[name() = $SortBy]" order="{$SortOrder}" data-type="{$DataType}"/>
     <xsl:if test="position()&lt;= $NumberofItemsToDisplay"> 
      <xsl:variable name="Class"> 
       <xsl:choose> 
        <xsl:when test="@nodeTypeAlias='Event'"> 
         <xsl:value-of select="'Event'" /> 
        </xsl:when> 
        <xsl:otherwise> 
         <xsl:value-of select="'News'" /> 
        </xsl:otherwise> 
       </xsl:choose> 
      </xsl:variable>
      <li class="{$Class}">
       <a title="{@nodeName}" href="{umbraco.library:NiceUrl(@id)}">
        <strong><xsl:value-of select="@nodeName"/></strong><br/>
        <xsl:if test="./@updateDate !=''">    
         <em><xsl:value-of select="umbraco.library:FormatDateTime(./@updateDate, 'd. MMMM yyyy, ')"/></em>
        </xsl:if> <xsl:value-of select="@writerName"/>
       </a>
      </li>
     </xsl:if>
    </xsl:for-each>
    </ul>
    </xsl:template>
    </xsl:stylesheet>

  • Claus Nedergaard 62 posts 104 karma points
    Mar 14, 2011 @ 15:35
    Claus Nedergaard
    0

    When saving the xslt i know get this error:

    (XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) 
    at Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
    at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer, Boolean closeWriter)
    at System.Xml.Xsl.XmlILCommand.Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter results)
    at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, TextWriter results)
    at umbraco.presentation.webservices.codeEditorSave.SaveXslt(String fileName, String oldName, String fileContents, Boolean ignoreDebugging)

     That's complete nonsene to me I'm afraid :-)

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 14, 2011 @ 16:42
    Jan Skovgaard
    0

    Hi Claus

    What version have you upgraded Umbraco to?

    /Jan

  • Claus Nedergaard 62 posts 104 karma points
    Mar 14, 2011 @ 19:33
    Claus Nedergaard
    0

    Hi Jan ,

    Long story short. Upgraded from 3 to 4.0.2 very long time ago and the site have been running smooth.

    I managed to solve it on my own though. For some reason the sort command in the xslt was no longer able to dig in to the news list and catch the sortOrder and sortBy. So I changed both variables to catch both sort values on the currentpage and that works fine now.

    But I'm puzzled how a working site where I haven't done any alterations at all suddenly acts up like that!?

    Before I found the solution I also tried to place an xsl:if around the for-each statement. Came out with no errors but also no output. So that solution didn't work for this issue.

    Anyway, you get the solved 'credits' for replying :-)

Please Sign in or register to post replies

Write your reply to:

Draft