2 Replies Latest reply on Jan 31, 2008 11:41 AM by tfennelly

    XML to CSV Smook Transformation...

    vsahni

      Hi All,
      I have a requirement to convert an XML to a CSV file through Smooks.
      It appears that the syntax used below does not convert message from XML to CSV. What I see is an untouched output of message prior to running th conversion. Belo from indicates an xml context and to indicates the csv I would like to convert to reading elements from XML.

      Can someone help on this?

      Thanks a lot.

      <resource-config target-profile="from-type:text/xml:smooks-geneva-order-xml AND to-type:text/csv:geneva-canonical-order-xml" selector= "csv-set">
       <resource type="xsl">
       <![CDATA[
       <xsl:for-each select="csv-record">
       <xsl:value-of select="custodian"/>,
       <xsl:value-of select="OTCListed"/>,
       <xsl:value-of select="productType"/>
       </xsl:for-each>
       ]]>
       </resource>
       <param name="is-xslt-templatelet">true</param>
       </resource-config>


        • 1. Re: XML to CSV Smook Transformation...
          tfennelly

          Hi there.

          I didn't show the structure of your input XML, but my guess is that you can't easily perform this transform using an XSL templatelet i.e. you'd need to specify a full stylesheet with 2 templates... 1st one to pick up the context node and the 2nd to iterate the "rows" (called from the 1st).

          • 2. Re: XML to CSV Smook Transformation...
            tfennelly

            I should also say that you could do this by applying a model driven transform i.e. populate an object model with the row data from the XML and then apply a template (e.g. FreeMarker, XSLT, StringTemplate)