XSLCompiledTrnsform and msxml:script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AmolPalve
    New Member
    • Apr 2008
    • 2

    XSLCompiledTrnsform and msxml:script

    HI All,
    For certain perfomance improvements , my project needs to migrate from using the XSLTransform class to the XSLCompiledTrns form Class for xsl transformations .
    This migration requires many changes in functions that are written inside the msxml:script block. We are facing many syntactical problems while rewritting those functions.
    Anybody knows any possible way to avoid such rewriting of the msxml:script functions.
    Any help will be appriciated. Thanks a lot in advance.
  • pronerd
    Recognized Expert Contributor
    • Nov 2006
    • 392

    #2
    Since your question relates to a programing language instead of XML it would be better to post your question in a forum that covers that topic.

    Comment

    • jkmyoung
      Recognized Expert Top Contributor
      • Mar 2006
      • 2057

      #3
      Could you provide an example of the type of functions you intend to transfer? What language are the scripts using? Are they consistent.

      Comment

      • AmolPalve
        New Member
        • Apr 2008
        • 2

        #4
        Originally posted by jkmyoung
        Could you provide an example of the type of functions you intend to transfer? What language are the scripts using? Are they consistent.
        Thanks for the quick reply. Here is the function that has the issue.
        function checkPrevIsEqua l(oNode,sFieldN ame,sCondition) {

        if (oNode.item(0). selectSingleNod e("Field[@name='" + sFieldName + "']") == null)
        return false;
        var sCurr = oNode.item(0).s electSingleNode ("Field[@name='" + sFieldName + "']").attributes.g etNamedItem("va lue").text;
        var i;

        if(oNode.item(0 ).previousSibli ng == null)
        return false;

        var sPrev = oNode.item(0).p reviousSibling. selectSingleNod e("Field[@name='" + sFieldName + "']").attributes.g etNamedItem("va lue").text;

        if(sCurr.toLowe rCase() == sPrev.toLowerCa se()) {
        if(sCondition != '') {
        var arr = sCondition.spli t("$#$");
        for(i=0;i < arr.length;i++)
        {
        sCondition = "Field[" + arr[i] + "]";
        if( oNode.item(0).p reviousSibling. selectSingleNod e(sCondition) == null)
        return false;
        }
        return true;
        }
        else
        return true;
        }
        else
        return false;

        }


        This function is called from the xsl stylesheet. If I use XSLTransform class for transformation then it works fine, but when I migrated to the XSLCompiledTran sform class, it started giving the compilation errors. I could change some part of this function as below.


        function checkPrevIsEqua l(oNode,sFieldN ame,sCondition)
        {

        oNode.MoveNext( )
        var thisNode = oNode.Current.U nderlyingObject ;



        if( thisNode.Select SingleNode["Field[@name='" + sFieldName + "']"] == null)
        return false;
        var sCurr = thisNode.Select SingleNode["Field[@name='" + sFieldName + "']"].Attributes["value"].Value;
        var i;

        if(thisNode.pre viousSibling == null)
        return false;

        var sPrev = thisNode.previo usSibling .SelectSingleNo de["Field[@name='" + sFieldName + "']"].Attributes["value"].Value;

        if(sCurr.toLowe rCase() == sPrev.toLowerCa se()) {
        if(sCondition != '') {
        var arr = sCondition.spli t("$#$");
        for(i=0;i < arr.length;i++)
        {
        sCondition = "Field[" + arr[i] + "]";
        if( thisNode.previo usSibling.selec tSingleNode[sCondition] == null)
        return false;
        }
        return true;
        }
        else
        return true;
        }
        else
        return false;

        }

        The changes marked in bold are working and giving the expected values. but when it comes to the code line "if(thisNode.Ne xtSibling == null)" it gives error like object doesn't support this property.

        thanks ,,

        Comment

        Working...