Date convert to xslt function

Last post 11-08-2009 11:44 PM by kavita_khandhadia. 4 replies.

Sort Posts:

  • Date convert to xslt function

    11-07-2009, 8:08 AM
    • Member
      112 point Member
    • kiki12345
    • Member since 06-07-2007, 1:42 AM
    • Posts 58

    Hi,

    I have c# code like this i want to convert this code into xslt format like write function in "xslt" and return final result like dueDate? is possible
    writing in xslt?

    DateTime endDate= "DateTime.Now" ->Actually i got this DateTime int Month=endDate.Month; int day=endDate.Day; int Year=endDate.Year; int maxDay= DateTime.DaysInMonth(Year,Moth); if(day == maxDay) { DateTime tempDate=endDate.AddMonths(1); int tempMonth=tempDate.Month; int tempYear=tempDate.Year; int tempDay=tempDate.Day; dueDate=tempDate.DaysInMonth(tempYear,tempMonth,tempDay); } else { dueDate=endDate.AddMonth(1); }

    when i call this function from xslt i want to retun this value like dueDate at finally is it possible?


    Regards

    venkat.



  • Re: Date convert to xslt function

    11-07-2009, 12:08 PM

    Microsoft's XslCompiledTransform XSLT 1.0 processor supports two ways of using C# or VB.NET to implement functions that can be called from within the XSLT stylesheet:

    1. extension objects
    2. extension functions

    So that way you can put your C# code into a method, expose the method to XSLT and call it from the stylesheet.

    Martin Honnen --- MVP XML
    My blog
  • Re: Date convert to xslt function

    11-07-2009, 9:45 PM
    • Member
      112 point Member
    • kiki12345
    • Member since 06-07-2007, 1:42 AM
    • Posts 58

    Hi,

    Thanks for you reply.Can you give me small example which will call function. I am trying i unable to get any value. Thank


  • Re: Date convert to xslt function

    11-08-2009, 8:46 AM
    Answer
  • Re: Date convert to xslt function

    11-08-2009, 11:44 PM
    Answer

    kiki12345:

    Hi,

    Thanks for you reply.Can you give me small example which will call function. I am trying i unable to get any value. Thank



    You can check out a sample on my blog post at

    http://kavstech.blogspot.com/2009/08/how-to-use-external-function-in-xslt.html


    Please mark this post as Answer if it is of help to you!

    " Every wall is a door..! "
Page 1 of 1 (5 items)