none
Adding a new namespace through scripting functoid(Inline xslt) in Biztalkmapper in VS2010.

    Question

  • Hello everyone,

    Am writing some InlineXslt script in scripting functoid of BizTalk(2010) mapping file in VisualStudio2010.(It supports only version 1.0).

    I need to use current date-time at many places in my xslt script. To get current date-time, I was using Date-time functoid or writing some C# code in one scripting functoid and passing it as a parameter to another scripting functoid(where xslt script is written).

    But now if I generate xsl file out of mapper, it contains C# namespace and C# code.

    Now I want to do it using only xslt. I want to include EXSLT namespace (http:/exslt.org/dates-and-times) and  extension-element-prefixes="date" , and use a function "date:date-time()" to get current date and time.

    Instead of modifying the generated xsl file, I want to acheive this at an earlier stage so that when I generate xsl file out of Biztalk mapper, it contains only xslt script.

    Is it possible to include this namespace in InlineXslt or Inlinexslt template of scripting functoid, so that I can use the function date-time() while writing xslt script in functoid.

    Any suggestions would be really helpful. Thank you.

    Tuesday, January 14, 2014 1:39 PM

Answers

  • Hi,

        May be you can try this,

    <xsl:stylesheet    xmlns:date="http://exslt.org/dates-and-times"      extension-element-prefixes="date">

      .

      .

            <xsl:value-of select="date:date-time()"/>

      .


    </xsl:stylesheet>


    Or else, If  you are using this in some other application then you will have to use a scripting like Java. For example, 

    <xsl:stylesheet version="1.0"  
                    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  
                    xmlns:java="http://xml.apache.org/xslt/java"  exclude-result-prefixes="java"> 

    ...

    <xsl:value-of select="java:format(java:java.text.SimpleDateFormat.new('yyyy-MM-dd HH:mm:ss.SSS'), java:java.util.Date.new())" />

    ...

    </xsl:stylesheet>


    Atul Toke

    Wednesday, January 15, 2014 9:16 AM

All replies

  • Why do you want to make the change?  Is there something with the C# solution that's not satisfying your requirements?
    Tuesday, January 14, 2014 2:35 PM
  • Hi,

    Try this.

    <!-- This will get the current date time in variable CurrentDate -->

    <xsl:variable  name="CurrentDate" >
           <xsl:value-of select="current-dateTime()"/>
    < /xsl:variable>

    Then you can use the CurrentDate variable in your xslt.

    Hope this will help.

    HTH,

    Sumit


    Sumit Verma - MCTS BizTalk 2006/2010 - Please indicate "Mark as Answer" or "Mark as Helpful" if this post has answered the question


    • Edited by Verma.Sumit Wednesday, January 15, 2014 6:31 AM
    Wednesday, January 15, 2014 6:27 AM
  • Generated xsl files need to be used in some other application which doesn't support C# code. So I want to acheive this functionality using only xslt script.
    Wednesday, January 15, 2014 6:37 AM
  • Hi Sumit,

    Am writing xslt scripts in Visual Studio 2010 which supports only version 1.0

    current-dateTime() function is available in version2.0

    Am searching for a way to do it in version1.0

    Thank you.

    Nikki

    Wednesday, January 15, 2014 6:45 AM
  • Hi,

    Sorry, as I missed the version part.

    As per my understanding, playing with date time just using xslt version 1.0 is not possible. One needs to use some scripting to achieve this.

    HTH

    Sumit


    Sumit Verma - MCTS BizTalk 2006/2010 - Please indicate "Mark as Answer" or "Mark as Helpful" if this post has answered the question

    Wednesday, January 15, 2014 7:49 AM
  • Hi,

        May be you can try this,

    <xsl:stylesheet    xmlns:date="http://exslt.org/dates-and-times"      extension-element-prefixes="date">

      .

      .

            <xsl:value-of select="date:date-time()"/>

      .


    </xsl:stylesheet>


    Or else, If  you are using this in some other application then you will have to use a scripting like Java. For example, 

    <xsl:stylesheet version="1.0"  
                    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  
                    xmlns:java="http://xml.apache.org/xslt/java"  exclude-result-prefixes="java"> 

    ...

    <xsl:value-of select="java:format(java:java.text.SimpleDateFormat.new('yyyy-MM-dd HH:mm:ss.SSS'), java:java.util.Date.new())" />

    ...

    </xsl:stylesheet>


    Atul Toke

    Wednesday, January 15, 2014 9:16 AM
  • Same question has been posted here by the user http://social.msdn.microsoft.com/Forums/en-US/998ef4f1-6745-4876-a2ad-c6abe923200f/adding-a-new-namespace-through-inline-xslt-in-biztalkmapper-in-visualstudio2010?forum=biztalkgeneral

    Just keep one the post and close the other..


    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful.

    Wednesday, January 15, 2014 9:38 AM
  • Hi Nikki,

    Have look at following post : How the extend a custom Xslt in BizTalk using EXSLT 


    Maheshkumar S Tiwari|User Page | http://tech-findings.blogspot.com/


    Wednesday, January 15, 2014 9:41 AM