This is a small example to transform a simple xml with list of book into a table
The source data is like :
<?xml version="1.0"?>
<catalog>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications
with XML.</description>
</book>
<book id="bk102">
<author>Ralls, Kim</author>
<title>Midnight Rain</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2000-12-16</publish_date>
<description>A former architect battles corporate zombies,
an evil sorceress, and her own childhood to become queen
of the world.</description>
</book>
<book id="bk103">
<author>Corets, Eva</author>
<title>Maeve Ascendant</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2000-11-17</publish_date>
<description>After the collapse of a nanotechnology
society in England, the young survivors lay the
foundation for a new society.</description>
</book>
<book id="bk104">
<author>Corets, Eva</author>
<title>Oberon's Legacy</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2001-03-10</publish_date>
<description>In post-apocalypse England, the mysterious
agent known only as Oberon helps to create a new life
for the inhabitants of London. Sequel to Maeve
Ascendant.</description>
</book>
<book id="bk105">
<author>Corets, Eva</author>
<title>The Sundered Grail</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2001-09-10</publish_date>
<description>The two daughters of Maeve, half-sisters,
battle one another for control of England. Sequel to
Oberon's Legacy.</description>
</book>
<book id="bk109">
<author>Kress, Peter</author>
<title>Paradox Lost</title>
<genre>Science Fiction</genre>
<price>6.95</price>
<publish_date>2000-11-02</publish_date>
<description>After an inadvertant trip through a Heisenberg
Uncertainty Device, James Salway discovers the problems
of being quantum.</description>
</book>
<book id="bk110">
<author>O'Brien, Tim</author>
<title>Microsoft .NET: The Programming Bible</title>
<genre>Computer</genre>
<price>36.95</price>
<publish_date>2000-12-09</publish_date>
<description>Microsoft's .NET initiative is explored in
detail in this deep programmer's reference.</description>
</book>
<book id="bk111">
<author>O'Brien, Tim</author>
<title>MSXML3: A Comprehensive Guide</title>
<genre>Computer</genre>
<price>36.95</price>
<publish_date>2000-12-01</publish_date>
<description>The Microsoft MSXML3 parser is covered in
detail, with attention to XML DOM interfaces, XSLT processing,
SAX and more.</description>
</book>
<book id="bk112">
<author>Galos, Mike</author>
<title>Visual Studio 7: A Comprehensive Guide</title>
<genre>Computer</genre>
<price>49.95</price>
<publish_date>2001-04-16</publish_date>
<description>Microsoft Visual Studio 7 is explored in depth,
looking at how Visual Basic, Visual C++, C#, and ASP+ are
integrated into a comprehensive development
environment.</description>
</catalog>
The target is :
The first generated logic doesn't have enough data to get the mapping fro all category of book, using the Review Result for the field "group"
and adding expected value for the line without mapping
we get to the following logic :
You can access the resulting System link at : https://app.bailam.com/smartmap/2416/smart-link/
The system can transform the file on the serve and can also product the XSLT for the transformation :
<?xml version="1.0"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:csv="csv:csv" xmlns:bailam="http://whatever"
xmlns:fn="http://www.w3.org/2005/xpath-functions">
<xsl:function name="bailam:multiply">
<xsl:param name="x" as="xs:anyAtomicType"/>
<xsl:param name="y" as="xs:anyAtomicType"/>
<xsl:sequence select="fn:number($x) * fn:number($y)" />
</xsl:function>
<xsl:function name="bailam:round">
<xsl:param name="x" as="xs:anyAtomicType?"/>
<xsl:param name="n" as="xs:anyAtomicType?"/>
<xsl:sequence select="fn:round($x)" />
</xsl:function>
<xsl:function name="bailam:addition">
<xsl:param name="x" as="xs:anyAtomicType"/>
<xsl:param name="y" as="xs:anyAtomicType"/>
<xsl:sequence select="fn:number($x) + fn:number($y) " />
</xsl:function>
<xsl:function name="bailam:toLower">
<xsl:param name="s" as="xs:anyAtomicType"/>
<xsl:sequence select="fn:lower-case(fn:string($s)) " />
</xsl:function>
<xsl:function name="bailam:toUpper">
<xsl:param name="s" as="xs:anyAtomicType"/>
<xsl:sequence select="fn:upper-case(fn:string($s)) " />
</xsl:function>
<xsl:function name="bailam:splitWord1">
<xsl:param name="s" as="xs:anyAtomicType"/>
<xsl:sequence select="fn:tokenize( fn:string($s),'\s')[1] " />
</xsl:function>
<xsl:output method="text" encoding="utf-8"/>
<xsl:variable name="delimiter" select="','"/>
<csv:columns>
<column>group</column>
<column>prix</column>
<column>titre</column>
</csv:columns>
<!-- template per tables -->
<xsl:template match="catalog">
<!-- Output the CSV header -->
<xsl:text>group</xsl:text>
<xsl:value-of select="$delimiter"/>
<xsl:text>prix</xsl:text>
<xsl:value-of select="$delimiter"/>
<xsl:text>titre</xsl:text>
<xsl:text>
</xsl:text>
<xsl:apply-templates select="book">
</xsl:apply-templates>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="book">
<!-- Output the CSV header -->
<xsl:variable name="catalog.book.genre" select="genre"/>
<xsl:variable name="catalog.book.price" select="price"/>
<xsl:variable name="catalog.book.title" select="title"/>
<xsl:value-of select="concat('"', ( 'IT', 'HO', 'SF', 'FY', 'RM' )[index-of(( 'Computer' , 'Horror' , 'Science Fiction' , 'Fantasy' , 'Romance' ), $catalog.book.genre)], '"')"/>
<xsl:value-of select="$delimiter"/>
<xsl:value-of select="concat('"',$catalog.book.price, '"')"/>
<xsl:value-of select="$delimiter"/>
<xsl:value-of select="concat('"',$catalog.book.title, '"')"/>
<xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>