[xslt] data callbacks?



Just came across libxslt and it's brilliant (and fast!). I was thinking about embedding it into an app as a report generator and I think what I want to do is possible, but I wanted to double-check here first.

I'd like to write some XML that describes a report - basic layout information plus what columns/rows of data to output. But there is no actual data in this XML - the data needs to be generated on the fly within my application. I'd like to stick some custom elements or attributes that cause libxslt to call back into my application using a callback function and replace that element with possibly more elements with specific text nodes.

For example, let's say I have an element like this:

   <data id="income" range="5"/>

In my template, I'd like to convert this to something like this in the resulting XML:

   <data>100.00</data>
   <data>200.00</data>
   <data>300.00</data>
   <data>400.00</data>
   <data>500.00</data>

So what I'd like to happen is for the xslt to see the "range" and "id" attributes and then call back into my code with information about this element. Then I'd like my code to replace this element with its own set of elements, filling in the data values as it goes.

Is this possible? Is this a good idea? Any suggestions on what API to use to handle this?

--
Paul Miller | paul fxtech com | www.fxtech.com | Got Tivo?



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]