 |
| 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
|
|
|
|

January 20th, 2010, 02:27 PM
|
|
Registered User
|
|
Join Date: Jan 2010
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
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..
|
|

January 20th, 2010, 02:47 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
|
|
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>.
|
|

January 20th, 2010, 02:52 PM
|
|
Registered User
|
|
Join Date: Jan 2010
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by samjudson
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.
|
|

January 21st, 2010, 05:18 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
|
|
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.
|
|

January 24th, 2010, 03:35 PM
|
|
Registered User
|
|
Join Date: Jan 2010
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
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..
|
|

January 24th, 2010, 07:48 PM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
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
|
|
 |