XSLT: For each node transform, if A =2 and A=1 were both found do this else do that
Posted
by Larry
on Stack Overflow
See other posts from Stack Overflow
or by Larry
Published on 2010-03-19T15:04:13Z
Indexed on
2010/03/19
15:51 UTC
Read the original article
Hit count: 162
xslt
Example 1:
<time>
<timestamp>01:00</timestamp>
<event>arrived<event>
</time>
<time>
<timestamp>02:00</timestamp>
<event>left<event>
</time>
Example 2:
<time>
<timestamp>02:00</timestamp>
<event>left<event>
</time>
The XSLT needs to do:
- FOR EACH node DO:
- IF event=arrived THEN set eventtype=atdestination
- IF event=left is found AND event=arrived is found THEN set new node type=leftdestination ELSE set type=left
XSLT applied to example 1:
<event>
<time>01:00</time>
<type>atdestination</type>
<event>
<event>
<time>02:00</time>
<type>leftdestination</type>
<event>
XSLT applied to example 2:
<event>
<time>02:00</time>
<type>left</type>
<event>
© Stack Overflow or respective owner