morten 01/06/08 08:28:17
Modified: java/src/org/apache/xalan/xsltc/compiler LiteralElement.java
SyntaxTreeNode.java XslAttribute.java
XslElement.java
Log:
The change from using DOM to using SAX in the stylesheet input caused some
of the elements in the Abstract Syntax Tree (AST) to be out of order. I
added a few lines of code to the xsl:element/attribute handling code to
fix this.
Submitted by: [EMAIL PROTECTED]
Reviewed by: [EMAIL PROTECTED]
Revision Changes Path
1.6 +15 -5
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/LiteralElement.java
Index: LiteralElement.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/LiteralElement.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- LiteralElement.java 2001/06/06 10:45:09 1.5
+++ LiteralElement.java 2001/06/08 15:28:13 1.6
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: LiteralElement.java,v 1.5 2001/06/06 10:45:09 morten Exp $
+ * @(#)$Id: LiteralElement.java,v 1.6 2001/06/08 15:28:13 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -197,7 +197,17 @@
_attributeElements.add(attribute);
}
+ /**
+ *
+ */
+ public void addLocalAttribute(SyntaxTreeNode attribute) {
+ if (_attributeElements == null) {
+ _attributeElements = new Vector(2);
+ }
+ _attributeElements.insertElementAt(attribute,0);
+ }
+
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
// Type-check all attributes
if (_attributeElements != null) {
@@ -265,6 +275,10 @@
if (qname == parser.getUseAttributeSets()) {
addAttribute(new UseAttributeSets(val, parser));
}
+ // Ignore other attributes in XSL namespace
+ else if (qname.getNamespace().equals(XSLT_URI)) {
+
+ }
// Handle xsl:extension-element-prefixes
else if (qname == parser.getExtensionElementPrefixes()) {
stable.excludeNamespaces(val);
@@ -272,10 +286,6 @@
// Handle xsl:exclude-result-prefixes
else if (qname == parser.getExcludeResultPrefixes()) {
stable.excludeNamespaces(val);
- }
- // Ignore other attributes in XSL namespace
- else if (qname.getNamespace() == XSLT_URI) {
-
}
// Handle literal attributes (attributes not in XSL namespace)
else {
1.5 +6 -1
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/SyntaxTreeNode.java
Index: SyntaxTreeNode.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/SyntaxTreeNode.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SyntaxTreeNode.java 2001/06/07 15:16:02 1.4
+++ SyntaxTreeNode.java 2001/06/08 15:28:13 1.5
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: SyntaxTreeNode.java,v 1.4 2001/06/07 15:16:02 morten Exp $
+ * @(#)$Id: SyntaxTreeNode.java,v 1.5 2001/06/08 15:28:13 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -400,6 +400,11 @@
public final void addElement(SyntaxTreeNode element) {
_contents.addElement(element);
+ element.setParent(this);
+ }
+
+ public final void setFirstElement(SyntaxTreeNode element) {
+ _contents.insertElementAt(element,0);
element.setParent(this);
}
1.5 +11 -8
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/XslAttribute.java
Index: XslAttribute.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/XslAttribute.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XslAttribute.java 2001/06/06 10:45:45 1.4
+++ XslAttribute.java 2001/06/08 15:28:14 1.5
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: XslAttribute.java,v 1.4 2001/06/06 10:45:45 morten Exp $
+ * @(#)$Id: XslAttribute.java,v 1.5 2001/06/08 15:28:14 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -115,13 +115,12 @@
for (int i = 0; i < parent.elementCount(); i++) {
SyntaxTreeNode item = (SyntaxTreeNode)siblings.elementAt(i);
if (item == this) break;
- if (!(item instanceof XslAttribute) &&
- !(item instanceof UseAttributeSets) &&
- !(item instanceof LiteralAttribute)) {
- _ignore = true;
- reportWarning(this, parser, ErrorMsg.ATTROUTS_ERR, name);
- return;
- }
+ if (item instanceof XslAttribute) continue;
+ if (item instanceof UseAttributeSets) continue;
+ if (item instanceof LiteralAttribute) continue;
+ _ignore = true;
+ reportWarning(this, parser, ErrorMsg.ATTROUTS_ERR, name);
+ return;
}
// Get namespace from namespace attribute?
@@ -169,6 +168,9 @@
}
}
+ if (parent instanceof LiteralElement) {
+ ((LiteralElement)parent).addLocalAttribute(this);
+ }
_name = AttributeValue.create(this, name, parser);
parseChildren(parser);
@@ -194,6 +196,7 @@
final InstructionList il = methodGen.getInstructionList();
if (_ignore) return;
+ _ignore = true;
// Compile code that emits any needed namespace declaration
if (_namespace != null) {
1.7 +2 -2
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/XslElement.java
Index: XslElement.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/XslElement.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XslElement.java 2001/06/07 15:16:08 1.6
+++ XslElement.java 2001/06/08 15:28:14 1.7
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: XslElement.java,v 1.6 2001/06/07 15:16:08 morten Exp $
+ * @(#)$Id: XslElement.java,v 1.7 2001/06/08 15:28:14 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -155,7 +155,7 @@
// Handle the 'use-attribute-sets' attribute
final String useSets = getAttribute("use-attribute-sets");
if (useSets.length() > 0) {
- addElement(new UseAttributeSets(useSets, parser));
+ setFirstElement(new UseAttributeSets(useSets, parser));
}
parseChildren(parser);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]