|
From: <ek...@ba...> - 2003-05-14 12:31:05
|
I'm not sure if this is the best way to do it (or even if it will work),
but if you were to do this in two steps:
Step 1: Use SqlEnrich to get the data value that you want out of your DBMS
and into your document
Step 2: Use XslTransform to perform an XSL transformation on your XML, but
include in the transformation script some Velocity scripting that
references the data value that you retrieved in Step 1. Alternatively,
maybe scripting that references the document can allow you to call the
"get" method on the document? If you're not able to access the document
directly from your scripting, you may be able to access it via the
Stage.getDocument( ).
I'm sorry I can't be more certain of a complete answer for you, but maybe
this will take you a bit further or inspire others to correct my
recommendation.
Erik
Sent by: bab...@li...
To: <bab...@li...>
cc:
Subject: [Babeldoc-devel] Advice needed on inserting SQL results back into
documents
I am working with Ken Geis on getting BabelDoc up and running in our
product.
As we are going through understanding BDoc, and seeing how we can use it,
I am stuck on something which seems like it should be a standard thing to
do.
We have XML documents running through the pipelines, and have a need to
include the results of a SQL query back into the XML itself. For example,
we have the name of an item:
<ITEM>
<NAME>An item name</NAME>
</ITEM>
We have a static data table that relates an item name to a code:
CODE table
ID | CODE | NAME |
1 | 25 | An item name |
We need to execute:
Select code from Code where name = $name
We need the result:
<ITEM>
<CODE>25</CODE>
<NAME>An item name</NAME>
</ITEM>
The xslt-velocity-sql example in BDoc 1.0 RC5 sort of looks like the way
to go, but:
- VariableProcessor.executeSqlSelect has been moved to VelocitySqlContext
and seems incomplete (initialize is not called anywhere)
- I think I want to embed the SQL in the XSL, not in the underlying
document. The example has the SQL in the document.
I know about SqlEnrich, but I need the data in the document itself for
downstream processing, not in the BabelDoc attributes.
Does anyone in BabelDoc land have any advice?
Thanks!
Sherman Wood
GalenWorks LLC
415 516-4894
________________________________________________________________________
The information in this e-mail, and any attachment therein, is confidential and for use by the addressee only. If you are not the intended recipient, please return the e-mail to the sender and delete it from your computer. Although The Bank of New York attempts to sweep e-mail and attachments for viruses, it does not guarantee that either are virus-free and accepts no liability for any damage sustained as a result of viruses. |