This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to managed tables XML IMPORT TEXT

Hi I´m trying to move some tags to a data cobol structure, this tags have occurs.

how do i have to refer the data cobol structure at the .xslt.

normally its automatic, but If want to parser one by 

I have tried these ones and always got error,

<xsl:template match="d:Document/d:BkToCstmrDbtCdtNtfctn/d:GrpHdr/d:MsgId[position()=1]">

   <xsl:element name="docume54.campo1[position()=1]">

   <xsl:apply-templates select="@* | node()"/>

 </xsl:element>

 </xsl:template>

 

<xsl:template match="d:Document/d:BkToCstmrDbtCdtNtfctn/d:GrpHdr/d:MsgId[position()=1]">

   <xsl:element name="docume54.campo1[1]">

   <xsl:apply-templates select="@* | node()"/>

 </xsl:element>

 </xsl:template>

 <xsl:template match="d:Document/d:BkToCstmrDbtCdtNtfctn/d:GrpHdr/d:MsgId[position()=1]">

    <xsl:element name="docume54.campo1(1)">

    <xsl:apply-templates select="@* | node()"/>

  </xsl:element>

  </xsl:template>

  • Suggested Answer

    0

    You are getting errors because those are not valid XML names.

    To designate a specific occurrence in the COBOL data structure, you must use the subscript attribute in the imported document.  See XML Extensions User's Guide, Chapter 4, Sparse COBOL Records, Example 4, table5.xml

  • 0

    Using <xsl:element> is not required in most situations  So you could simply code the following:

    <xsl:template match="d:Document/d:BkToCstmrDbtCdtNtfctn/d:GrpHdr/d:MsgId[position()=1]">
       <campo1 subscript="1">
    ...
       </campo1>
    </xsl:template>

    <xsl:element> is useful in situations where you might have to synthesize an element name.  But using simple literal elements as above can result in a much more maintainable stylesheet.  Since this stylesheet is targeting a COBOL data structure, the XML element names are fixed.