Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: XSL Transform Suggestion

  1. #1

    Default XSL Transform Suggestion

    I am using XSL right now in what I think is probably a very common way with Spoon: as a preprocessor to convert complex XML to a more Spoon-readable format. I can use XSL for example, to convert attribute-named elements e.g.:


    <object type="item">Item Value</object>
    <object type="location">Location Value</object>
    <object type="sku">SKU Value</object>



    To the much more Spoon-friendly:



    <item>Item Value</item>
    <location>Location Value</location>
    <sku>SKU Value</sku>



    One fairly simple way to automate this process in Spoon would be to add a checkbox to the XML Input Step asking if the XML should be transformed prior to being processed. If the box is checked, the user would have a file browse box to pick the XSL stylesheet with which to convert it. Behind the scenes, the XML Input step would just insert the transformation processi.e.






    javax.xml.transform.TransformerFactory transFact =
    javax.xml.transform.TransformerFactory.newInstance( );

    javax.xml.transform.Transformer trans =
    transFact.newTransformer(xsltSource);

    trans.transform(xmlSource, result);



    And use the transformed XML during the XML Input step.



    This approach lets Spoon incorporate all the power of XSL without copying it and without having to pass hierarchical data between steps.

  2. #2
    Join Date
    Nov 1999
    Posts
    9,729

    Default RE: XSL Transform Suggestion

    Hi David,

    That&#39;s a great idea, but I have little to no knowledge about XSL transformations.
    Perhaps someone else of the devs can pick this up?

    In any case, the XML used by the transformations is not using key-value pairs, but is (fairly) human-readeable.
    So I guess you&#39;re talking about the XML Input step. As interactive stuff is not possible in batch-processing situations, the thing to do would be to allow the user to specify the XSL file in the XML Input Dialog.

    Processing will then take place on the resulting file, not the originally specified XML file(s).

    Is this what you&#39;re talking about?

    Thanks!

    Matt

  3. #3
    Join Date
    Sep 2005
    Posts
    1,403

    Default RE: XSL Transform Suggestion

    Yes I would like to see this feature too!


    Actually, I think that it would be even nicer if this would be a separate kind of step, to promote reuse of a particular XSL transformation.



    XSLT could be quite expensive though - at least I do not know an XSLT processor that can handle a stream of XML - they all read the input into mem, and then perform the transformation which can be quite expensive when applied in bulk. But I know people that use XSLT to transform ~>= 10 Mb XML input - they just wait a while.

  4. #4
    Join Date
    Nov 1999
    Posts
    9,729

    Default RE: XSL Transform Suggestion

    You can turn it into a Job Entry in Chef.
    The new logic allows you to pass filenames around so this can be done.

    Matt

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.