Seems that most of us feel difficulty in dealing with date & time in XSLT.
PART-1
Problem: This post tells you about how to map a string source column to a date destination column.
Assumptions:
To acheive it I created dummy table in Database,
Table name: Test
SourceColumn name: a_str
SourceColumn Value: 20080514
Destination column name: a_dt
Solution:
Lets say,
XPath Expression: /top:testCollection/top:test/top:a_str=$d
To make the database understand about the date, we need to transform the source value. For that we need to use chain of functions.
Analyse the solution given below:
<ns2:a_dt>
<xsl:value-of select='concat(substring($d,1.0,4.0),"-",substring($d,5.0,2.0),"-",substring($d,7.0,2.0))'/>
</ns2:a_dt>
Bingo...It works.
PART-2
Problem: To map a string source column (containing date and time) to a date destination column.
Assumptions:
To acheive it I created dummy table in Database,
Table name: TestSource
Column name: a_strSource
Column Value: 20080514111213
Destination column name: a_dt
Solution:
Lets say,
XPath Expression: /top:testCollection/top:test/top:a_str=$d
To make the database understand about the date and Time, we need to transform the source value. For that we need to use chain of functions. Notice that a "T" is concatinated in the code. This one is for adding the Timezone.
Analyse the solution given below:
<ns2:a_dt>
<xsl:value-of select="concat(substring($d,1.0,4.0),"-",substring($d,5.0,2.0),"-",substring($d,7.0,2.0),'T',substring($d,9.0,2.0),":",substring($d,11.0,2.0),":",substring($d,13.0,2.0))"/>
</ns2:a_dt>
Bingo...It works.
Technical posts containing information and solutions on Oracle Fusion Middleware 12c/11g/10g, AIA, Oracle BPEL PM, Mediator, OSB, MFT, ESB, OWSM, Business Rules, JDeveloper, Oracle Weblogic, Oracle Application Server etc..etc..
Showing posts with label Time. Show all posts
Showing posts with label Time. Show all posts
Friday, July 11, 2008
Thursday, July 10, 2008
XSLT:Examples of Date and Time Formatting-Part-2
XSLT:Examples of Date and Time Formatting
Subscribe to:
Posts (Atom)