cancel
Showing results for 
Search instead for 
Did you mean: 

Carriage return Line feed. How to implement question

Former Member
0 Kudos

A little over two months ago a suggestion was given to one of the topics on how to insert a carriage return after each row in an XML file. I have this requirement but I am not that experienced with XI and have no experience with XSLT mapping. The XSLT mapping given was as follows:

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

<!--

XI Mapping StyleSheet

Name: IdentityTransform.xsl

-->

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml" indent="yes"/>

<!-- Identity Transform

Copy the source XML to the output without any changes -->

<xsl:template match="node() | @*">

<xsl:copy>

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

</xsl:copy>

</xsl:template>

</xsl:stylesheet>

I've taken this information and put it into a file. I saved this file with an xml extension. I then used a java command to create a jar file which I subsequently imported as an "Imported Archives" under my interface mappings. This seemed to work fine. I can see the archive program in XI called cr_lf.xml which represents the above code.

Hopefully I am on the right track so far. What I don't understand know is how to create the interface mapping for this. All I have ever used in XI is message mapping. I'm not sure how to define the source interface or the target interface. I think once I have these defined properly I can then use my archived program "cr_lf.xml" as the mapping program.

My questions are:

Am I on the right track?

What does the source interface and source message look like?

What does the target interface and target message look like?

I'm trying to expand my knowledge base beyond the simple message mapping so any help is appreciated.

Thanks,

Jim

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Jim -

Yes, you are on the right track.

Creating an interface mapping that references a XSLT or Java mapping is not any different than creating one for a Message Mapping. You just have to select the mapping type (e.g. XSL) instead of the default (Message Mapping).

Your source and target messages and interfaces are really not dependent on the TYPE of mapping you choose. So, you should approach it in the same way you would have if the mapping you were going to do was a message mapping. Ideally, the interfaces and associated messages are created before the mapping itself.

In your case, I guess you're just testing using XSLT by choosing the Identity mapping. FYI, currently XI does not perform any schema validation out of the box. Given that, your interface could just use a dummy/bogus message type and your scenario will work.

Regards,

Jin

Former Member
0 Kudos

Jin. This seemed to easy. I just added the XSLT map as the last mapping program in my current interface mapping and received the expected results of the carriage return being added to the final XML file. I still don't understand all the internal working of XI but I guess I never will. I was pleasantly surprised at the results. Thanks for your help and input.

Jim

Former Member
0 Kudos

This method works great for adding a carriage return. My customer requires a carriage return and line feed at the end of the XML document. They ahve their own homegrown XML parser and it is looking for a carraige return and line feed.

I am not an XSLT or java programmer. Can the XSLT code be modified to provide the line feed character as well or is there a simple java program that I can use to do this. I know their are some great XSLT or java programmers reading this.

I could sure use a hand on this.

Thanks,

Jim