Copied to clipboard

Flag this post as spam?

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


  • Shannon 148 posts 171 karma points
    Nov 25, 2010 @ 15:30
    Shannon
    0

    Can you post an example of an INSERT SQL command

    I have tried several combonations with no success.

  • Jesper Ordrup 1019 posts 1528 karma points MVP
    Nov 25, 2010 @ 15:37
    Jesper Ordrup
    0

    Which did you try?

    What happend?

  • Shannon 148 posts 171 karma points
    Nov 25, 2010 @ 15:46
    Shannon
    0

    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, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current)
    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)


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


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

    <xsl:param name="currentPage"/>

    <xsl:template match="/">
    <xsl:variable name="url" select="umbraco.library:NiceUrl(@id)"/>
    <xsl:variable name="node" select="(@id)"/>

    <xsl:variable name="exp">
        <xsl:text>INSERT INTO njPageview(contentUrl, contentNodeId) VALUES('</xsl:text>
        <xsl:value-of select="$url"/>
        <xsl:text>','</xsl:text>
        <xsl:value-of select="$node"/>
        <xsl:text>')</xsl:text>
    </xsl:variable>

    <xsl:variable name="sqlresult" select="jesper.sql:SQLXml($exp)"/>

    <xsl:for-each select="$sqlresult//.">
    <li/> <xsl:value-of select="@appAlias"/>
    </xsl:for-each>

    </xsl:template>

    </xsl:stylesheet>
  • Shannon 148 posts 171 karma points
    Dec 02, 2010 @ 17:15
    Shannon
    0

    Can you help?

  • Jesper Ordrup 1019 posts 1528 karma points MVP
    Dec 02, 2010 @ 19:38
    Jesper Ordrup
    0

    Hi Shannon,

    Sorry it took so long. Yup.

    Download the new version 2 - http://our.umbraco.org/projects/developer-tools/sql-for-xslt-(jespercom)

    Use the other method "jesper.sql:SQLExecuteScalar" for sqlstatements like INSERT, UPDATE, DELETE.

    Fix the error in your xslt file:

    <xsl:variable name="url" select="umbraco.library:NiceUrl(@id)"/>
    <xsl:variable name="node" select="(@id)"/>

    should be:

    <xsl:variable name="url" select="umbraco.library:NiceUrl($currentPage/@id)"/>
    <xsl:variable name="node" select="$currentPage/@id)"/>


    Good luck
    Jesper

     

     

     

     

  • Shannon 148 posts 171 karma points
    Dec 17, 2010 @ 18:43
    Shannon
    0

    Is there any way to remove the first bullet from the sample text?

  • Jesper Ordrup 1019 posts 1528 karma points MVP
    Dec 17, 2010 @ 20:22
    Jesper Ordrup
    0

    Sure .. just remove the <li/>

    Pls. remember to mark any of my responses as solution.

    /Jesper

Please Sign in or register to post replies

Write your reply to:

Draft