Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8148593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:40:34+00:00 2026-06-06T14:40:34+00:00

i have input xml as <content> <date> <day>14</day> <month>06</month> <year>2012</year> </date> </content> want it

  • 0

i have input xml as

           <content>
             <date>
            <day>14</day>
               <month>06</month>
                <year>2012</year>
               </date>
            </content>

want it to be converted into

          <content>
               <date>2012-06-14T00:00:00</date>
           </content>

xslt used

           <?xml version="1.0" encoding="utf-8"?>
            <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
             <xsl:output method="xml" indent="yes"/>

              <xsl:template match="content">
                 <content>
                   <xsl:apply-templates select="date"/>
                 </content>
              </xsl:template>

                 <xsl:template match="date">
                  <date>
                   <xsl:variable name="year" select="year"/>
                   <xsl:variable name="month" select="month"/>
                   <xsl:variable name="day" select="day"/>
               <xsl:value-of select="$year" />-<xsl:value-of select="$month"/>-
                 <xsl:value-of  select="$day"/>

                 </date>   
                </xsl:template>        

    </xsl:stylesheet>

i want date in YYYYMMDDTHH:MM:SS format as example 2012-06-15T02:52:37 how can i get it.Which function in xslt “1.0” pics the strings and take the format pattern as such. Can aynone please help me in getting the above format.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T14:40:35+00:00Added an answer on June 6, 2026 at 2:40 pm

    This transformation:

    <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:output omit-xml-declaration="yes" indent="yes"/>
     <xsl:strip-space elements="*"/>
    
     <xsl:template match="/*">
         <content>
           <xsl:apply-templates/>
         </content>
     </xsl:template>
    
     <xsl:template match="date">
      <date>
       <xsl:value-of select="concat(year, '-', month, '-', day, 'T00:00:00')"/>
      </date>
     </xsl:template>
    </xsl:stylesheet>
    

    when applied on the provided XML document:

    <content>
        <date>
            <day>14</day>
            <month>06</month>
            <year>2012</year>
        </date>
    </content>
    

    produces the wanted, correct result:

    <content>
       <date>2012-06-14T00:00:00</date>
    </content>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my .xml file where I have used two scrollview,in Input Edittext and
I have a XSLT which will split large xml file into multiple xml file
I have input xml of the form <content xml:lang=en xmlns:w=http://www.w.com/sch/W> <w:firstRowHeader>true</w:firstRowHeader> <w:firstColumnHeader>true</w:firstColumnHeader> <w:customTable> <w:tableContent>
I have an XML input as shown below: <?xml version=1.0 encoding=utf-8?> <Content> <section name=FileID/>
I have the following input XML: <root age=1> <description>some text</description> <section> <item name=a> <uuid>1</uuid>
This is my input xml. The xml can have maximunm three nodes and minimum
I have this use case of an xml file with input like Input: <abc
I have written xml file which contains html tags as element like <component> <input
I have input.txt and I want to search for a string and extract a
I have a input file Main.xml <?xml version=1.0 encoding=utf-8 ?> <Employees> <Employee> <id name=id>1</id>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.