Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Rmcobol XML extensions reading an xml file with a stylesheet

Rmcobol XML extensions reading an xml file with a stylesheet

Rmcobol XML extensions reading an xml file with a stylesheet

I am trying to read a simple xml file that has attributes with a stylesheet, and I need to capture the data in tags that duplicate like AddressLine. For some reason I can't capture the AddressLine data. I am getting all the other data like Zip, State, City, Name just fine, but getting spaces for the AddressLine. Here is an example of my xml file, stylesheet and cobol program:

focus3.xml (XML FILE)

<?xml version="1.0" encoding="UTF-8"?>

<focus-address Zip="78728" State="TX" City="Austin" Name="Micro Focus" Timestamp="10544627">

<addressAll AddressLine="8310 North Capital of Tesax Highway"/>

<addressAll AddressLine="Building 1, Suite 155"/>



XML Stylesheet:

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="">www.w3.org/.../Transform" >
<xsl:output method="xml" encoding="UTF-8"/>
<xsl:template match="/">
<xsl:apply-templates select="focus-address" />
<xsl:template match="focus-address">
<xp-TimeStamp><xsl:value-of select="@Timestamp"/></xp-TimeStamp>
<xp-Name><xsl:value-of select="@Name"/></xp-Name>
<xp-City><xsl:value-of select="@City"/></xp-City>
<xp-State><xsl:value-of select="@State"/></xp-State>
<xp-Zip><xsl:value-of select="@Zip"/></xp-Zip>
<xsl:for-each select="focus-address/addressAll/AddressLine">
<xp-Address-Line><xsl:value-of select="focus-address/addressAll/@AddressLine"/></xp-Address-Line>

Cobol program:

Data Division.
Working-Storage Section.
01 Focus-Address.
02 xp-TimeStamp Pic 9(8).
02 xp-Name Pic X(64).
02 xp-City Pic X(32).
02 xp-State Pic X(2).
02 xp-Zip Pic 9(5).
02 Mainaddress.
20 Addressall OCCURS 1 TO 2 TIMES
DEPENDING ON Address-Lines.
30 xp-Address-Line Pic X(64).
01 Done Pic X.
01 Address-lines Pic 9.
Copy "../cpy/lixmlall.cpy".

Procedure Division.
A. Display "Example-3 - Illustrate EXPORT FILE & IMPORT FILE"
If Not XML-OK Go to Z.

Move 2 to Address-Lines.

Move Spaces to Focus-Address.


If Not XML-OK Go to Z.
Display "focus3.xml imported by XML IMPORT FILE".
Display xp-Name.
Display xp-Address-Line(1).
Display xp-Address-Line(2).
Display xp-City xp-State xp-Zip.
Display xp-TimeStamp.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close