ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Trenton D. Adams" <tre...@athabascau.ca>
Subject XSL transformation
Date Wed, 28 Jan 2009 18:01:02 GMT
Hi Everyone,

I'm not sure if this is useful for you or not.  But, I created an XSL file to transform iBatis
configurations into beans and SQL fragments into full SQL output.

I have attached an example.


It is helpful to open the xml file in your browser, as the XSL file will automatically create
a "full" SQL output for you.  For example, the fragment below, uses a fragment called "ledgerTypeSelect"...

  <select id="getLedger" resultMap="LedgerTypes"
          parameterClass="java.util.Map">
    <include refid="ledgerTypeSelect"/>

     WHERE ledger_id = #ledgerID#;
  </select>

  <sql id="ledgerTypeSelect">
    SELECT ledger_id,
           ledger_name,
           ledger_description,
           ledger_number
      FROM ledger_types
  </sql>

If opening the ledger.xml in the browser, it will translate the "getLedger" select statement
into a complete select statement for you, by automatically including the refid element into
the output.  And, it even includes one line comments to let you know which fragment was included.
 Pretty cool.  That way it is easy to copy and paste SQL into tora, toad, or some other SQL
tool, etc, for testing.

So, the output is like so.  As you can see, it tells you the beginning of the included fragment.
    -- BEGIN getLedger
    
      -- BEGIN ledgerTypeSelect
    SELECT ledger_id,
           ledger_name,
           ledger_description,
           ledger_number
      FROM ledger_types
  
      -- END ledgerTypeSelect
     WHERE ledger_id = #ledgerID#;
  
    -- END getLedger

Trenton D. Adams
Systems Analyst/Web Software Engineer
Navy Penguins at your service!
Athabasca University
(780) 675-6195
:wq!

__ 
    This communication is intended for the use of the recipient to whom it
    is addressed, and may contain confidential, personal, and or privileged
    information. Please contact us immediately if you are not the intended
    recipient of this communication, and do not copy, distribute, or take
    action relying on it. Any communications received in error, or
    subsequent reply, should be deleted or destroyed.
---

Mime
View raw message