Skip to main content

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>

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>

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


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>

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.