Copied to clipboard

Flag this post as spam?

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


  • Brian Milman-Hurst 48 posts 76 karma points
    Apr 18, 2013 @ 20:29
    Brian Milman-Hurst
    0

    XSLT Suddenly crashing after no changes made!

    Hi guys,

    I need some help if possible!!  I am just getting a site ready to launch and for no 'apparent' reason I am suddenly getting 'Error parsing XSLT file: \xslt\PropertySliderMINI.xslt' instead of my nice little slideshow!

    This is happening on all 3 of the xslt files that share functionality and to my knowledge nothing else has changed that could cause this.

    Additonally, one of the XSLT files that previously worked fine is suddenly not allowing me to save it, even after making no changes..  see code below

    Each of the XSLT files are sharing some simple slideshow script and all share the same info from the same file!

    Any ideas guys!?  

     

    <?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" xmlns:tagsLib="urn:tagsLib" xmlns:BlogLibrary="urn:BlogLibrary" 
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets tagsLib BlogLibrary ">


    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>

    <xsl:template match="/">

    <!-- start writing XSLT -->
      <xsl:variable name="sliderNode" select="$currentPage/AvailableList/availablesubgroup/* "/>

     <div id="slider">
        <div id="imageSlider">
          <xsl:for-each select="$sliderNode">
               <href="{umbraco.library:NiceUrl(@id)}"><div class="imageSlide">
                  <div class="imageSliderInfo">
                      <h2<xsl:value-of select="@nodeName"/></h2>
                    <p><xsl:value-of select="numberOfBedrooms"/> bedrooms <xsl:value-of select="costOfProperty"/></p>
                    </div>
                    <div class="imageSliderImage">
                      <img src="{featuredImage}" width="666" height="420" />
                    </div>
                  </div></a>
           
          </xsl:for-each>
       </div>
    </div>
    </xsl:template>

    </xsl:stylesheet>

     

    Here is the error message being displayed - as I am 80% front end it doesn't mean an awful lot to me I'm afraid!

     

    Error occured

     

    System.OverflowException: Value was either too large or too small for an Int32. 
    at System.Convert.ToInt32(Double value) 
    at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider) 
    at System.Xml.Xsl.Runtime.XmlQueryRuntime.ChangeTypeXsltArgument(XmlQueryType xmlType, Object value, Type destinationType) 
    at System.Xml.Xsl.Runtime.XmlQueryContext.InvokeXsltLateBoundFunction(String name, String namespaceUri, IList`1[] args) 
    at (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) 
    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)

  • Brian Milman-Hurst 48 posts 76 karma points
    Apr 18, 2013 @ 20:38
    Brian Milman-Hurst
    0

    Panic over!!! sorted it with the addition of PropertyList at the end of select="$currentPage/AvailableList/availablesubgroup/*

    But I'm curious now, why would this work before and suddenly crash today!?

     

    Also, the current XSLT files are utilising an upload file from the doc type but Ideally I would like to change this to a media selection...  Alas my poor knowledge in utilising XSLT is letting me down and I have no idea how to include a 'use media' function...  any ideas guys?

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Apr 18, 2013 @ 23:06
    Chriztian Steinmeier
    0

    Hi Brian,

    So to explain why this error occurs - it's the NiceUrl() function that chokes, because it's at some point being fed an empty value.

    One way to fix this is to wrap an <xsl:if> around it all (you'll see a lot of those because that's how you'd initially approach it with "standard" C# thinking), e.g.:

    <xsl:for-each select="$sliderNode">
        <!-- Make sure there is a non-empty @id -->
        <xsl:if test="normalize-space(@id)">
            <!-- do stuff -->
        </xsl:if>
    </xsl:for-each>

    A much better way is to just specifically ask for nodes that have a non-empty id right away (when setting the sliderNode variable):

    <xsl:variable name="sliderNode" select="$currentPage/AvailableList/availablesubgroup/*[normalize-space(@id)]" />

     

    /Chriztian

  • Brian Milman-Hurst 48 posts 76 karma points
    Apr 19, 2013 @ 08:41
    Brian Milman-Hurst
    0

    Hi Chriztian,

    As ever, thanks very much..

     

    Can you recommend a 'XSLT for dummies/designers' book or resource?  I'm really keen to learn more about how to code my XSLT properly instead of cobling them together!

     

    Cheers

    Brian

Please Sign in or register to post replies

Write your reply to:

Draft