Download Delve® SOA Fast-Prototyping Toolkit (Beta 1.0)
| Tutorials - How to Transform a Single XML Element |
Page 1 of 1 |
The concept of transformation need not necessarily be applied to an entire document. In fact, sometimes we just want to transform a single element. This lesson demonstrates the manner in which this can most easily be accomplished.
Generally speaking, the easiest way to create a new element “A” based on the content of an old element “B” is to create an instance of A by passing in an instance of B as an argument. Suppose we have an element of type “office-suite”…

…and we want to transform it into an element “office-suite-new” in which “property-id” is not an attribute, but a child element. This can be accomplished as follows:

Most of the element’s code consists statements that copy content from one member of the old element to an identical member of the new. The one exception is the “property-id” assignment statement, which pull data from attribute and assigns it to an element.
|
|
|