Skip to Content

convsersion in XSLT mapping...

Hi All,

I am having a requirement where i have to fill the attribute value of a element depending upon the values coming from source and do the date conversions using XSLT mapping. The source and target structures are like that:

Target Structure is:

<InvoiceHeader> (Record)

<VBELN> (element)

<FKDAT> (date element dd/mm/yyyy)

Target Structure:


<invoiceID> (Atrribute) mapped to <VBELN>

<invoice date> (Attribute) mapped to <FKDAT>

The target XSD should come like this:

<InvoiceDetailRequestHeader invoiceID="2100204628" purpose="standard" operation="new" invoiceDate="2009-10-31T00:00:00+5:30">

Request you all to help.



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Nov 10, 2009 at 09:16 AM
    <InvoiceDetailRequestHeader invoiceID="2100204628" purpose="standard" operation="new" invoiceDate="2009-10-

    The target structure does not seem to have purpose and operation attributes....are they constants which you need to map?

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Amit Srivastava

      Check piece of example from w3schools on how to make a XSLT mapping for attribute:

      instead of using single-quote use double-quotes and give the full path of the source field in the xsl:value-of select

      Also I hope that you have declared invoiceID , purpose , operation , invoicedate as attributes in the target structure (in the DT)



  • Nov 10, 2009 at 03:11 PM

    Hi ,

    I have written few days back to convert time date format in XSLT Mapping,Its working fine in my requirement,

    add below code ,if its required change according to your format and append to you xslt ,but if you are adding any JAVA function to your XSLT then you need to add definition of XSLt like below" xmlns:xsl="" exclude-result-prefixes="java">

    <!--<xsl:template name="GetDateFromLocal" xmlns:cal="xalan://java.util.GregorianCalendar">

    * <xsl:param name="Date"/>*

    * <xsl:param name="Time"/>*

    * <xsl:param name="TimeZone"/>*

    * <xsl:variable name="YYYY" select="substring($Date,1,4)"/>*

    * <xsl:variable name="MM" select="substring($Date,5,2) - 1"/>*

    * <xsl:variable name="DD" select="substring($Date,7,2)"/>*

    * <xsl:variable name="hh" select="substring($Time,1,2)"/>*

    * <xsl:variable name="mm" select="substring($Time,3,2)"/>*

    * <xsl:variable name="ss" select="substring($Time,5,2)"/>*

    * <xsl:variable name="today_formatted" select="'yyyyMMdd')"/>*

    * <xsl:variable name="time_formatted" select="'HHmmss')"/>*

    * <xsl:variable name="timezone" select="java:java.util.TimeZone.getTimeZone($TimeZone)"/>*

    * <xsl:variable name="zone" select="java:getRawOffset($timezone)"/>*

    * <xsl:variable name="rightNow" select="cal:getInstance()"/>*

    * <xsl:variable name="DateToUse" select="cal:set($rightNow,$YYYY,$MM,$DD,$hh,$mm,$ss)"/>*

    * <xsl:variable name="time" select="cal:getTimeInMillis($rightNow)"/>*

    * <xsl:variable name="date" select="number(string($time) - string($zone))"/>*

    * <xsl:value-of select="java:format($today_formatted, $date)"/>T<xsl:value-of select="java:format ($time_formatted, $date)"/>*

    * </xsl:template>-->*



    Add comment
    10|10000 characters needed characters exceeded