Click here to Skip to main content
15,887,776 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I have a xml file which has 106 books..

I xsl tranformed it and here:

<xsl:value-of select=" bioghist/bioghist/chronlist/chronitem/date"/>

there is the date that book has created with that format: ddmmyyyy

how can i add slashes? and make it like that dd/mm/yyyy ??

thanks in advance :)
Posted

I think this should do for you:
XML
<xsl:value-of select="ms:format-date(., 'dd/MM/yyyy')"/>


For details of how to use it, look here:
MSDN: ms:format-date Function [^]
 
Share this answer
 
Now the whole xsl doesn't work..

I replaced this:
<br />
<td><xsl:for-each select=" bioghist/bioghist/chronlist/chronitem/date"  /></td>


with the code below..

<td><br />
    <xsl:for-each select=" bioghist/bioghist/chronlist/chronitem/date"  /><br />
    <xsl:value-of select="ms:format-date(., 'dd/MM/yyyy')"/><br />
     </td>
 
Share this answer
 
v2
Comments
Sandeep Mewara 3-Jul-10 8:04am    
Dude!
1. I told you the syntax, not to just copy-paste it! You should have gone through the link i provided for knowing about the parameters and how to use it! Do it!
2. This was suppose to be a comment to my answer, how would i be notified if you are trying to tell me anything if you post it as an answer (that too when it is not an answer)
[no name] 3-Jul-10 8:17am    
sorry, I am used to forums and i answered quickly, I didn't notice there are "add comment" text areas..

yeah i visited that link and i tried to set it at my needs.
I am pretty new to xsl and I don't have much experience..

well it says something about xsd. I don't have xsd(I never used it),
should i add if i want to make the tag: date at a date format using that function?
Sandeep Mewara 3-Jul-10 8:41am    
BTW, what do you mean by whole XSL doesnt work? What is the error/issue? You don't need to add any XSD, current one is fine that you are working with.
Further, since you are new, i would suggest you to download any software to create XSL. Like OXYGEN, it would give you 30 days trial. In it, you can give your source XML, create XSL and check what would be the output.
[no name] 3-Jul-10 10:00am    
ok, now it works, i had one more slash at the <xsl:for-each> tag.
so now.. i see that: dd/MM/yyyy, instead of the date separated by slashes..
is this the right way u suggested me?
if yes, i'll try to find it out..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900