开发者

How to transform data with XSLT

I am rea开发者_如何转开发lly new to XSLT but I was wondering if I could use it to solve a problem. I would like to transform data like this:

<thing id=1>

    <value>T</value>

    <dateTime>1/11/2011 09:30 PM</dateTime>

</thing>

<thing id=1>

    <value>F</value>

    <dateTime>1/11/2011 09:32 PM</dateTime>

</thing>

<thing id=2>

    <value>T</value>

    <dateTime>1/11/2011 09:35 PM</dateTime>

</thing>

<thing id=1>

    <value>T</value>

    <dateTime>1/11/2011 09:37 PM</dateTime>

</thing>

<thing id=2>

    <value>F</value>

    <dateTime>1/11/2011 09:40 PM</dateTime>

</thing>

<thing id=1>

    <value>F</value>

    <dateTime>1/11/2011 09:45 PM</dateTime>

</thing>

Into a table like this:

Thing 1

T                                      F                                     Duration

1/11/2011 09:30 PM        1/11/2011 09:32 PM        02:00

1/11/2011 09:37 PM        1/11/2011 09:45 PM        08:00

Thing 2

T                                      F                                     Duration

1/11/2011 09:35 PM        1/11/2011 09:40 PM        05:00

Also, in my above example, I am presuming I have matching (i.e paired) T and F values. If one were actually missing, I would want it to display null or nothing.

So, with that in mind, is it possible to use xslt? If so, how would I do it?

Thanks,

John


You need to decide whether to use XSLT 1.0 or 2.0 here. Your problem involves grouping, and grouping is much easier in XSLT 2.0 - but not all environments yet support XSLT 2.0.

I don't think it's worth trying to suggest any code until you have made this decision.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜