Back to index

lightning-sunbird  0.9+nobinonly
Functions
txStandaloneStylesheetCompiler.h File Reference
#include "txStylesheet.h"
#include "txURIUtils.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

nsresult TX_CompileStylesheetPath (const txParsedURL &aURL, txStylesheet **aResult)
 API to load XML files into compiled stylesheets.

Function Documentation

nsresult TX_CompileStylesheetPath ( const txParsedURL &  aURL,
txStylesheet **  aResult 
)

API to load XML files into compiled stylesheets.

Parsing is done by expat. Parse a stylesheet from the aPath.

Definition at line 79 of file txStandaloneStylesheetCompiler.cpp.

{
    *aResult = nsnull;
    nsAutoString errMsg, filePath;

    aURL.getFile(filePath);
    PR_LOG(txLog::xslt, PR_LOG_ALWAYS,
           ("TX_CompileStylesheetPath: %s\n",
            NS_LossyConvertUCS2toASCII(filePath).get()));
    istream* xslInput = URIUtils::getInputStream(filePath, errMsg);
    if (!xslInput) {
        return NS_ERROR_FAILURE;
    }
    nsRefPtr<txDriver> driver = new txDriver();
    if (!driver) {
        return NS_ERROR_OUT_OF_MEMORY;
    }
    nsAutoString spec = filePath;
    if (!aURL.mRef.IsEmpty()) {
        spec.Append(PRUnichar('#'));
        spec.Append(aURL.mRef);
    }
    driver->mCompiler =  new txStylesheetCompiler(spec, driver);
    if (!driver->mCompiler) {
        return NS_ERROR_OUT_OF_MEMORY;
    }
    nsresult rv = driver->parse(*xslInput, filePath);
    if (NS_FAILED(rv)) {
        return rv;
    };
    *aResult = driver->mCompiler->getStylesheet();
    NS_ADDREF(*aResult);
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function: