Jump to content
Sign in to follow this  
Mameli0175

XSLT, recursive If test ...

Recommended Posts

Hello,

 

 

I would like to ask you if there is a way to automate the "if test" statement below for the entire XML source or a portion of it, avoiding check any single element:

 

 

XML source:

<PartyIDs>
<ID>100036371</ID>
</PartyIDs>

 

XSLT:
<PartyIDs>
<ID><xsl:value-of select="NS:PartyIDs/NS:ID"/></ID>
<xsl:if test="NS:PartyIDs/NS:DUNSID !=''"><DUNSID><xsl:value-of select="NS:PartyIDs/NS:DUNSID"/></DUNSID></xsl:if>
</PartyIDs>

 

 

XML output:

<PartyIDs>
<ID>100036371</ID>
</PartyIDs>

 

 

Taking off "if test", the output became <DUNSID/> which will cause "DUNSID=Null" and reset that value in the final application.

On the other hand as you can see the source is equal to the destination so I could prepare an XML source as much as close to the destination format ... but it will be strictly dependent.

 

 

Many Thanks.

R.

Marco.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×