fix attribute processing bug, but introduce questionable namespace processing
authorcrawshaw <crawshaw@ibex.org>
Wed, 24 Nov 2004 20:33:58 +0000 (20:33 +0000)
committercrawshaw <crawshaw@ibex.org>
Wed, 24 Nov 2004 20:33:58 +0000 (20:33 +0000)
darcs-hash:20041124203358-2eb37-0da0c2f7c8568dd11af52d6a83bd37177e1946b9.gz

src/java/org/ibex/xt/JSElement.java
src/java/org/ibex/xt/Template.java

index 1f07af2..cfa1a1f 100644 (file)
@@ -35,8 +35,10 @@ public class JSElement extends JSScope implements XML.Element {
     protected void loadAttr() {
         try {
             XML.Attributes a = getAttributes();
+            // FIXME: questionable abuse of XML namespaces here
+            boolean xturi = "http://xt.ibex.org/".equals(getUri());
             for(int i=0; i < a.attrSize(); i++) {
-                if (!"http://xt.ibex.org/".equals(a.getUri(i))) continue;
+                if (!xturi && !"http://xt.ibex.org/".equals(a.getUri(i))) continue;
                 declare(a.getKey(i));
                 put(a.getKey(i), eval(a.getVal(i)));
             }
index c9b8611..445a6ee 100644 (file)
@@ -59,8 +59,10 @@ public class Template extends JSElement {
 
         XML.Attributes a = e.getAttributes();
         for (int i=0; i < a.attrSize(); i++) {
-            if ("if".equals(a.getKey(i)) &&
-                "http://xt.ibex.org/".equals(a.getUri(i))) {
+            // FIXME: questionable abuse of XML namespaces here
+            if ("if".equals(a.getKey(i)) && (
+                "http://xt.ibex.org/".equals(e.getUri()) ||
+                "http://xt.ibex.org/".equals(a.getUri(i)))) {
                 e = new Template.IfWrap(e);
             }
         }
@@ -99,7 +101,7 @@ public class Template extends JSElement {
 
             try {
                 Object varIf = get("if"); if (varIf != null) undeclare("if");
-                if (varIf != null && !Boolean.getBoolean((String)varIf)) return;
+                if (varIf != null && !"true".equals(varIf)) return;
             } catch (JSExn e) { throw new RuntimeException(e); }
 
             wrapped.out(w);