[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Need help combing two elements

Subject: Re: Need help combing two elements
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 26 Mar 2009 18:29:30 -0400
Re:  Need help combing two elements
Fatbob,

At 05:44 PM 3/26/2009, you wrote:
Is it possible to combine two elements using XSL so that they display as
one?

Yes.


Or more precisely, one would not "combine two elements into one", but rather create one element in the result that combined information from more than one element in the source. (XSLT does nothing to the input. It simply looks at it to help decide what to put in the output.)

Here is a sample of my XML file...

<Row Type="Data">
 <Cell longDate="1143122100140" ChangeContext="FID=50020" ShowLink="true"
Status="Normal">Mar 23, 2006</Cell>
 <Cell ChangeContext="FID=50020" ShowLink="true"
Status="Normal">08:44</Cell>
</Row>

As you can see the first cell is a date and the second is a time, I need to
combine and also convert that date to yyyy-MM-dd HH:mm format.

So the example above would end up displaying like 2006-05-23 08:44. Well the
time is fine, just the date needs to be converted.

Is this possible to do in XSL?

It is.


The details of how best to do it would depend on things you haven't told us, such as how regular and predictable your input data is, and what you want to happen in edge cases.

But in general, the casting of values such as "Mar 23, 2006" to "2006-05-03" is going to be more work than the combining of values from two (or several) elements into one.

Cheers,
Wendell


====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.