BizTalk mapper: XSD CHOICE group; suppress child node with attribute with default value

Home Page Forums BizTalk 2004 – BizTalk 2010 BizTalk mapper: XSD CHOICE group; suppress child node with attribute with default value

Viewing 1 reply thread
  • Author
    Posts
    • #16272

      Hi guys

       we have an urgent issue that we are trying to resolve prior to demo-ing to a client next week the benefits of using BTS(!)

       We have a legacy XSD that has a number of cases where there is a CHOICE group that contains a number of child nodes: only 1 of these child nodes should appear in the output message. However, most of these children (or their descendants somewhere down the line) have optional attributes that default values, the intention being that if (and only if) you create an instance of that child then a default value can be supplied for this attribute.

      In the BTS mapper we map the fields from the input message to the single choice/child node that we need: however, behind the scenes the BTS mapper is also creating an instance of each of the children in the choice group that has an attribute with a default value; we see this in the xsl when we validate the map, and we can see all these extra nodes if we switch off output validation when we test the map; if we leave output map validation on then the output fails the validation because we have broken the choice rule (i.e. more than one of the choices is in the output message).

      I know that we could get rid of all the default values in the xsd but (a) the xsd is not owned by us and (b) it seems perfectly legitimate to have these defaults in there.

      So the question is: how do we stop the BTS mapper auto-generating unwanted instances of CHOICE group child nodes that have attributes with default values??

      Many thanks in advance

      Bob

    • #16303

      Have you tried using a Logical Function and passing False (using = and set 0 and 1 as values) to the node?  That might cause the nodes to not show up.

       

      If not, it might be the pipelines adding the nodes.  Are you using the Xml Transmit?

      • #16341

        One way to check if the mapper is adding the choice nodes with default values is to check the Xslt output from the mapper.

        Use the Validate Map command, this will compile the map and present you with a link to the Xslt in the ouput window.

        If the mapper is adding the default values, you have 2 options:
        1. remove the default values from your schema
        2. use a custom Xslt and remove the mapper generated xsl statements you do not want.

         

      • #26587

        Same problem here solved by adding a logical function resulting in false to the nodes that need to be surpressed

Viewing 1 reply thread
  • The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.