| java.lang.Object com.caucho.xsl.Generator com.caucho.xsl.JavaGenerator
JavaGenerator | public class JavaGenerator extends Generator (Code) | | Generates code for a Java based stylesheet.
package work.xsl;
public class foo extends JavaStylesheet {
}
|
Inner Class :static class Macro | |
Method Summary | |
public int | addExpr(Expr expr) Adds an expression constant returning its index.
Parameters: expr - the expression to add. | public int | addExpr(String exprString) Adds an expression constant returning its index.
Parameters: exprString - the expression to add. | public int | addFormat(XslNumberFormat format) | public void | addMacro(String name, String functionName) | public int | addMatch(AbstractPattern pattern) Adds a match pattern, returning its index.
Parameters: pattern - the expression to add. | public void | addMode(String mode) | public int | addNamespace(NamespaceContext namespace) | public int | addSelect(AbstractPattern select) Adds a select pattern returning its index.
Parameters: select - the select pattern to add. | public int | addSelect(String selectString) Adds a select pattern, returning its index.
Parameters: selectString - the expression to add. | public int | addSort(Sort[] sort) | public int | addStylesheet(String filename) | public void | clearUnique() | public void | close() Close call when an error occurs. | protected StylesheetImpl | completeGenerate(ArrayList<XslNode> inits, ArrayList globals) | protected XslNode | createChild(XslNode parent, Node childNode) | protected XslNode | createChild(Node child) | int | createMatchPattern(String select, Element element) | int | createSelectPattern(AbstractPattern pattern) | public String | createTemplatePattern(String name, AbstractPattern match, String mode, double priority) | protected void | endDisableEscaping() | protected void | generateChild(Node child) | public int | generateId() | void | generateString(String string, int mode, Element elt) Produces code to generate an attribute value template. | String | generateStringVar(String string, Element elt) Produces code to generate an attribute value template. | public HashMap<String, String> | getAttributeSet(String name) Returns the named attribute set. | public ArrayList<XslAttribute> | getAttributeSetList(String name) Returns the named attribute set. | public int | getCallDepth() | public String | getCurrentPosition() | public String | getElement() | public String | getEnv() | public String | getMacroName(String name) | public String | getModeName(String mode) Returns the name of the applyNode method. | String | getName(String tag) | public AbstractPattern | getNodeListContext() | protected JavaWriter | getOut() | public int | getSelectDepth() | public int | getSelectLoopDepth() | public boolean | hasMacro(String name) | protected void | popCall() | public int | popCallDepth() | void | popEnv() | public void | popLoop() | public int | popSelectDepth() | public int | popSelectLoopDepth() | protected void | printApplyImports(String mode, int min, int max) | protected void | printApplyTemplates(AbstractPattern select, String mode, Sort[] sort) | protected void | printAssign(String name, Object value) | protected void | printAttribute(Element element, String name) | protected void | printAttribute(Element element, String name, String namespace) | protected void | printCacheDepends(String name) | protected void | printCallTemplate(String name, String mode) | protected void | printChoose(Element element, Expr expr, boolean first) | protected void | printComment(Element element) | protected void | printCopy(Element element) | protected void | printCopyOf(String select, Element elt) | protected void | printDeclaration(Element element) | protected void | printElement(Node node) | protected void | printElement(Element element, String name) | protected void | printElement(Element element, String name, String namespace) | protected void | printError(String msg) | void | printExprTest(Expr expr, String element) | public void | printExprTest(int exprId, String element) | protected void | printExpression(Element element) Prints code to implement the xtp:expression tag, i.e. | protected void | printForEach(Element element, String select) | protected void | printForEach(Element element, String select, Sort[] sort) Prints code for xsl:for-each when the for-each has any xsl:sort. | protected void | printHeader() Prints the generated header. | protected void | printIf(Element element, Expr test) | protected void | printInit() | protected void | printInitVars(ArrayList<XslNode> inits) Generate code executed for all transformations. | public void | printLocation(String systemId, String filename, int line) Prints a command to set the current file and line into the
generated document. | protected void | printMessage(Element msg) | public void | printNamespace(NamespaceContext namespace) | void | printNumber(Expr expr, XslNumberFormat format) | void | printNumber(String level, AbstractPattern countPattern, AbstractPattern fromPattern, XslNumberFormat format) | protected void | printOtherwise(Element element, boolean first) | protected void | printParam(String name, String value, Element elt) Prints the value for a parameter. | protected void | printParam(String name, Object value) | protected void | printParamVariable(String name, Expr value) Prints code to add the value of an expression as a parameter. | protected void | printParamVariable(String name, Element value) | void | printPattern(AbstractPattern pattern) | protected void | printPi(Element element) | protected void | printPopScope(int count) | protected void | printResultDocument(Element element, String href, String format) | protected void | printScriptlet(Element element) | protected void | printSelectValue(String select, Element elt) | protected void | printString(String str) Prints the contents of a string, taking care of escapes. | protected void | printTemplate(Element absNode, String name, String pattern, String mode, double priority) | protected void | printVariable(String name, Object value) | protected void | printWhile(Element element, Expr test) | protected void | pushCall() | public int | pushCallDepth() | void | pushEnv() | public void | pushLoop() | public int | pushSelectDepth() | public int | pushSelectLoopDepth() | public void | setCurrentPosition(String pos) | public void | setNodeListContext(AbstractPattern context) | public void | setSelectDepth(int depth) | public void | setSelectLoopDepth(int depth) | protected void | startDisableEscaping() | public String | toJavaIdentifier(String name) | protected void | writeText(String text) Creates Java code to print plain text. |
_envDepth | IntArray _envDepth(Code) | | |
_exprMap | IntMap _exprMap(Code) | | |
_matchMap | IntMap _matchMap(Code) | | |
_selectMap | IntMap _selectMap(Code) | | |
_stringMap | IntMap _stringMap(Code) | | |
_templateCount | int _templateCount(Code) | | |
JavaGenerator | JavaGenerator(AbstractStylesheetFactory xslGenerator, String className, String encoding) throws IOException(Code) | | Creates a new XSL generator for Java.
Parameters: xslGenerator - the owning factory. Parameters: className - the name of the generated class Parameters: encoding - the generated output encoding. |
addExpr | public int addExpr(Expr expr) throws XslParseException(Code) | | Adds an expression constant returning its index.
Parameters: expr - the expression to add. the index into the runtime expression array |
addExpr | public int addExpr(String exprString) throws XslParseException(Code) | | Adds an expression constant returning its index.
Parameters: exprString - the expression to add. the index into the runtime expression array |
addMatch | public int addMatch(AbstractPattern pattern) throws XslParseException(Code) | | Adds a match pattern, returning its index.
Parameters: pattern - the expression to add. the index into the runtime expression array |
addSelect | public int addSelect(String selectString) throws IOException, XslParseException(Code) | | Adds a select pattern, returning its index.
Parameters: selectString - the expression to add. the index into the runtime select pattern array |
addStylesheet | public int addStylesheet(String filename)(Code) | | |
clearUnique | public void clearUnique()(Code) | | |
createTemplatePattern | public String createTemplatePattern(String name, AbstractPattern match, String mode, double priority) throws Exception(Code) | | Generates the pattern for a matching pattern
Parameters: name - the mangled name of the function Parameters: match - the XPath match pattern Parameters: mode - the template mode Parameters: priority - the template priority Parameters: node - the source XML node from the XSL file the name of the function |
generateId | public int generateId()(Code) | | |
generateString | void generateString(String string, int mode, Element elt) throws Exception(Code) | | Produces code to generate an attribute value template. The same
code is used to produce a string ('a{b}c' -> "a" + b + "c") or a series of
print statements (',').
Parameters: string - the source template Parameters: mode - separator: either '+' or ',' Parameters: elt - the containing element. Needed for namespaces. |
generateStringVar | String generateStringVar(String string, Element elt) throws Exception(Code) | | Produces code to generate an attribute value template. The same
code is used to produce a string ('a{b}c' -> "a" + b + "c") or a series of
print statements (',').
Parameters: string - the source template Parameters: elt - the containing element. Needed for namespaces. the variable storing the generated string. |
getCallDepth | public int getCallDepth()(Code) | | |
getModeName | public String getModeName(String mode)(Code) | | Returns the name of the applyNode method.
Parameters: mode - the template's mode. |
getSelectDepth | public int getSelectDepth()(Code) | | |
getSelectLoopDepth | public int getSelectLoopDepth()(Code) | | |
popCallDepth | public int popCallDepth()(Code) | | |
popLoop | public void popLoop()(Code) | | |
popSelectDepth | public int popSelectDepth()(Code) | | |
popSelectLoopDepth | public int popSelectLoopDepth()(Code) | | |
printApplyImports | protected void printApplyImports(String mode, int min, int max) throws Exception(Code) | | Prints code to implement xsl:apply-imports
Parameters: mode - the mode of the imported files Parameters: min - the min importance Parameters: max - the max importance |
printApplyTemplates | protected void printApplyTemplates(AbstractPattern select, String mode, Sort[] sort) throws Exception(Code) | | Prints code for xsl:apply-templates
Parameters: select - the select pattern Parameters: mode - the template mode Parameters: sort - the sort expressions |
printExpression | protected void printExpression(Element element) throws Exception(Code) | | Prints code to implement the xtp:expression tag, i.e. print
the value of the Java expression.
|
printForEach | protected void printForEach(Element element, String select, Sort[] sort) throws Exception(Code) | | Prints code for xsl:for-each when the for-each has any xsl:sort.
|
printHeader | protected void printHeader() throws IOException(Code) | | Prints the generated header.
|
printInitVars | protected void printInitVars(ArrayList<XslNode> inits) throws Exception(Code) | | Generate code executed for all transformations.
- Add the stylesheet namespaces to the generated document.
- Assign the global variables.
- Initialize the cache dependencies.
|
printLocation | public void printLocation(String systemId, String filename, int line) throws Exception(Code) | | Prints a command to set the current file and line into the
generated document.
Parameters: filename - the source filename Parameters: line - the source line number. |
printParamVariable | protected void printParamVariable(String name, Expr value) throws Exception(Code) | | Prints code to add the value of an expression as a parameter.
|
printPopScope | protected void printPopScope(int count) throws Exception(Code) | | |
printString | protected void printString(String str) throws IOException(Code) | | Prints the contents of a string, taking care of escapes.
|
printTemplate | protected void printTemplate(Element absNode, String name, String pattern, String mode, double priority) throws Exception(Code) | | Generates code for a template
Parameters: absNode - the XSL node for the emplace Parameters: name - the template name Parameters: pattern - the pattern string Parameters: mode - the template's mode Parameters: priority - the template's priority |
pushCallDepth | public int pushCallDepth()(Code) | | |
pushLoop | public void pushLoop()(Code) | | |
pushSelectDepth | public int pushSelectDepth()(Code) | | |
pushSelectLoopDepth | public int pushSelectLoopDepth()(Code) | | |
setCurrentPosition | public void setCurrentPosition(String pos)(Code) | | |
setSelectDepth | public void setSelectDepth(int depth)(Code) | | |
setSelectLoopDepth | public void setSelectLoopDepth(int depth)(Code) | | |
toJavaIdentifier | public String toJavaIdentifier(String name)(Code) | | Converts a string to a Java identifier, encoding unknown characters
as "_"
|
writeText | protected void writeText(String text) throws Exception(Code) | | Creates Java code to print plain text.
|
Fields inherited from com.caucho.xsl.Generator | final protected static L10N L(Code)(Java Doc) final public static String XSLNS(Code)(Java Doc) final public static String XTPNS(Code)(Java Doc) HashMap<String, XslAttributeSet> _attributeSets(Code)(Java Doc) Path _baseURL(Code)(Java Doc) protected ArrayList<String> _cacheDepends(Code)(Java Doc) Path _context(Code)(Java Doc) boolean _defaultCacheable(Code)(Java Doc) protected ArrayList<Path> _depends(Code)(Java Doc) protected int _destLine(Code)(Java Doc) protected Document _doc(Code)(Java Doc) protected String _encoding(Code)(Java Doc) protected String _errorPage(Code)(Java Doc) protected HashMap<String, String> _excludedNamespaces(Code)(Java Doc) String _filename(Code)(Java Doc) HashMap<String, Document> _files(Code)(Java Doc) protected FormatNumberFun _formatNumberFun(Code)(Java Doc) protected ArrayList _globalActions(Code)(Java Doc) protected ArrayList<String> _globalParameters(Code)(Java Doc) boolean _hasSession(Code)(Java Doc) int _importance(Code)(Java Doc) protected ArrayList<String> _imports(Code)(Java Doc) boolean _isCacheable(Code)(Java Doc) protected boolean _isRawText(Code)(Java Doc) protected boolean _isSpecial(Code)(Java Doc) protected boolean _isStyleScript(Code)(Java Doc) protected KeyFun _keyFun(Code)(Java Doc) int _line(Code)(Java Doc) boolean _lineContent(Code)(Java Doc) protected LineMap _lineMap(Code)(Java Doc) int _lineWs(Code)(Java Doc) int _loopDepth(Code)(Java Doc) HashMap<String, String> _macros(Code)(Java Doc) int _minImportance(Code)(Java Doc) HashMap<String, String> _names(Code)(Java Doc) protected NamespaceContext _namespace(Code)(Java Doc) protected HashMap<String, String[]> _namespaceAliases(Code)(Java Doc) protected AbstractPattern _nodeListContext(Code)(Java Doc) HashMap<String, String> _outputAttributes(Code)(Java Doc) protected Path _path(Code)(Java Doc) protected HashMap<String, String> _preserve(Code)(Java Doc) protected CauchoDocument _qDoc(Code)(Java Doc) protected HashMap<String, String> _strip(Code)(Java Doc) String _systemId(Code)(Java Doc) int _templateCount(Code)(Java Doc) HashMap<String, ArrayList<Template>> _templates(Code)(Java Doc) CharBuffer _text(Code)(Java Doc) Path _topContext(Code)(Java Doc) int _uniqueId(Code)(Java Doc) Path _workPath(Code)(Java Doc) protected AbstractStylesheetFactory _xslGenerator(Code)(Java Doc) String _xslName(Code)(Java Doc)
|
Methods inherited from com.caucho.xsl.Generator | public void addAttributeSet(String name, XslAttributeSet attributeSet)(Code)(Java Doc) void addDepend(Path depend)(Code)(Java Doc) public void addExcludedNamespace(String ns)(Code)(Java Doc) public void addGlobalParameter(String param)(Code)(Java Doc) public void addImport(String pkg)(Code)(Java Doc) public void addImportList(String value) throws XslParseException(Code)(Java Doc) public void addInit(XslNode node)(Code)(Java Doc) public void addKey(String name, AbstractPattern match, Expr use)(Code)(Java Doc) public void addLocale(String name, DecimalFormatSymbols format)(Code)(Java Doc) protected NamespaceContext addNamespace(Element elt)(Code)(Java Doc) public void addNamespaceAlias(String stylesheetPrefix, String resultPrefix)(Code)(Java Doc) public void addNamespaceAlias(String namespace, String[] result)(Code)(Java Doc) Template addPattern(AbstractPattern pattern, String mode, double priority, String function, int funId)(Code)(Java Doc) public void addPreserveSpace(String elements)(Code)(Java Doc) public void addStripSpace(String elements)(Code)(Java Doc) public void close() throws IOException, XslParseException(Code)(Java Doc) abstract protected StylesheetImpl completeGenerate(ArrayList<XslNode> inits, ArrayList globals) throws Exception(Code)(Java Doc) abstract protected XslNode createChild(Node child) throws Exception(Code)(Java Doc) abstract protected XslNode createChild(XslNode parent, Node child) throws Exception(Code)(Java Doc) abstract protected void endDisableEscaping() throws Exception(Code)(Java Doc) XslParseException error(Exception e)(Code)(Java Doc) XslParseException error(Node node, Exception e)(Code)(Java Doc) XslParseException error(String message)(Code)(Java Doc) XslParseException error(Node node, String message)(Code)(Java Doc) public StylesheetImpl generate(Node node) throws Exception(Code)(Java Doc) void generateAttribute(Element element) throws Exception(Code)(Java Doc) protected void generateChild(Node child) throws Exception(Code)(Java Doc) public void generateChild(Node child, int code) throws Exception(Code)(Java Doc) public void generateChildImpl(Node child) throws Exception(Code)(Java Doc) protected void generateChildren(Node node) throws Exception(Code)(Java Doc) void generateChoose(Element element) throws Exception(Code)(Java Doc) void generateElement(Element element) throws Exception(Code)(Java Doc) void generateForEach(Element element) throws Exception(Code)(Java Doc) void generateIf(Element element) throws Exception(Code)(Java Doc) public XslNode generateImport(String href) throws Exception(Code)(Java Doc) void generateInclude(Element element) throws Exception(Code)(Java Doc) public void generateInclude(XslNode parent, String href) throws Exception(Code)(Java Doc) void generateKey(Element element) throws Exception(Code)(Java Doc) void generateLocale(Element element) throws Exception(Code)(Java Doc) void generateNamespaceAlias(Element element) throws Exception(Code)(Java Doc) void generateNumber(Element element) throws Exception(Code)(Java Doc) void generateTemplate(Element element) throws Exception(Code)(Java Doc) void generateWhile(Element element) throws Exception(Code)(Java Doc) void generateXslText(Element element) throws Exception(Code)(Java Doc) public boolean getDisableOutputEscaping()(Code)(Java Doc) public int getImportance()(Code)(Java Doc) public int getMaxImportance()(Code)(Java Doc) public int getMinImportance()(Code)(Java Doc) public NamespaceContext getNamespace()(Code)(Java Doc) public String[] getNamespaceAlias(String namespace)(Code)(Java Doc) public AbstractPattern getNodeListContext()(Code)(Java Doc) abstract protected JavaWriter getOut()(Code)(Java Doc) int getTextLength()(Code)(Java Doc) protected String getXslLocal(Node node)(Code)(Java Doc) protected String getXtpLocal(Node node)(Code)(Java Doc) public void incrementImportance()(Code)(Java Doc) void init(String filename)(Code)(Java Doc) public Expr parseExpr(String pattern) throws XslParseException(Code)(Java Doc) public AbstractPattern parseMatch(String pattern) throws XslParseException, IOException(Code)(Java Doc) public AbstractPattern parseSelect(String pattern) throws IOException, XslParseException(Code)(Java Doc) protected AbstractPattern parseSelect(String pattern, Node node) throws IOException, XslParseException(Code)(Java Doc) abstract protected void popCall() throws Exception(Code)(Java Doc) abstract protected void printApplyImports(String mode, int min, int max) throws Exception(Code)(Java Doc) abstract protected void printApplyTemplates(AbstractPattern select, String mode, Sort[] sort) throws Exception(Code)(Java Doc) protected void printAssign(String name, Object value) throws Exception(Code)(Java Doc) protected void printAttribute(Element node, String name) throws Exception(Code)(Java Doc) protected void printAttribute(Element node, String name, String namespace) throws Exception(Code)(Java Doc) protected void printCacheDepends(String path) throws Exception(Code)(Java Doc) abstract protected void printCallTemplate(String name, String mode) throws Exception(Code)(Java Doc) protected void printChoose(Element element, Expr expr, boolean first) throws Exception(Code)(Java Doc) protected void printComment(Element node) throws Exception(Code)(Java Doc) protected void printCopy(Element element) throws Exception(Code)(Java Doc) protected void printCopyElement(Element element) throws Exception(Code)(Java Doc) abstract protected void printCopyOf(String select, Element element) throws Exception(Code)(Java Doc) protected void printDeclaration(Element node) throws Exception(Code)(Java Doc) abstract protected void printElement(Node node) throws Exception(Code)(Java Doc) protected void printElement(Element element, String name) throws Exception(Code)(Java Doc) protected void printElement(Element element, String name, String namespace) throws Exception(Code)(Java Doc) protected void printError(String msg) throws Exception(Code)(Java Doc) protected void printExpression(Element node) throws Exception(Code)(Java Doc) abstract protected void printForEach(Element element, String select) throws Exception(Code)(Java Doc) abstract protected void printForEach(Element element, String select, Sort[] sort) throws Exception(Code)(Java Doc) protected void printHeader() throws XslParseException, IOException(Code)(Java Doc) protected void printIf(Element element, Expr expr) throws Exception(Code)(Java Doc) void printLocation(Node node) throws Exception(Code)(Java Doc) abstract protected void printLocation(String systemId, String filename, int line) throws Exception(Code)(Java Doc) protected void printMessage(Element node) throws Exception(Code)(Java Doc) void printNumber(Expr expr, XslNumberFormat format) throws Exception(Code)(Java Doc) void printNumber(String level, AbstractPattern countPattern, AbstractPattern fromPattern, XslNumberFormat format) throws Exception(Code)(Java Doc) protected void printOtherwise(Element element, boolean first) throws Exception(Code)(Java Doc) abstract protected void printParam(String name, Object value) throws Exception(Code)(Java Doc) abstract protected void printParam(String name, String value, Element elt) throws Exception(Code)(Java Doc) abstract protected void printParamVariable(String name, Expr expr) throws Exception(Code)(Java Doc) abstract protected void printParamVariable(String name, Element elt) throws Exception(Code)(Java Doc) protected void printPi(Element node) throws Exception(Code)(Java Doc) abstract protected void printPopScope(int count) throws Exception(Code)(Java Doc) protected void printResultDocument(Element element, String href, String format) throws Exception(Code)(Java Doc) protected void printScriptlet(Element node) throws Exception(Code)(Java Doc) abstract protected void printSelectValue(String select, Element element) throws Exception(Code)(Java Doc) abstract protected void printTemplate(Element node, String name, String pattern, String mode, double priority) throws Exception(Code)(Java Doc) abstract protected void printVariable(String name, Object value) throws Exception(Code)(Java Doc) protected void printWhile(Element element, Expr expr) throws Exception(Code)(Java Doc) abstract protected void pushCall() throws Exception(Code)(Java Doc) Document readXsl(Path path) throws IOException, XslParseException(Code)(Java Doc) Document readXsl(ReadStream file) throws IOException, XslParseException(Code)(Java Doc) public void setContentType(String type)(Code)(Java Doc) public void setDisableOutputEscaping(boolean disable)(Code)(Java Doc) public void setErrorPage(String errorPage)(Code)(Java Doc) void setLocation(Node node) throws Exception(Code)(Java Doc) public void setLocation(String systemId, String filename, int line) throws XslParseException, IOException(Code)(Java Doc) public void setMinImportance(int importance)(Code)(Java Doc) public void setOutputAttribute(String name, String value)(Code)(Java Doc) void setPath(Path path)(Code)(Java Doc) public void setStyleScript(boolean stylescript)(Code)(Java Doc) void setWorkPath(Path path)(Code)(Java Doc) abstract protected void startDisableEscaping() throws Exception(Code)(Java Doc) public int uniqueId()(Code)(Java Doc) abstract protected void writeText(String text) throws Exception(Code)(Java Doc)
|
|
|