BizTalk 2009
Hi.
I have a flat file with fixed field lengths and optional segments, like these 3 messages:
HEAabcPATdef
HEAabcANGdef
HEAabcPATdefANGghi
The start of each message is marked by HEA and the end by CrLf.
In my example each message can have 3 segments starting with HEA, PAT and ANG. Each segment has 2 elements. The cardinality of the HEA segment is 1 and of the others 0 or 1.
The first message of the example should be transferred to such XML
<SapBatch>
<Sap>
<HEA>
<SegName>HEA</SegName>
<ElmHea>abc</ElmHea>
</HEA>
<PAT>
<SegName>PAT</SegName>
<ElmPat>def</ElmPat>
</PAT>
</Sap>
</SapBatch>
Although I specified Min and Max Occurs in the schema, I learned from the web to put a Sequence node in front of the optional segments like this:
It works fine.
Now I use this schema as source in a mapping. Because of the Sequence nodes, the mapper puts around the optional segments such code:
<xsl:for-each select="Sap/PAT"> ... </xsl:for-each>
I want to check in the graphical mapper the existence of the PAT node. I cannot put functioids to that node, because the code within <xsl:for-each select="Sap/PAT"> is ignored if PAT is missing.
Then I used the XSL code of the mapper and put around <xsl:for-each select="Sap/PAT"> this code for the check:
<xsl:choose>
<xsl:when test="not(SapHcm/PAT)">
...
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="SapHcm/PAT">
...
I assigned the so modified XSL code as file to the map and it does what I want. But I don't have the graphical view of the mapper anymore and this is very helpful because my schema is much bigger than showed here.
So my question: How can I check in the graphical mapper the existence of optional nodes?
I would be happy for every hint