Hitachi Vantara Pentaho Community Forums
Results 1 to 7 of 7

Thread: Generate xml with specify format

  1. #1
    Join Date
    Oct 2011
    Posts
    23

    Default Generate xml with specify format

    Hi All,

    Is possible to generate xml with specify format like bellow for example :

    Code:
     <?xml version="1.0" standalone="no"?>
            <!DOCTYPE labels SYSTEM "label.dtd">
            <labels _FORMAT="E:LPN.ZPL" _QUANTITY="1"
            _PRINTERNAME="Printer 1" _JOBNAME="LBL101">
            <label>
            <variable name= "aaa">DPS</variable>
            <variable name= "bbb">RCV</variable>
            <variable name= "yy">14</variable>
            <variable name= "si">GOOD</variable>
            <variable name= "barcode">EA14-DPS-1129</variable>
            </label>
            </labels>
    i just want to specify properties with name label and variable name like above.
    I need it for print to zebra barcode. i want to use pentaho kettle for generate xml instead using application.


    Thanks

  2. #2
    Join Date
    Nov 2008
    Posts
    777

    Default

    Yes, it is possible. Generating the XML is pretty easy but I did have to use an XSL Transformation to add the DOCTYPE declaration and standalone attribute.

    Name:  xml_barcode_print.jpg
Views: 141
Size:  16.2 KB

    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <!DOCTYPE labels  SYSTEM "labels.dtd">
    <labels _FORMAT="E:LPN.ZPL" _JOBNAME="LBL101" _PRINTERNAME="Printer 1" _QUANTITY="1">
       <label>
          <variable name="aaa">DPS</variable>
          <variable name="bbb">RCV</variable>
          <variable name="yy">14</variable>
          <variable name="si">GOOD</variable>
          <variable name="barcode">EA14-DPS-1129</variable>
       </label>
    </labels>
    Attached Files Attached Files
    Last edited by darrell.nelson; 05-16-2014 at 01:05 PM.
    pdi-ce-4.4.0-stable
    Java 1.7 (64 bit)
    MySQL 5.6 (64 bit)
    Windows 7 (64 bit)

  3. #3
    Join Date
    Oct 2011
    Posts
    23

    Default

    Thanks darrell, it's very usefull

    Then i have question, how i can set value of aaa variable,bbb variable as dinamyic value. I need value of these variable get from query table like a table input with specify query.

    What step should i use for that ?

  4. #4
    Join Date
    Nov 2008
    Posts
    777

    Default

    What step to use for table input? Try the Table input​ step.
    pdi-ce-4.4.0-stable
    Java 1.7 (64 bit)
    MySQL 5.6 (64 bit)
    Windows 7 (64 bit)

  5. #5
    Join Date
    Oct 2011
    Posts
    23

    Default

    Hi Darrel,

    yesterday when i try to running your transformation i cannot see any properties on XSL transformation step. It said "index ouf of bound" and have error message like bellow :

    Code:
    014/05/20 10:22:17 - XSL Transformation.0 - ERROR (version 4.2.1-stable, build 15952 from 2011-10-25 15.27.10 by buildguy) : !Xslt.ErrorProcesing : Failed to compile stylesheet. 1 error detected.!
    2014/05/20 10:22:17 - XSL Transformation.0 - ERROR (version 4.2.1-stable, build 15952 from 2011-10-25 15.27.10 by buildguy) : Unexpected error
    2014/05/20 10:22:17 - XSL Transformation.0 - ERROR (version 4.2.1-stable, build 15952 from 2011-10-25 15.27.10 by buildguy) : org.pentaho.di.core.exception.KettleStepException: 
    2014/05/20 10:22:17 - XSL Transformation.0 - ERROR (version 4.2.1-stable, build 15952 from 2011-10-25 15.27.10 by buildguy) : Error while processing:
    2014/05/20 10:22:17 - XSL Transformation.0 - ERROR (version 4.2.1-stable, build 15952 from 2011-10-25 15.27.10 by buildguy) : Failed to compile stylesheet. 1 error detected.
    2014/05/20 10:22:17 - XSL Transformation.0 - ERROR (version 4.2.1-stable, build 15952 from 2011-10-25 15.27.10 by buildguy) : 
    2014/05/20 10:22:17 - XSL Transformation.0 - ERROR (version 4.2.1-stable, build 15952 from 2011-10-25 15.27.10 by buildguy) :     at org.pentaho.di.trans.steps.xslt.Xslt.processRow(Xslt.java:267)
    2014/05/20 10:22:17 - XSL Transformation.0 - ERROR (version 4.2.1-stable, build 15952 from 2011-10-25 15.27.10 by buildguy) :     at org.pentaho.di.trans.step.RunThread.run(RunThread.java:40)
    2014/05/20 10:22:17 - XSL Transformation.0 - ERROR (version 4.2.1-stable, build 15952 from 2011-10-25 15.27.10 by buildguy) :     at java.lang.Thread.run(Thread.java:744)
    2014/05/20 10:22:17 - XSL Transformation.0 - ERROR (version 4.2.1-stable, build 15952 from 2011-10-25 15.27.10 by buildguy) : Caused by: javax.xml.transform.TransformerConfigurationException: Failed to compile stylesheet. 1 error detected.
    2014/05/20 10:22:17 - XSL Transformation.0 - ERROR (version 4.2.1-stable, build 15952 from 2011-10-25 15.27.10 by buildguy) :     at net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:176)
    2014/05/20 10:22:17 - XSL Transformation.0 - ERROR (version 4.2.1-stable, build 15952 from 2011-10-25 15.27.10 by buildguy) :     at net.sf.saxon.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:139)
    2014/05/20 10:22:17 - XSL Transformation.0 - ERROR (version 4.2.1-stable, build 15952 from 2011-10-25 15.27.10 by buildguy) :     at net.sf.saxon.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:91)
    2014/05/20 10:22:17 - XSL Transformation.0 - ERROR (version 4.2.1-stable, build 15952 from 2011-10-25 15.27.10 by buildguy) :     at org.pentaho.di.trans.steps.xslt.XsltData.createNewTemplate(XsltData.java:98)
    2014/05/20 10:22:17 - XSL Transformation.0 - ERROR (version 4.2.1-stable, build 15952 from 2011-10-25 15.27.10 by buildguy) :     at org.pentaho.di.trans.steps.xslt.XsltData.getTemplate(XsltData.java:82)
    2014/05/20 10:22:17 - XSL Transformation.0 - ERROR (version 4.2.1-stable, build 15952 from 2011-10-25 15.27.10 by buildguy) :     at org.pentaho.di.trans.steps.xslt.Xslt.processRow(Xslt.java:220)
    2014/05/20 10:22:17 - XSL Transformation.0 - ERROR (version 4.2.1-stable, build 15952 from 2011-10-25 15.27.10 by buildguy) :     ... 2 more
    2014/05/20 10:22:17 - XSL Transformation.0 - Finished processing (I=0, O=0, R=1, W=0, U=0, E=1)
    2014/05/20 10:22:17 - xml_barcode_print - xml_barcode_print
    I try open that transformation using notepad and see that xsl step have some properties like this

    Code:
     <step>
        <name>XSL Transformation</name>
        <type>XSLT</type>
        <description/>
        <distribute>Y</distribute>
        <copies>1</copies>
             <partitioning>
               <method>none</method>
               <schema_name/>
               </partitioning>
        <xslfilename>${Internal.Transformation.Filename.Directory}/stylesheet.xsl</xslfilename>
        <fieldname>final_xml</fieldname>
        <resultfieldname>result</resultfieldname>
        <xslfilefield/>
        <xslfilefielduse>N</xslfilefielduse>
        <xslfieldisafile>N</xslfieldisafile>
        <xslfactory>JAXP</xslfactory>
        <parameters>
        </parameters>
        <outputproperties>
          <outputproperty>
            <name>standalone</name>
            <value>no</value>
          </outputproperty>
          <outputproperty>
            <name>doctype-system</name>
            <value>labels.dtd</value>
          </outputproperty>
          <outputproperty>
            <name>indent</name>
            <value>yes</value>
          </outputproperty>
        </outputproperties>
         <cluster_schema/>
     <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
          <xloc>440</xloc>
          <yloc>160</yloc>
          <draw>Y</draw>
          </GUI>
        </step>
    I've tried it on my new xsl step, but still have same error message,

    Is the file stylesheet is corrupt or any missing configuration on mine ?

  6. #6
    Join Date
    Nov 2008
    Posts
    777

    Default

    There is a bug in PDI 4.2.1 that is causing your error. It was reported in JIRAs http://jira.pentaho.com/browse/PDI-7109 and http://jira.pentaho.com/browse/PDI-8110. It was fixed in PDI 4.3.0.1 and later. The bug had to do with the XSLT Transformation step not using the filename path properly. If you can't upgrade to a later version then you can try the attached work-around.
    Attached Files Attached Files
    pdi-ce-4.4.0-stable
    Java 1.7 (64 bit)
    MySQL 5.6 (64 bit)
    Windows 7 (64 bit)

  7. #7
    Join Date
    Oct 2011
    Posts
    23

    Default

    Alright, it's work

    How about make dynamic values on data grid ? i want to make dynamic values which data is taken from table input.
    But i've problem when used it.

    I'm confuse on how i can set variable name and variable like on datagrid whereas i used table input, i think both of name and variable on the datagrid step like a array, these are variable but have different values. i'm confusing what step should i use for that ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.