Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 20th, 2010, 02:27 PM
Registered User
 
Join Date: Jan 2010
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Default Eror help

You have gone off the question, I didn't ask for that.

Last edited by t_herbert47; January 21st, 2010 at 04:40 AM..
 
Old January 20th, 2010, 02:47 PM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Firstly the error: You can't give a variable a select attribute and have content inside it.

Secondly: you appear to be trying to use some regex command, but don't actually use it. Are you missing a <xsl:analyze-string> instruction somewhere?

The reason it is outputing just "--" is because the variables $year, $month and $day are all empty. They are all empty because regex-group() function is returning nothing, because it is meant to be used inside <xsl:analyse-string>.
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?
 
Old January 20th, 2010, 02:52 PM
Registered User
 
Join Date: Jan 2010
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by samjudson View Post
Firstly the error: You can't give a variable a select attribute and have content inside it.

Secondly: you appear to be trying to use some regex command, but don't actually use it. Are you missing a <xsl:analyze-string> instruction somewhere?

The reason it is outputing just "--" is because the variables $year, $month and $day are all empty. They are all empty because regex-group() function is returning nothing, because it is meant to be used inside <xsl:analyse-string>.
I have tried with <xsl:analyze-string> but still there is nothing as result. I have been dealing with this for 3 days and nothing.
 
Old January 21st, 2010, 05:18 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Sorry, you've deleted the post I was replying to so now I don't know what you stuck on.

Have you tried any of the solutions we tried with Christian? Also, are you using XSLT 2.0? Because if you're not then xsl:analyse-string wont work, and you'll have to use substring-after() and substring-before() to get the parts of the dates.

In fact if you are using XSLT 1.0 then format-date doesn't exist in the core language. You might find your processor supports some of the extension methods, such as the EXSLT functions which may help.
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?
 
Old January 24th, 2010, 03:35 PM
Registered User
 
Join Date: Jan 2010
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Default

I was trying to convert a iso date to the output which I asked before but it is not working. How can I do it?

Last edited by t_herbert47; January 25th, 2010 at 08:53 AM..
 
Old January 24th, 2010, 07:48 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Your original message gave example dates like 12-3-2001. But your regex will only match if the day and month are exactly two digits.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Read XML apply XSLT and format the data navik_pathak XSLT 5 April 28th, 2009 11:43 AM
regex-group problem in XSLT rajashekhara XSLT 10 March 6th, 2009 05:05 AM
regex in xslt rajesh_css XSLT 4 September 29th, 2008 11:35 PM
Creating XML doc ; writing string(xml format) into KamalRaturi XML 5 May 28th, 2008 05:51 AM
Converting XML into a particular format using XSLT AjayLuthria XSLT 1 April 10th, 2007 09:47 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.