stylesheet.c 18.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
/*
 *    XSLTemplate/XSLProcessor support
 *
 * Copyright 2011 Nikolay Sivov for CodeWeavers
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 */

#define COBJMACROS

#include "config.h"

#include <stdarg.h>
26 27 28 29 30
#ifdef HAVE_LIBXML2
# include <libxml/parser.h>
# include <libxml/xmlerror.h>
#endif

31 32 33 34 35 36 37 38 39 40 41 42
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "ole2.h"
#include "msxml6.h"

#include "msxml_private.h"

#include "wine/debug.h"

WINE_DEFAULT_DEBUG_CHANNEL(msxml);

43
typedef struct
44
{
45
    DispatchEx dispex;
46 47
    IXSLTemplate IXSLTemplate_iface;
    LONG ref;
48 49

    IXMLDOMNode *node;
50 51
} xsltemplate;

52
typedef struct
53
{
54
    DispatchEx dispex;
55 56
    IXSLProcessor IXSLProcessor_iface;
    LONG ref;
57

58
    xsltemplate *stylesheet;
59
    IXMLDOMNode *input;
60

61
    IStream     *output;
62
    BSTR         outstr;
63 64

    struct xslprocessor_params params;
65 66
} xslprocessor;

67
static HRESULT XSLProcessor_create(xsltemplate*, IXSLProcessor**);
68

69 70 71 72 73
static inline xsltemplate *impl_from_IXSLTemplate( IXSLTemplate *iface )
{
    return CONTAINING_RECORD(iface, xsltemplate, IXSLTemplate_iface);
}

74 75 76 77 78
static inline xslprocessor *impl_from_IXSLProcessor( IXSLProcessor *iface )
{
    return CONTAINING_RECORD(iface, xslprocessor, IXSLProcessor_iface);
}

79 80 81 82 83 84 85 86 87
static void xslprocessor_par_free(struct xslprocessor_params *params, struct xslprocessor_par *par)
{
    params->count--;
    list_remove(&par->entry);
    SysFreeString(par->name);
    SysFreeString(par->value);
    heap_free(par);
}

88 89 90 91 92 93 94
static void xsltemplate_set_node( xsltemplate *This, IXMLDOMNode *node )
{
    if (This->node) IXMLDOMNode_Release(This->node);
    This->node = node;
    if (node) IXMLDOMNode_AddRef(node);
}

95 96 97 98 99 100 101 102 103 104 105 106 107 108
static HRESULT WINAPI xsltemplate_QueryInterface(
    IXSLTemplate *iface,
    REFIID riid,
    void** ppvObject )
{
    xsltemplate *This = impl_from_IXSLTemplate( iface );
    TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);

    if ( IsEqualGUID( riid, &IID_IXSLTemplate ) ||
         IsEqualGUID( riid, &IID_IDispatch ) ||
         IsEqualGUID( riid, &IID_IUnknown ) )
    {
        *ppvObject = iface;
    }
109 110 111 112
    else if (dispex_query_interface(&This->dispex, riid, ppvObject))
    {
        return *ppvObject ? S_OK : E_NOINTERFACE;
    }
113 114 115
    else
    {
        FIXME("Unsupported interface %s\n", debugstr_guid(riid));
116
        *ppvObject = NULL;
117 118 119 120 121 122 123 124 125 126
        return E_NOINTERFACE;
    }

    IUnknown_AddRef((IUnknown*)*ppvObject);
    return S_OK;
}

static ULONG WINAPI xsltemplate_AddRef( IXSLTemplate *iface )
{
    xsltemplate *This = impl_from_IXSLTemplate( iface );
127 128 129
    ULONG ref = InterlockedIncrement( &This->ref );
    TRACE("(%p)->(%d)\n", This, ref);
    return ref;
130 131 132 133 134
}

static ULONG WINAPI xsltemplate_Release( IXSLTemplate *iface )
{
    xsltemplate *This = impl_from_IXSLTemplate( iface );
135
    ULONG ref = InterlockedDecrement( &This->ref );
136

137
    TRACE("(%p)->(%d)\n", This, ref);
138
    if ( ref == 0 )
139 140
    {
        if (This->node) IXMLDOMNode_Release( This->node );
141
        heap_free( This );
142
    }
143 144 145 146 147 148 149

    return ref;
}

static HRESULT WINAPI xsltemplate_GetTypeInfoCount( IXSLTemplate *iface, UINT* pctinfo )
{
    xsltemplate *This = impl_from_IXSLTemplate( iface );
150
    return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
151 152 153 154 155 156 157 158
}

static HRESULT WINAPI xsltemplate_GetTypeInfo(
    IXSLTemplate *iface,
    UINT iTInfo, LCID lcid,
    ITypeInfo** ppTInfo )
{
    xsltemplate *This = impl_from_IXSLTemplate( iface );
159 160
    return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface,
        iTInfo, lcid, ppTInfo);
161 162 163 164 165 166 167 168
}

static HRESULT WINAPI xsltemplate_GetIDsOfNames(
    IXSLTemplate *iface,
    REFIID riid, LPOLESTR* rgszNames,
    UINT cNames, LCID lcid, DISPID* rgDispId )
{
    xsltemplate *This = impl_from_IXSLTemplate( iface );
169 170
    return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface,
        riid, rgszNames, cNames, lcid, rgDispId);
171 172 173 174 175 176 177 178 179
}

static HRESULT WINAPI xsltemplate_Invoke(
    IXSLTemplate *iface,
    DISPID dispIdMember, REFIID riid, LCID lcid,
    WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult,
    EXCEPINFO* pExcepInfo, UINT* puArgErr )
{
    xsltemplate *This = impl_from_IXSLTemplate( iface );
180 181
    return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface,
        dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
182 183 184 185 186 187 188
}

static HRESULT WINAPI xsltemplate_putref_stylesheet( IXSLTemplate *iface,
    IXMLDOMNode *node)
{
    xsltemplate *This = impl_from_IXSLTemplate( iface );

189 190 191 192 193 194 195 196 197 198 199 200
    TRACE("(%p)->(%p)\n", This, node);

    if (!node)
    {
        xsltemplate_set_node(This, NULL);
        return S_OK;
    }

    /* FIXME: test for document type */
    xsltemplate_set_node(This, node);

    return S_OK;
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
}

static HRESULT WINAPI xsltemplate_get_stylesheet( IXSLTemplate *iface,
    IXMLDOMNode **node)
{
    xsltemplate *This = impl_from_IXSLTemplate( iface );

    FIXME("(%p)->(%p): stub\n", This, node);
    return E_NOTIMPL;
}

static HRESULT WINAPI xsltemplate_createProcessor( IXSLTemplate *iface,
    IXSLProcessor **processor)
{
    xsltemplate *This = impl_from_IXSLTemplate( iface );

217 218 219 220
    TRACE("(%p)->(%p)\n", This, processor);

    if (!processor) return E_INVALIDARG;

221
    return XSLProcessor_create(This, processor);
222 223
}

224
static const struct IXSLTemplateVtbl XSLTemplateVtbl =
225 226 227 228 229 230 231 232 233 234 235 236 237
{
    xsltemplate_QueryInterface,
    xsltemplate_AddRef,
    xsltemplate_Release,
    xsltemplate_GetTypeInfoCount,
    xsltemplate_GetTypeInfo,
    xsltemplate_GetIDsOfNames,
    xsltemplate_Invoke,
    xsltemplate_putref_stylesheet,
    xsltemplate_get_stylesheet,
    xsltemplate_createProcessor
};

238 239 240 241 242 243 244 245 246 247 248 249
static const tid_t xsltemplate_iface_tids[] = {
    IXSLTemplate_tid,
    0
};

static dispex_static_data_t xsltemplate_dispex = {
    NULL,
    IXSLTemplate_tid,
    NULL,
    xsltemplate_iface_tids
};

250
HRESULT XSLTemplate_create(void **ppObj)
251 252 253
{
    xsltemplate *This;

254
    TRACE("(%p)\n", ppObj);
255 256 257 258 259

    This = heap_alloc( sizeof (*This) );
    if(!This)
        return E_OUTOFMEMORY;

260
    This->IXSLTemplate_iface.lpVtbl = &XSLTemplateVtbl;
261
    This->ref = 1;
262
    This->node = NULL;
263
    init_dispex(&This->dispex, (IUnknown*)&This->IXSLTemplate_iface, &xsltemplate_dispex);
264 265 266 267 268 269 270 271

    *ppObj = &This->IXSLTemplate_iface;

    TRACE("returning iface %p\n", *ppObj);

    return S_OK;
}

272 273 274 275 276 277 278 279 280 281 282 283 284 285 286
/*** IXSLProcessor ***/
static HRESULT WINAPI xslprocessor_QueryInterface(
    IXSLProcessor *iface,
    REFIID riid,
    void** ppvObject )
{
    xslprocessor *This = impl_from_IXSLProcessor( iface );
    TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);

    if ( IsEqualGUID( riid, &IID_IXSLProcessor ) ||
         IsEqualGUID( riid, &IID_IDispatch ) ||
         IsEqualGUID( riid, &IID_IUnknown ) )
    {
        *ppvObject = iface;
    }
287 288 289 290
    else if (dispex_query_interface(&This->dispex, riid, ppvObject))
    {
        return *ppvObject ? S_OK : E_NOINTERFACE;
    }
291 292 293
    else
    {
        FIXME("Unsupported interface %s\n", debugstr_guid(riid));
294
        *ppvObject = NULL;
295 296 297 298 299 300 301 302 303 304
        return E_NOINTERFACE;
    }

    IUnknown_AddRef((IUnknown*)*ppvObject);
    return S_OK;
}

static ULONG WINAPI xslprocessor_AddRef( IXSLProcessor *iface )
{
    xslprocessor *This = impl_from_IXSLProcessor( iface );
305 306 307
    ULONG ref = InterlockedIncrement( &This->ref );
    TRACE("(%p)->(%d)\n", This, ref);
    return ref;
308 309 310 311 312
}

static ULONG WINAPI xslprocessor_Release( IXSLProcessor *iface )
{
    xslprocessor *This = impl_from_IXSLProcessor( iface );
313
    ULONG ref = InterlockedDecrement( &This->ref );
314

315
    TRACE("(%p)->(%d)\n", This, ref);
316
    if ( ref == 0 )
317
    {
318 319
        struct xslprocessor_par *par, *par2;

320
        if (This->input) IXMLDOMNode_Release(This->input);
321
        if (This->output) IStream_Release(This->output);
322
        SysFreeString(This->outstr);
323 324 325 326

        LIST_FOR_EACH_ENTRY_SAFE(par, par2, &This->params.list, struct xslprocessor_par, entry)
            xslprocessor_par_free(&This->params, par);

327
        IXSLTemplate_Release(&This->stylesheet->IXSLTemplate_iface);
328
        heap_free( This );
329
    }
330 331 332 333 334 335 336

    return ref;
}

static HRESULT WINAPI xslprocessor_GetTypeInfoCount( IXSLProcessor *iface, UINT* pctinfo )
{
    xslprocessor *This = impl_from_IXSLProcessor( iface );
337
    return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
338 339 340 341 342 343 344 345
}

static HRESULT WINAPI xslprocessor_GetTypeInfo(
    IXSLProcessor *iface,
    UINT iTInfo, LCID lcid,
    ITypeInfo** ppTInfo )
{
    xslprocessor *This = impl_from_IXSLProcessor( iface );
346 347
    return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface,
        iTInfo, lcid, ppTInfo);
348 349 350 351 352 353 354 355
}

static HRESULT WINAPI xslprocessor_GetIDsOfNames(
    IXSLProcessor *iface,
    REFIID riid, LPOLESTR* rgszNames,
    UINT cNames, LCID lcid, DISPID* rgDispId )
{
    xslprocessor *This = impl_from_IXSLProcessor( iface );
356 357
    return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface,
        riid, rgszNames, cNames, lcid, rgDispId);
358 359 360 361 362 363 364 365 366
}

static HRESULT WINAPI xslprocessor_Invoke(
    IXSLProcessor *iface,
    DISPID dispIdMember, REFIID riid, LCID lcid,
    WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult,
    EXCEPINFO* pExcepInfo, UINT* puArgErr )
{
    xslprocessor *This = impl_from_IXSLProcessor( iface );
367 368
    return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface,
        dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
369 370 371 372 373
}

static HRESULT WINAPI xslprocessor_put_input( IXSLProcessor *iface, VARIANT input )
{
    xslprocessor *This = impl_from_IXSLProcessor( iface );
374 375
    IXMLDOMNode *input_node;
    HRESULT hr;
376

377 378 379 380 381 382 383 384 385 386 387
    TRACE("(%p)->(%s)\n", This, debugstr_variant(&input));

    /* try IXMLDOMNode directly first */
    if (V_VT(&input) == VT_UNKNOWN)
        hr = IUnknown_QueryInterface(V_UNKNOWN(&input), &IID_IXMLDOMNode, (void**)&input_node);
    else if (V_VT(&input) == VT_DISPATCH)
        hr = IDispatch_QueryInterface(V_DISPATCH(&input), &IID_IXMLDOMNode, (void**)&input_node);
    else
    {
        IXMLDOMDocument *doc;

388
        hr = DOMDocument_create(MSXML_DEFAULT, (void**)&doc);
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406
        if (hr == S_OK)
        {
            VARIANT_BOOL b;

            hr = IXMLDOMDocument_load(doc, input, &b);
            if (hr == S_OK)
                hr = IXMLDOMDocument_QueryInterface(doc, &IID_IXMLDOMNode, (void**)&input_node);
            IXMLDOMDocument_Release(doc);
        }
    }

    if (hr == S_OK)
    {
        if (This->input) IXMLDOMNode_Release(This->input);
        This->input = input_node;
    }

    return hr;
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433
}

static HRESULT WINAPI xslprocessor_get_input( IXSLProcessor *iface, VARIANT *input )
{
    xslprocessor *This = impl_from_IXSLProcessor( iface );

    FIXME("(%p)->(%p): stub\n", This, input);
    return E_NOTIMPL;
}

static HRESULT WINAPI xslprocessor_get_ownerTemplate(
    IXSLProcessor *iface,
    IXSLTemplate **template)
{
    xslprocessor *This = impl_from_IXSLProcessor( iface );

    FIXME("(%p)->(%p): stub\n", This, template);
    return E_NOTIMPL;
}

static HRESULT WINAPI xslprocessor_setStartMode(
    IXSLProcessor *iface,
    BSTR p,
    BSTR uri)
{
    xslprocessor *This = impl_from_IXSLProcessor( iface );

434
    FIXME("(%p)->(%s %s): stub\n", This, debugstr_w(p), debugstr_w(uri));
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462
    return E_NOTIMPL;
}

static HRESULT WINAPI xslprocessor_get_startMode(
    IXSLProcessor *iface,
    BSTR *p)
{
    xslprocessor *This = impl_from_IXSLProcessor( iface );

    FIXME("(%p)->(%p): stub\n", This, p);
    return E_NOTIMPL;
}

static HRESULT WINAPI xslprocessor_get_startModeURI(
    IXSLProcessor *iface,
    BSTR *uri)
{
    xslprocessor *This = impl_from_IXSLProcessor( iface );

    FIXME("(%p)->(%p): stub\n", This, uri);
    return E_NOTIMPL;
}

static HRESULT WINAPI xslprocessor_put_output(
    IXSLProcessor *iface,
    VARIANT output)
{
    xslprocessor *This = impl_from_IXSLProcessor( iface );
463 464
    IStream *stream;
    HRESULT hr;
465

466
    TRACE("(%p)->(%s)\n", This, debugstr_variant(&output));
467 468 469 470 471 472 473 474 475

    switch (V_VT(&output))
    {
      case VT_EMPTY:
        stream = NULL;
        hr = S_OK;
        break;
      case VT_UNKNOWN:
        hr = IUnknown_QueryInterface(V_UNKNOWN(&output), &IID_IStream, (void**)&stream);
476 477
        if (FAILED(hr))
            WARN("failed to get IStream from output, 0x%08x\n", hr);
478 479
        break;
      default:
480
        FIXME("output type %d not handled\n", V_VT(&output));
481 482 483 484 485 486 487 488 489 490
        hr = E_FAIL;
    }

    if (hr == S_OK)
    {
        if (This->output) IStream_Release(This->output);
        This->output = stream;
    }

    return hr;
491 492 493 494 495 496 497 498
}

static HRESULT WINAPI xslprocessor_get_output(
    IXSLProcessor *iface,
    VARIANT *output)
{
    xslprocessor *This = impl_from_IXSLProcessor( iface );

499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517
    TRACE("(%p)->(%p)\n", This, output);

    if (!output) return E_INVALIDARG;

    if (This->output)
    {
        V_VT(output) = VT_UNKNOWN;
        V_UNKNOWN(output) = (IUnknown*)This->output;
        IStream_AddRef(This->output);
    }
    else if (This->outstr)
    {
        V_VT(output) = VT_BSTR;
        V_BSTR(output) = SysAllocString(This->outstr);
    }
    else
        V_VT(output) = VT_EMPTY;

    return S_OK;
518 519 520 521
}

static HRESULT WINAPI xslprocessor_transform(
    IXSLProcessor *iface,
522
    VARIANT_BOOL  *ret)
523
{
524
#ifdef HAVE_LIBXML2
525
    xslprocessor *This = impl_from_IXSLProcessor( iface );
526
    HRESULT hr;
527

528 529 530 531
    TRACE("(%p)->(%p)\n", This, ret);

    if (!ret) return E_INVALIDARG;

532
    SysFreeString(This->outstr);
533 534
    hr = node_transform_node_params(get_node_obj(This->input), This->stylesheet->node, &This->outstr, This->output, &This->params);
    *ret = hr == S_OK ? VARIANT_TRUE : VARIANT_FALSE;
535
    return hr;
536 537 538 539
#else
    FIXME("libxml2 is required but wasn't present at compile time\n");
    return E_NOTIMPL;
#endif
540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559
}

static HRESULT WINAPI xslprocessor_reset( IXSLProcessor *iface )
{
    xslprocessor *This = impl_from_IXSLProcessor( iface );

    FIXME("(%p): stub\n", This);
    return E_NOTIMPL;
}

static HRESULT WINAPI xslprocessor_get_readyState(
    IXSLProcessor *iface,
    LONG *state)
{
    xslprocessor *This = impl_from_IXSLProcessor( iface );

    FIXME("(%p)->(%p): stub\n", This, state);
    return E_NOTIMPL;
}

560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579
static HRESULT xslprocessor_set_parvalue(const VARIANT *var, struct xslprocessor_par *par)
{
    HRESULT hr = S_OK;

    switch (V_VT(var))
    {
    case VT_BSTR:
    {
        par->value = SysAllocString(V_BSTR(var));
        if (!par->value) hr = E_OUTOFMEMORY;
        break;
    }
    default:
        FIXME("value type %d not handled\n", V_VT(var));
        hr = E_NOTIMPL;
    }

    return hr;
}

580 581 582 583 584 585 586
static HRESULT WINAPI xslprocessor_addParameter(
    IXSLProcessor *iface,
    BSTR p,
    VARIANT var,
    BSTR uri)
{
    xslprocessor *This = impl_from_IXSLProcessor( iface );
587 588
    struct xslprocessor_par *cur, *par = NULL;
    HRESULT hr;
589

590
    TRACE("(%p)->(%s %s %s)\n", This, debugstr_w(p), debugstr_variant(&var),
591
        debugstr_w(uri));
592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638

    if (uri && *uri)
        FIXME("namespace uri is not supported\n");

    /* search for existing parameter first */
    LIST_FOR_EACH_ENTRY(cur, &This->params.list, struct xslprocessor_par, entry)
    {
        if (!strcmpW(cur->name, p))
        {
            par = cur;
            break;
        }
    }

    /* override with new value or add new parameter */
    if (par)
    {
        if (V_VT(&var) == VT_NULL || V_VT(&var) == VT_EMPTY)
        {
            /* remove parameter */
            xslprocessor_par_free(&This->params, par);
            return S_OK;
        }
        SysFreeString(par->value);
        par->value = NULL;
    }
    else
    {
        /* new parameter */
        par = heap_alloc(sizeof(struct xslprocessor_par));
        if (!par) return E_OUTOFMEMORY;

        par->name = SysAllocString(p);
        if (!par->name)
        {
            heap_free(par);
            return E_OUTOFMEMORY;
        }
        list_add_tail(&This->params.list, &par->entry);
        This->params.count++;
    }

    hr = xslprocessor_set_parvalue(&var, par);
    if (FAILED(hr))
        xslprocessor_par_free(&This->params, par);

    return hr;
639 640 641 642 643 644 645 646 647
}

static HRESULT WINAPI xslprocessor_addObject(
    IXSLProcessor *iface,
    IDispatch *obj,
    BSTR uri)
{
    xslprocessor *This = impl_from_IXSLProcessor( iface );

648
    FIXME("(%p)->(%p %s): stub\n", This, obj, debugstr_w(uri));
649 650 651 652 653 654 655 656 657 658 659 660 661
    return E_NOTIMPL;
}

static HRESULT WINAPI xslprocessor_get_stylesheet(
    IXSLProcessor *iface,
    IXMLDOMNode  **node)
{
    xslprocessor *This = impl_from_IXSLProcessor( iface );

    FIXME("(%p)->(%p): stub\n", This, node);
    return E_NOTIMPL;
}

662
static const struct IXSLProcessorVtbl XSLProcessorVtbl =
663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686
{
    xslprocessor_QueryInterface,
    xslprocessor_AddRef,
    xslprocessor_Release,
    xslprocessor_GetTypeInfoCount,
    xslprocessor_GetTypeInfo,
    xslprocessor_GetIDsOfNames,
    xslprocessor_Invoke,
    xslprocessor_put_input,
    xslprocessor_get_input,
    xslprocessor_get_ownerTemplate,
    xslprocessor_setStartMode,
    xslprocessor_get_startMode,
    xslprocessor_get_startModeURI,
    xslprocessor_put_output,
    xslprocessor_get_output,
    xslprocessor_transform,
    xslprocessor_reset,
    xslprocessor_get_readyState,
    xslprocessor_addParameter,
    xslprocessor_addObject,
    xslprocessor_get_stylesheet
};

687 688 689 690 691 692 693 694 695 696 697 698
static const tid_t xslprocessor_iface_tids[] = {
    IXSLProcessor_tid,
    0
};

static dispex_static_data_t xslprocessor_dispex = {
    NULL,
    IXSLProcessor_tid,
    NULL,
    xslprocessor_iface_tids
};

699
HRESULT XSLProcessor_create(xsltemplate *template, IXSLProcessor **ppObj)
700 701 702 703 704 705 706 707 708
{
    xslprocessor *This;

    TRACE("(%p)\n", ppObj);

    This = heap_alloc( sizeof (*This) );
    if(!This)
        return E_OUTOFMEMORY;

709
    This->IXSLProcessor_iface.lpVtbl = &XSLProcessorVtbl;
710
    This->ref = 1;
711
    This->input = NULL;
712
    This->output = NULL;
713
    This->outstr = NULL;
714 715
    list_init(&This->params.list);
    This->params.count = 0;
716 717
    This->stylesheet = template;
    IXSLTemplate_AddRef(&template->IXSLTemplate_iface);
718
    init_dispex(&This->dispex, (IUnknown*)&This->IXSLProcessor_iface, &xslprocessor_dispex);
719 720 721 722 723 724 725

    *ppObj = &This->IXSLProcessor_iface;

    TRACE("returning iface %p\n", *ppObj);

    return S_OK;
}