Copied to clipboard

Flag this post as spam?

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


  • Lee 1123 posts 3059 karma points
    Oct 10, 2009 @ 10:12
    Lee
    0

    This Is Why I Hate XSLT

    Having the most infuriating problem with a Macro - I am trying to check if a page is a Certain DocType

    The doc type alias is DirectoryCategory

    Now I am trying to put this name in a variable - But it won't let me use a capital C!!! What the heck??  So if I put this

    <xsl:variable name="documentTypeAlias" select="string('Directorycategory')"/>

    It works fine... But I try to actually put the real alias in like so with a capital C

    <xsl:variable name="documentTypeAlias" select="string('DirectoryCategory')"/>

    It throws an error (See below).. How completely stupid GRRRRRRRRRR - Can anyone help please.

    Error occured
    System.OverflowException: Value was either too large or too small for an Int32.
    
    at System.Convert.ToInt32(Double value)
    at System.Double.System.IConvertible.ToInt32(IFormatProvider provider)
    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, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current)
    at Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
    at Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
    at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlSequenceWriter results)
    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.XmlILCommand.Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, TextWriter 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)
  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Oct 10, 2009 @ 11:20
    Morten Bock
    0

    Is that the _only_ code in your xslt? I would think that it is not the variable assignment itself, but rather the usage of it later on that might create the problem. Could you post the entire xslt file?

  • Lee 1123 posts 3059 karma points
    Oct 10, 2009 @ 11:29
    Lee
    0

    LOL... Sorry, please ignore this *Need a symbol for emarrassed here* ... I left some test code in the bottom that was causing the error, ALTHOUGH still completely stupid how it only threw an error when I changed the C to capital!!  Damn stupid XSLT :P

  • Lee 1123 posts 3059 karma points
    Oct 10, 2009 @ 11:34
    Lee
    0

    Actually my XSLT still isn't working? Could you offer a suggestion - I'm trying to check if the documentType is a certain type, if so write out some HTML

    <xsl:variable name="documentTypeAlias" select="string('DirectoryCategory')"/>
    <xsl:if test="$currentPage/node [@nodeTypeAlias = $documentTypeAlias]">
    <li><a href="{umbraco.library:NiceUrl('1073')}?s={@id}">Submit</a></li>
    </xsl:if>

    For some reason its showing for every DocType and its not appending the current node ID at the end of the link {@id} ??  Any ideas??

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Oct 10, 2009 @ 11:52
    Morten Bock
    0

    Well, the complete xslt would help here.

    Are you doing this inside a loop?

    If you are trying to test it for the page that is currently beign viewed, then you need to change your code to:

    <xsl:if test="$currentPage/@nodeTypeAlias = $documentTypeAlias">

    if you are trying to test it for the page that your are currently looping through, then you need:

    <xsl:if test="@nodeTypeAlias = $documentTypeAlias">

    Could you post the complete xslt, or describe a bit more about what you are trying to do?

  • Lee 1123 posts 3059 karma points
    Oct 10, 2009 @ 12:24
    Lee
    0

    Awesome you're a legend - thanks!!

    P.S:That was all the XSLT above (Apart from the normal stuff you usually get with any XSLT file).

  • 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