Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Xquery: Element to Attribute Mapping - remove empty attribute tags

794954Apr 1 2011 — edited Apr 7 2011
Hi,

I have a requirement to map source schema xml elements to target schema xml element attributes

i have done it like below


<Spd minimumvalue = "{ xs:decimal(data($Test/*:A)) }"
maximumvalue = "{ xs:decimal(data($Test/*:B)) }"
averagevalue = "{ xs:decimal(data($Test/*:C)) }">

Where A,B,C are the source schema elements.

So once the transformation is done the output looks like this

<Spd mimimumvalue="1" maxmiumvalue="" averagevalue="3"/>

Now i got to remove the attribute which has null value.

the output should look like this

<Spd mimimumvalue="1" averagevalue="3"/>

I tried using exists function and implemented it. But then if i have more than 2/3 attributes in the outout xsd then i need to have many if conditions.

Is there any other alternative for this.


Please suggest. Appreciate your help.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 5 2011
Added on Apr 1 2011
3 comments
1,124 views