[jboss-dev-forums] [Design of JBoss ESB] - Problem in XML to CSV transformation
Neha29
do-not-reply at jboss.com
Thu Jul 10 05:01:57 EDT 2008
I am exploring jboss-soa-p.4.2.0. I am facing a problem with XML to CSV transformation.
Smooks does not give any direct way of XML to CSV transformation.So I have tried this transformation using XSLT but it is not working as desired.
The trouble is it is not working when I am running this with jboss-soa-p.4.2.0 which uses Smooks 0.9. This works correctly with Smooks 1.0 used in later versions of Jboss ESB .
In the result with Smooks 0.9, i am getting the desired csv within the root element "AssignedTaskDetails".
My input xml is :
| <xml version="1.0"?>
| <AssignedTaskDetails>
| <task>
| <TaskId>641f71c1</TaskId>
| <TaskDescription>Javatesting</TaskDescription>
| <TaskCompletionTime> EOD</TaskCompletionTime>
| <TaskresponseDetails>ok</TaskresponseDetails>
| <isCancelled>false</isCancelled>
| <isCompleted>false</isCompleted>
| </task>
| <task>
| <TaskId>845dfdf0</TaskId>
| <TaskDescription>Javacoding</TaskDescription>
| <TaskCompletionTime>Urgent</TaskCompletionTime>
| <TaskresponseDetails> will do</TaskresponseDetails>
| <isCancelled>false</isCancelled>
| <isCompleted>false</isCompleted>
| </task>
| </AssignedTaskDetails>
|
The result I obtain is:
<AssignedTaskDetails>
| 641f71c1,Javatesting,EoD,ok,false,false
|
| 845dfdf0,Javacoding,Urgent,yps,false,false
|
| </AssignedTaskDetails>
The smooks config is:
| <?xml version='1.0' encoding='UTF-8'?>
| <smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd">
| <resource-config selector="task">
| <resource>BasicXslTransform.xsl</resource>
| </resource-config>
| </smooks-resource-list>
My BasicXslTransform is:
| <?xml version="1.0" encoding="UTF-8"?>
| <xsl:stylesheet version="1.0"
| xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
| <xsl:output method="text"/>
| <xsl:template match="AssignedTaskDetails">
| <xsl:apply-templates select="task"/>
| </xsl:template>
| <xsl:template match="task">
| <xsl:for-each select="*">
| <xsl:value-of select="."/>
| <xsl:if test="position() != last()">
| <xsl:value-of select="','"/>
| </xsl:if>
| </xsl:for-each>
| <xsl:text> </xsl:text>
| </xsl:template>
| </xsl:stylesheet>
In smooks-config if I give resource-config selector as "AssignedTaskDetails" then the result is same as the input xml.
How should i go about this?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4163490#4163490
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4163490
More information about the jboss-dev-forums
mailing list