XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Alicia RobertsSubject: not create tag when field is missing
Author: Alicia Roberts
Date: 01 Aug 2007 10:17 AM
Hello,

When the field from source is missing, how do you not create the tag? I'm creating an xml map and sometime the field will be missing when data is not populate and I don't want the tag to come out on the destination(output) with no data. Here the logic have and I want to add logic to not send if field is missing.

<xsl:for-each select="Z1MDP01">
<CustomInformation>
<xsl:attribute name="Custom">
<xsl:value-of select="CUSTOMTXT"/>
</xsl:attribute>
<xsl:attribute name="Date">
<xsl:value-of select="CUSTOMDT"/>
</xsl:attribute>
<xsl:attribute name="Number">
<xsl:value-of select="CUSTOMNO"/>
</xsl:attribute>
<CustomInformation>
</xsl:for-each>

Postnext
Tony LavinioSubject: not create tag when field is missing
Author: Tony Lavinio
Date: 01 Aug 2007 12:01 PM
Just wrap it in a simple xsl:if test.

<xsl:if test="CUSTOMTXT">
<xsl:attribute name="Custom">
<xsl:value-of select="CUSTOMTXT"/>
</xsl:attribute>
</xsl:if>

Posttop
Alicia RobertsSubject: not create tag when field is missing
Author: Alicia Roberts
Date: 01 Aug 2007 12:59 PM
Thanks. The logic worked.

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.