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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...