How can I transform.
<date>20050416</date>
to
<date>2005-04-16</date>
Today I do like this (but I guess there should be some better ways)
<xslt:template match="date">
<xslt:copy>
<xslt:value-of select="substring(.,1,4)"/>-
<xslt:value-of select="substring(.,5,2)"/>-
<xslt:value-of select="substring(.,7)"/>
</xslt:copy>
</xslt:template> 2 947
J-M Andersson <no****@nospam.nospam> wrote: How can I transform. <date>20050416</date> to <date>2005-04-16</date>
Today I do like this (but I guess there should be some better ways)
<xslt:template match="date"> <xslt:copy> <xslt:value-of select="substring(.,1,4)"/>- <xslt:value-of select="substring(.,5,2)"/>- <xslt:value-of select="substring(.,7)"/> </xslt:copy> </xslt:template>
<xsl:template match='date'>
<xsl:copy>
<xsl:value-of select='concat(substring(.,1,4),"-",
substring(.,5,2),"-",
substring(.,7,2))' />
</xsl:copy>
</xsl:template>
Not a *lot* better, mind. A little. XSLT is limited in its string-
processing capabilities.
Keith
--
Keith Davies "Trying to sway him from his current kook- ke**********@kjdavies.org rant with facts is like trying to create ke**********@gmail.com a vacuum in a room by pushing the air http://www.kjdavies.org/ out with your hands." -- Matt Frisch
Keith Davies wrote:
<xsl:template match='date'> <xsl:copy> <xsl:value-of select='concat(substring(.,1,4),"-", substring(.,5,2),"-", substring(.,7,2))' /> </xsl:copy> </xsl:template>
Not a *lot* better, mind. A little. XSLT is limited in its string- processing capabilities.
Looks good to me, thanks for the hint.
/JM This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Xiaolei Li |
last post by:
first off, i'm a total newbie at this stuff so excuse any wrong usage of
terminology or whatever else.
i have a XSL to transform a Document such that all "text" nodes will
have a "SPAN" inserted...
|
by: bjam |
last post by:
Hi, I am confused here as I am just trying to convert the following XML
file and trying to create a sample xsl to recognize even one of the
nodes does not seem to be working here... Could this be a...
|
by: John Lehmann |
last post by:
I have an interesting problem. I am performing an XSL
transform using the System.Xml.Xsl.Transform class.
I have a database that contains the XSL style sheet
string. And it seems to work pretty...
|
by: Patrick Guio |
last post by:
Dear all,
I am trying to use the std::transform algorithm to to the following
vector< vector<char> >::iterator ik = keys.begin(); // key list iterator
vector< vector<char> >::iterator is = ik;...
|
by: schneider |
last post by:
Anyone know if there is a way to dynamicly create a Xslt template/s and use
them as an
xml transform with-out use files for the Xslt?
All the methods I see use files.
I want to create a Xslt...
|
by: Jason |
last post by:
Hello,
I am working on a problem which requires me to take a String variable
containing some Xml, transform it using Xslt, and dump the result into a
DataSet.
What would be the quickest way...
|
by: Mike Hofer |
last post by:
I've got two statements in my code that are both generating weird,
weird, weird messages:
The first one was,
Dim document As System.Xml.XmlDocument
Dim navigator As...
|
by: Dean Card |
last post by:
Okay, so here is the situation. I have need to do some on-the-fly image
creation. I have everything working great except for the last part of it,
applying a perspective type transform to the...
|
by: Vijai Kalyan |
last post by:
Hello,
I am trying to use std::transform to take in a collection of strings,
transform them and insert the result into an output container. So, I
wrote something like this:
std::wstring...
|
by: Analizer1 |
last post by:
Is there a real time debugger , out here for xsl transform
when i run the xsl transform with a xml file (that represents 2000 or more
rows from a sql 2005 tables)
I get a Statckoverflow...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |