Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Newbie: XSLT substring or date format

Reply
Thread Tools

Newbie: XSLT substring or date format

 
 
David Bertolo
Guest
Posts: n/a
 
      02-19-2004
Hi

I'm currently using an existing xsl file to display an XML file.
But I would like change the date format from 2004/02/18-17:26 to 2004/02/18.
I'm trying to find some examples with format date or substring function but
it doesn't work.
There are in comment the two things that I have tried.

My xsl file is:
<?xml version="1.0" encoding="UTF-16"?>
<xsl:stylesheet xmlnssl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<body>
<table border="1" cellpadding="8" cellspacing="0">
<tr>
<td bgcolor="#88CCAA"><center><i><b>Name</b></i></center></td>
<td bgcolor="#88CCAA"><center><i><b>Date</b></i></center></td>
<td bgcolor="#88CCAA"><center><i><b>Size</b></i></center></td>
</tr>
<xsl:for-each select="Elements/Element">
<tr>
<td bgcolor="#EEDDFF"><xsl:value-of select="@Name"/></td>
<td bgcolor="#EEDDFF"><xsl:value-of select="@Date"/></td>
<!--<td bgcolor="#EEDDFF"><xsl:value-of
select="substring(@Date,1,10)"/></td> -->
<!--<td bgcolor="#EEDDFF"><xsl:value-of
select="substring-before(@Date,'-')"/></td>-->
<td bgcolor="#EEDDFF"><xsl:value-of select="@size"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

Thank you in advance

David


 
Reply With Quote
 
 
 
 
David Bertolo
Guest
Posts: n/a
 
      02-19-2004
I solved my problem by replacing this line:
<xsl:stylesheet xmlnssl="http://www.w3.org/TR/WD-xsl">
by this line:
<xsl:stylesheet version="1.0"
xmlnssl="http://www.w3.org/1999/XSL/Transform">

Bye

David

"David Bertolo" <(E-Mail Removed)> wrote in message
news:40349ca0$0$21655$(E-Mail Removed)...
> Hi
>
> I'm currently using an existing xsl file to display an XML file.
> But I would like change the date format from 2004/02/18-17:26 to

2004/02/18.
> I'm trying to find some examples with format date or substring function

but
> it doesn't work.
> There are in comment the two things that I have tried.
>
> My xsl file is:
> <?xml version="1.0" encoding="UTF-16"?>
> <xsl:stylesheet xmlnssl="http://www.w3.org/TR/WD-xsl">
> <xsl:template match="/">
> <html>
> <body>
> <table border="1" cellpadding="8" cellspacing="0">
> <tr>
> <td bgcolor="#88CCAA"><center><i><b>Name</b></i></center></td>
> <td bgcolor="#88CCAA"><center><i><b>Date</b></i></center></td>
> <td bgcolor="#88CCAA"><center><i><b>Size</b></i></center></td>
> </tr>
> <xsl:for-each select="Elements/Element">
> <tr>
> <td bgcolor="#EEDDFF"><xsl:value-of select="@Name"/></td>
> <td bgcolor="#EEDDFF"><xsl:value-of select="@Date"/></td>
> <!--<td bgcolor="#EEDDFF"><xsl:value-of
> select="substring(@Date,1,10)"/></td> -->
> <!--<td bgcolor="#EEDDFF"><xsl:value-of
> select="substring-before(@Date,'-')"/></td>-->
> <td bgcolor="#EEDDFF"><xsl:value-of select="@size"/></td>
> </tr>
> </xsl:for-each>
> </table>
> </body>
> </html>
> </xsl:template>
> </xsl:stylesheet>
>
> Thank you in advance
>
> David
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RegEx search for a substring within a substring colinhumber@gmail.com Perl Misc 3 08-03-2005 04:29 PM
Date, date date date.... Peter Grison Java 10 05-30-2004 01:20 PM
Date Format - best way of converting a string into a date format Brian Candy ASP .Net 2 02-18-2004 02:13 PM
Given a date, how to find the beginning date and ending date of that week Matt ASP .Net 1 11-08-2003 09:14 PM
Given a date, how to find the beginning date and ending date of that week Matt C++ 2 11-08-2003 08:30 PM



Advertisments