xsl-list
[Top] [All Lists]

Re: [xsl] Need help combing two elements

2009-03-27 09:00:53
Hi Wendell, thanks for replying.

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


I worded it incorrectly, but yes I don't want to change the data itself,
simply how it is displayed.

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.


The data is very predictable. It will always be as I've shown above, so I
have no worries about that. I'm not sure what you mean by "edge cases". I'm
very new to XSL, as demonstrated by my use of incorrect terminology.

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.


Yes, I thought formatting dates would be much easier, but it does appear to
be quite tricky.

Cheers,
Wendell


======================================================================
Wendell Piez                            
mailto:wapiez(_at_)mulberrytech(_dot_)com
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
======================================================================


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--