Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - XML export from Access Parse Date [Thread Next] Re: XML export from Access Parse DateTo: NULL Date: 4/7/2009 6:12:00 PM redant34 wrote: > <Courses> > > <Date>3/04/2009</Date> > > <Title>Ocean Star Museum FENG 1001</Title> > <Description>Galveston Offshore Rig Museum</Description> > > </Courses> > > > > To this: > > > <events> > <event> > <month>3</month> > <day>4</day> > <year>2009</year> > <text>Ocean Star Museum FENG 1001</text> > <popuplink/> > <style/> > <tooltip/> > <script/> > </event> > > > I know I need to use XSLT, but can I parse the date? SHould I put Day > Month and Year separate in the database? Can it be parsed? Do you use XSLT 2.0 or 1.0? With XSLT 2.0 you can do e.g. <xsl:template match="Courses"> <xsl:variable name="date-parts" select="tokenize(Date, '/')"/> <xsl:variable name="month" select="$date-parts[1]"/> <xsl:variable name="day" select="$date-parts[2]"/> <xsl:variable name="year" select="$date-parts[3]"/> With XSLT 1.0 it is a bit more complicated <xsl:template match="Courses"> <xsl:variable name="month" select="substring-before(Date, '/')"/> <xsl:variable name="day" select="substring-before(substring-after(Date, '/'), '/')"/> <xsl:variable name="year" select="substring-after(substring-after(Date, '/'), '/')"/> -- Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
