Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XML export from Access Parse Date

From: Martin Honnen <mahotrash@-----.-->
To: 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/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent