Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions
txMozillaXSLTProcessor.h File Reference
#include "ExprResult.h"
#include "nsIDocumentTransformer.h"
#include "nsIVariant.h"
#include "nsIXSLTProcessor.h"
#include "nsVoidArray.h"
#include "nsWeakPtr.h"
#include "txExpandedNameMap.h"
#include "txXMLEventHandler.h"
#include "nsIXSLTProcessorObsolete.h"
#include "nsIXSLTProcessorPrivate.h"
#include "txXSLTProcessor.h"
#include "nsAutoPtr.h"
#include "nsIDocumentObserver.h"
#include "txNamespaceMap.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  txVariable
class  txMozillaXSLTProcessor
 txMozillaXSLTProcessor is a front-end to the XSLT Processor. More...

Defines

#define TRANSFORMIIX_XSLT_PROCESSOR_CID   { 0xbacd8ad0, 0x552f, 0x11d3, {0xa9, 0xf7, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74} }
#define TRANSFORMIIX_XSLT_PROCESSOR_CONTRACTID   "@mozilla.org/document-transformer;1?type=xslt"
#define XSLT_MSGS_URL   "chrome://global/locale/xslt/xslt.properties"

Functions

nsresult TX_LoadSheet (nsIURI *aUri, txMozillaXSLTProcessor *aProcessor, nsILoadGroup *aLoadGroup, nsIPrincipal *aCallerPrincipal)
nsresult TX_CompileStylesheet (nsIDOMNode *aNode, txMozillaXSLTProcessor *aProcessor, txStylesheet **aStylesheet)

Define Documentation

#define TRANSFORMIIX_XSLT_PROCESSOR_CID   { 0xbacd8ad0, 0x552f, 0x11d3, {0xa9, 0xf7, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74} }

Definition at line 65 of file txMozillaXSLTProcessor.h.

#define TRANSFORMIIX_XSLT_PROCESSOR_CONTRACTID   "@mozilla.org/document-transformer;1?type=xslt"

Definition at line 68 of file txMozillaXSLTProcessor.h.

#define XSLT_MSGS_URL   "chrome://global/locale/xslt/xslt.properties"

Definition at line 71 of file txMozillaXSLTProcessor.h.


Function Documentation

nsresult TX_CompileStylesheet ( nsIDOMNode aNode,
txMozillaXSLTProcessor aProcessor,
txStylesheet **  aStylesheet 
)

Definition at line 802 of file txMozillaStylesheetCompiler.cpp.

{
    // XXX This would be simpler if GetBaseURI lived on nsINode
    nsCOMPtr<nsIURI> uri;
    nsCOMPtr<nsIDocument> doc;
    nsCOMPtr<nsIContent> cont = do_QueryInterface(aNode);
    if (cont) {
        doc = cont->GetOwnerDoc();
        NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);

        uri = cont->GetBaseURI();
    }
    else {
        doc = do_QueryInterface(aNode);
        NS_ASSERTION(doc, "aNode should be a doc or an element by now");

        uri = doc->GetBaseURI();
    }

    NS_ENSURE_TRUE(uri, NS_ERROR_FAILURE);
    
    nsCAutoString spec;
    uri->GetSpec(spec);
    NS_ConvertUTF8toUTF16 baseURI(spec);

    uri = doc->GetDocumentURI();
    NS_ENSURE_TRUE(uri, NS_ERROR_FAILURE);

    uri->GetSpec(spec);
    NS_ConvertUTF8toUTF16 stylesheetURI(spec);

    nsRefPtr<txSyncCompileObserver> obs =
        new txSyncCompileObserver(aProcessor);
    NS_ENSURE_TRUE(obs, NS_ERROR_OUT_OF_MEMORY);

    nsRefPtr<txStylesheetCompiler> compiler =
        new txStylesheetCompiler(stylesheetURI, obs);
    NS_ENSURE_TRUE(compiler, NS_ERROR_OUT_OF_MEMORY);

    compiler->setBaseURI(baseURI);

    nsresult rv = handleNode(aNode, compiler);
    if (NS_FAILED(rv)) {
        compiler->cancel(rv);
        return rv;
    }

    rv = compiler->doneLoading();
    NS_ENSURE_SUCCESS(rv, rv);
    
    *aStylesheet = compiler->getStylesheet();
    NS_ADDREF(*aStylesheet);

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult TX_LoadSheet ( nsIURI aUri,
txMozillaXSLTProcessor aProcessor,
nsILoadGroup aLoadGroup,
nsIPrincipal aCallerPrincipal 
)

Definition at line 584 of file txMozillaStylesheetCompiler.cpp.

{
    nsCAutoString spec;
    aUri->GetSpec(spec);
    PR_LOG(txLog::xslt, PR_LOG_ALWAYS, ("TX_LoadSheet: %s\n", spec.get()));

    nsCOMPtr<nsIURI> referrerURI;
    aCallerPrincipal->GetURI(getter_AddRefs(referrerURI));
    NS_ASSERTION(referrerURI, "Caller principal must have a URI!");

    // Pass source document as the context
    nsresult rv = CheckLoadURI(aUri, referrerURI, aCallerPrincipal,
                               aProcessor->GetSourceContentModel());
    NS_ENSURE_SUCCESS(rv, rv);

    nsRefPtr<txCompileObserver> observer =
        new txCompileObserver(aProcessor, aLoadGroup);
    NS_ENSURE_TRUE(observer, NS_ERROR_OUT_OF_MEMORY);

    nsRefPtr<txStylesheetCompiler> compiler =
        new txStylesheetCompiler(NS_ConvertUTF8toUTF16(spec), observer);
    NS_ENSURE_TRUE(compiler, NS_ERROR_OUT_OF_MEMORY);

    return observer->startLoad(aUri, compiler, referrerURI);
}

Here is the call graph for this function:

Here is the caller graph for this function: