diff options
author | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-03-10 21:46:48 +0000 |
---|---|---|
committer | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-03-10 21:46:48 +0000 |
commit | ce57ab760f69de6db452def7ffbf5b114a2d8694 (patch) | |
tree | ea38c56431c5d4528fb54254c3f8e50f517bede3 /libjava/classpath/gnu/xml/transform | |
parent | 50996fe55769882de3f410896032c887f0ff0d04 (diff) | |
download | ppe42-gcc-ce57ab760f69de6db452def7ffbf5b114a2d8694.tar.gz ppe42-gcc-ce57ab760f69de6db452def7ffbf5b114a2d8694.zip |
Imported GNU Classpath 0.90
* scripts/makemake.tcl: Set gnu/java/awt/peer/swing to ignore.
* gnu/classpath/jdwp/VMFrame.java (SIZE): New constant.
* java/lang/VMCompiler.java: Use gnu.java.security.hash.MD5.
* java/lang/Math.java: New override file.
* java/lang/Character.java: Merged from Classpath.
(start, end): Now 'int's.
(canonicalName): New field.
(CANONICAL_NAME, NO_SPACES_NAME, CONSTANT_NAME): New constants.
(UnicodeBlock): Added argument.
(of): New overload.
(forName): New method.
Updated unicode blocks.
(sets): Updated.
* sources.am: Regenerated.
* Makefile.in: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111942 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/gnu/xml/transform')
25 files changed, 390 insertions, 529 deletions
diff --git a/libjava/classpath/gnu/xml/transform/AbstractNumberNode.java b/libjava/classpath/gnu/xml/transform/AbstractNumberNode.java index 91029d6d070..6d1202e69b4 100644 --- a/libjava/classpath/gnu/xml/transform/AbstractNumberNode.java +++ b/libjava/classpath/gnu/xml/transform/AbstractNumberNode.java @@ -317,7 +317,7 @@ abstract class AbstractNumberNode public String toString() { - StringBuffer buf = new StringBuffer(getClass().getName()); + StringBuffer buf = new StringBuffer("number"); buf.append('['); buf.append("format="); buf.append(format); diff --git a/libjava/classpath/gnu/xml/transform/ApplyImportsNode.java b/libjava/classpath/gnu/xml/transform/ApplyImportsNode.java index 60dec85d378..4b06eea1041 100644 --- a/libjava/classpath/gnu/xml/transform/ApplyImportsNode.java +++ b/libjava/classpath/gnu/xml/transform/ApplyImportsNode.java @@ -1,5 +1,5 @@ /* ApplyImportsNode.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004,2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -54,13 +54,9 @@ final class ApplyImportsNode { TemplateNode ret = new ApplyImportsNode(); if (children != null) - { - ret.children = children.clone(stylesheet); - } + ret.children = children.clone(stylesheet); if (next != null) - { - ret.next = next.clone(stylesheet); - } + ret.next = next.clone(stylesheet); return ret; } @@ -71,15 +67,16 @@ final class ApplyImportsNode { TemplateNode t = stylesheet.getTemplate(mode, context, true); if (t != null) - { - t.apply(stylesheet, mode, context, pos, len, - parent, nextSibling); - } + t.apply(stylesheet, mode, context, pos, len, + parent, nextSibling); if (next != null) - { - next.apply(stylesheet, mode, context, pos, len, - parent, nextSibling); - } + next.apply(stylesheet, mode, context, pos, len, + parent, nextSibling); + } + + public String toString() + { + return "apply-imports"; } } diff --git a/libjava/classpath/gnu/xml/transform/ApplyTemplatesNode.java b/libjava/classpath/gnu/xml/transform/ApplyTemplatesNode.java index ab26058bcb4..38b605a07ed 100644 --- a/libjava/classpath/gnu/xml/transform/ApplyTemplatesNode.java +++ b/libjava/classpath/gnu/xml/transform/ApplyTemplatesNode.java @@ -1,5 +1,5 @@ /* ApplyTemplatesNode.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004,2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -76,29 +76,21 @@ final class ApplyTemplatesNode TemplateNode clone(Stylesheet stylesheet) { - int len = sortKeys.size(); + int len = sortKeys != null ? sortKeys.size() : 0; List sortKeys2 = new ArrayList(len); for (int i = 0; i < len; i++) - { - sortKeys2.add(((Key) sortKeys.get(i)).clone(stylesheet)); - } + sortKeys2.add(((Key) sortKeys.get(i)).clone(stylesheet)); len = withParams.size(); List withParams2 = new ArrayList(len); for (int i = 0; i < len; i++) - { - withParams2.add(((WithParam) withParams.get(i)).clone(stylesheet)); - } + withParams2.add(((WithParam) withParams.get(i)).clone(stylesheet)); TemplateNode ret = new ApplyTemplatesNode(select.clone(stylesheet), mode, sortKeys2, withParams2, isDefault); if (children != null) - { - ret.children = children.clone(stylesheet); - } + ret.children = children.clone(stylesheet); if (next != null) - { - ret.next = next.clone(stylesheet); - } + ret.next = next.clone(stylesheet); return ret; } @@ -147,9 +139,7 @@ final class ApplyTemplatesNode Collections.sort(nodes, new XSLComparator(sortKeys)); } else - { - Collections.sort(nodes, documentOrderComparator); - } + Collections.sort(nodes, documentOrderComparator); int l = nodes.size(); QName effectiveMode = isDefault ? mode : this.mode; for (int i = 0; i < l; i++) @@ -172,27 +162,21 @@ final class ApplyTemplatesNode } // apply-templates doesn't have processable children if (next != null) - { - next.apply(stylesheet, mode, - context, pos, len, - parent, nextSibling); - } + next.apply(stylesheet, mode, + context, pos, len, + parent, nextSibling); } public boolean references(QName var) { if (select != null && select.references(var)) - { - return true; - } + return true; if (withParams != null) { for (Iterator i = withParams.iterator(); i.hasNext(); ) { if (((WithParam) i.next()).references(var)) - { - return true; - } + return true; } } if (sortKeys != null) @@ -200,9 +184,7 @@ final class ApplyTemplatesNode for (Iterator i = sortKeys.iterator(); i.hasNext(); ) { if (((SortKey) i.next()).references(var)) - { - return true; - } + return true; } } return super.references(var); @@ -210,7 +192,7 @@ final class ApplyTemplatesNode public String toString() { - StringBuffer buf = new StringBuffer(getClass().getName()); + StringBuffer buf = new StringBuffer("apply-templates"); buf.append('['); boolean o = false; if (select != null) diff --git a/libjava/classpath/gnu/xml/transform/AttributeNode.java b/libjava/classpath/gnu/xml/transform/AttributeNode.java index bc5bc30c9c1..71e2ed0f7af 100644 --- a/libjava/classpath/gnu/xml/transform/AttributeNode.java +++ b/libjava/classpath/gnu/xml/transform/AttributeNode.java @@ -231,7 +231,7 @@ final class AttributeNode public String toString() { - StringBuffer buf = new StringBuffer(getClass().getName()); + StringBuffer buf = new StringBuffer("attribute"); buf.append('['); buf.append("name="); buf.append(name); diff --git a/libjava/classpath/gnu/xml/transform/CallTemplateNode.java b/libjava/classpath/gnu/xml/transform/CallTemplateNode.java index b678219d780..31b26cbcdb0 100644 --- a/libjava/classpath/gnu/xml/transform/CallTemplateNode.java +++ b/libjava/classpath/gnu/xml/transform/CallTemplateNode.java @@ -1,5 +1,5 @@ /* CallTemplateNode.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004,2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -69,18 +69,12 @@ final class CallTemplateNode int len = withParams.size(); List withParams2 = new ArrayList(len); for (int i = 0; i < len; i++) - { - withParams2.add(((WithParam) withParams.get(i)).clone(stylesheet)); - } + withParams2.add(((WithParam) withParams.get(i)).clone(stylesheet)); TemplateNode ret = new CallTemplateNode(name, withParams2); if (children != null) - { - ret.children = children.clone(stylesheet); - } + ret.children = children.clone(stylesheet); if (next != null) - { - ret.next = next.clone(stylesheet); - } + ret.next = next.clone(stylesheet); return ret; } @@ -89,52 +83,52 @@ final class CallTemplateNode Node parent, Node nextSibling) throws TransformerException { - if (withParams != null) + TemplateNode t = stylesheet.getTemplate(mode, name); + if (t != null) { - // compute the parameter values - LinkedList values = new LinkedList(); - for (Iterator i = withParams.iterator(); i.hasNext(); ) + if (withParams != null) { - WithParam p = (WithParam) i.next(); - Object value = p.getValue(stylesheet, mode, context, pos, len); - Object[] pair = new Object[2]; - pair[0] = p.name; - pair[1] = value; - values.add(pair); - } - // push the parameter context - stylesheet.bindings.push(Bindings.WITH_PARAM); - // set the parameters - for (Iterator i = values.iterator(); i.hasNext(); ) - { - Object[] pair = (Object[]) i.next(); - QName name = (QName) pair[0]; - Object value = pair[1]; - stylesheet.bindings.set(name, value, Bindings.WITH_PARAM); - if (stylesheet.debug) + // compute the parameter values + LinkedList values = new LinkedList(); + for (Iterator i = withParams.iterator(); i.hasNext(); ) + { + WithParam p = (WithParam) i.next(); + if (t.hasParam(p.name)) // ignore parameters not specified + { + Object value = p.getValue(stylesheet, mode, context, + pos, len); + Object[] pair = new Object[2]; + pair[0] = p.name; + pair[1] = value; + values.add(pair); + } + } + // push the parameter context + stylesheet.bindings.push(Bindings.WITH_PARAM); + // set the parameters + for (Iterator i = values.iterator(); i.hasNext(); ) { - System.err.println("with-param: " + name + " = " + value); + Object[] pair = (Object[]) i.next(); + QName name = (QName) pair[0]; + Object value = pair[1]; + stylesheet.bindings.set(name, value, Bindings.WITH_PARAM); + if (stylesheet.debug) + System.err.println("with-param: " + name + " = " + value); } } - } - TemplateNode t = stylesheet.getTemplate(mode, name); - if (t != null) - { t.apply(stylesheet, mode, context, pos, len, parent, nextSibling); - } - if (withParams != null) - { - // pop the variable context - stylesheet.bindings.pop(Bindings.WITH_PARAM); + if (withParams != null) + { + // pop the variable context + stylesheet.bindings.pop(Bindings.WITH_PARAM); + } } // call-template doesn't have processable children if (next != null) - { next.apply(stylesheet, mode, context, pos, len, parent, nextSibling); - } } public boolean references(QName var) @@ -144,9 +138,7 @@ final class CallTemplateNode for (Iterator i = withParams.iterator(); i.hasNext(); ) { if (((WithParam) i.next()).references(var)) - { - return true; - } + return true; } } return super.references(var); @@ -154,7 +146,7 @@ final class CallTemplateNode public String toString() { - StringBuffer buf = new StringBuffer(getClass().getName()); + StringBuffer buf = new StringBuffer("call-template"); buf.append('['); buf.append("name="); buf.append(name); diff --git a/libjava/classpath/gnu/xml/transform/ChooseNode.java b/libjava/classpath/gnu/xml/transform/ChooseNode.java index fb1f2c45e75..cf07fa54b07 100644 --- a/libjava/classpath/gnu/xml/transform/ChooseNode.java +++ b/libjava/classpath/gnu/xml/transform/ChooseNode.java @@ -1,5 +1,5 @@ /* ChooseNode.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004,2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -54,13 +54,9 @@ final class ChooseNode { TemplateNode ret = new ChooseNode(); if (children != null) - { - ret.children = children.clone(stylesheet); - } + ret.children = children.clone(stylesheet); if (next != null) - { - ret.next = next.clone(stylesheet); - } + ret.next = next.clone(stylesheet); return ret; } @@ -70,22 +66,18 @@ final class ChooseNode throws TransformerException { if (children != null) - { - children.apply(stylesheet, mode, - context, pos, len, - parent, nextSibling); - } + children.apply(stylesheet, mode, + context, pos, len, + parent, nextSibling); if (next != null) - { - next.apply(stylesheet, mode, - context, pos, len, - parent, nextSibling); - } + next.apply(stylesheet, mode, + context, pos, len, + parent, nextSibling); } public String toString() { - StringBuffer buf = new StringBuffer(getClass().getName()); + StringBuffer buf = new StringBuffer("choose"); buf.append('['); buf.append(']'); return buf.toString(); diff --git a/libjava/classpath/gnu/xml/transform/CommentNode.java b/libjava/classpath/gnu/xml/transform/CommentNode.java index 1428a46fca1..8131fb28650 100644 --- a/libjava/classpath/gnu/xml/transform/CommentNode.java +++ b/libjava/classpath/gnu/xml/transform/CommentNode.java @@ -1,5 +1,5 @@ /* CommentNode.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004,2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -58,13 +58,9 @@ final class CommentNode { TemplateNode ret = new CommentNode(); if (children != null) - { - ret.children = children.clone(stylesheet); - } + ret.children = children.clone(stylesheet); if (next != null) - { - ret.next = next.clone(stylesheet); - } + ret.next = next.clone(stylesheet); return ret; } @@ -90,27 +86,18 @@ final class CommentNode Comment comment = doc.createComment(value); // Insert into result tree if (nextSibling != null) - { - parent.insertBefore(comment, nextSibling); - } + parent.insertBefore(comment, nextSibling); else - { - parent.appendChild(comment); - } + parent.appendChild(comment); if (next != null) - { - next.apply(stylesheet, mode, - context, pos, len, - parent, nextSibling); - } + next.apply(stylesheet, mode, + context, pos, len, + parent, nextSibling); } public String toString() { - StringBuffer buf = new StringBuffer(getClass().getName()); - buf.append('['); - buf.append(']'); - return buf.toString(); + return "comment"; } } diff --git a/libjava/classpath/gnu/xml/transform/CopyNode.java b/libjava/classpath/gnu/xml/transform/CopyNode.java index 3e019445aaa..64cfa519158 100644 --- a/libjava/classpath/gnu/xml/transform/CopyNode.java +++ b/libjava/classpath/gnu/xml/transform/CopyNode.java @@ -1,5 +1,5 @@ /* CopyNode.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004,2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -65,13 +65,9 @@ final class CopyNode { TemplateNode ret = new CopyNode(uas); if (children != null) - { - ret.children = children.clone(stylesheet); - } + ret.children = children.clone(stylesheet); if (next != null) - { - ret.next = next.clone(stylesheet); - } + ret.next = next.clone(stylesheet); return ret; } @@ -102,44 +98,32 @@ final class CopyNode { NamedNodeMap attrs = parent.getAttributes(); if (attrs != null) - { - attrs.setNamedItemNS(copy); - } + attrs.setNamedItemNS(copy); } } else { if (nextSibling != null) - { - parent.insertBefore(copy, nextSibling); - } + parent.insertBefore(copy, nextSibling); else - { - parent.appendChild(copy); - } + parent.appendChild(copy); } } if (uas != null) { StringTokenizer st = new StringTokenizer(uas, " "); while (st.hasMoreTokens()) - { - addAttributeSet(stylesheet, mode, context, pos, len, - copy, null, st.nextToken()); - } + addAttributeSet(stylesheet, mode, context, pos, len, + copy, null, st.nextToken()); } if (children != null) - { - children.apply(stylesheet, mode, - context, pos, len, - copy, null); - } + children.apply(stylesheet, mode, + context, pos, len, + copy, null); if (next != null) - { - next.apply(stylesheet, mode, - context, pos, len, - parent, nextSibling); - } + next.apply(stylesheet, mode, + context, pos, len, + parent, nextSibling); } void addAttributeSet(Stylesheet stylesheet, QName mode, @@ -151,32 +135,31 @@ final class CopyNode { AttributeSet as = (AttributeSet) i.next(); if (!as.name.equals(attributeSet)) - { - continue; - } + continue; if (as.uas != null) { StringTokenizer st = new StringTokenizer(as.uas, " "); while (st.hasMoreTokens()) - { - addAttributeSet(stylesheet, mode, context, pos, len, - parent, nextSibling, st.nextToken()); - } + addAttributeSet(stylesheet, mode, context, pos, len, + parent, nextSibling, st.nextToken()); } if (as.children != null) - { - as.children.apply(stylesheet, mode, - context, pos, len, - parent, nextSibling); - } + as.children.apply(stylesheet, mode, + context, pos, len, + parent, nextSibling); } } public String toString() { - StringBuffer buf = new StringBuffer(getClass().getName()); - buf.append('['); - buf.append(']'); + StringBuffer buf = new StringBuffer("copy"); + if (uas != null) + { + buf.append('['); + buf.append("uas="); + buf.append(uas); + buf.append(']'); + } return buf.toString(); } diff --git a/libjava/classpath/gnu/xml/transform/CopyOfNode.java b/libjava/classpath/gnu/xml/transform/CopyOfNode.java index a43e3ba841e..ed4358c90b6 100644 --- a/libjava/classpath/gnu/xml/transform/CopyOfNode.java +++ b/libjava/classpath/gnu/xml/transform/CopyOfNode.java @@ -1,5 +1,5 @@ /* CopyOfNode.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004,2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -70,13 +70,9 @@ final class CopyOfNode { TemplateNode ret = new CopyOfNode(select.clone(stylesheet)); if (children != null) - { - ret.children = children.clone(stylesheet); - } + ret.children = children.clone(stylesheet); if (next != null) - { - ret.next = next.clone(stylesheet); - } + ret.next = next.clone(stylesheet); return ret; } @@ -102,9 +98,7 @@ final class CopyOfNode // Use document element src = ((Document) src).getDocumentElement(); if (src == null) - { - continue; - } + continue; nodeType = Node.ELEMENT_NODE; } else if (nodeType == Node.ATTRIBUTE_NODE) @@ -128,20 +122,14 @@ final class CopyOfNode { NamedNodeMap attrs = parent.getAttributes(); if (attrs != null) - { - attrs.setNamedItemNS(node); - } + attrs.setNamedItemNS(node); } else { if (nextSibling != null) - { - parent.insertBefore(node, nextSibling); - } + parent.insertBefore(node, nextSibling); else - { - parent.appendChild(node); - } + parent.appendChild(node); } } } @@ -152,36 +140,28 @@ final class CopyOfNode { Text textNode = doc.createTextNode(value); if (nextSibling != null) - { - parent.insertBefore(textNode, nextSibling); - } + parent.insertBefore(textNode, nextSibling); else - { - parent.appendChild(textNode); - } + parent.appendChild(textNode); } } // copy-of doesn't process children if (next != null) - { - next.apply(stylesheet, mode, - context, pos, len, - parent, nextSibling); - } + next.apply(stylesheet, mode, + context, pos, len, + parent, nextSibling); } public boolean references(QName var) { if (select != null && select.references(var)) - { - return true; - } + return true; return super.references(var); } public String toString() { - StringBuffer buf = new StringBuffer(getClass().getName()); + StringBuffer buf = new StringBuffer("copy-of"); buf.append('['); buf.append("select="); buf.append(select); diff --git a/libjava/classpath/gnu/xml/transform/DocumentFunction.java b/libjava/classpath/gnu/xml/transform/DocumentFunction.java index d8f6090be66..29f3d4a4598 100644 --- a/libjava/classpath/gnu/xml/transform/DocumentFunction.java +++ b/libjava/classpath/gnu/xml/transform/DocumentFunction.java @@ -126,9 +126,7 @@ final class DocumentFunction Object arg1 = values.get(0); Object arg2 = values.get(1); if (!(arg2 instanceof Collection)) - { - throw new RuntimeException("second argument is not a node-set"); - } + throw new RuntimeException("second argument is not a node-set"); Collection arg2ns = (Collection) arg2; String base2 = arg2ns.isEmpty() ? null : ((Node) arg2ns.iterator().next()).getBaseURI(); @@ -166,9 +164,7 @@ final class DocumentFunction Collection document(String uri, String base) { if ("".equals(uri) || uri == null) - { - uri = this.base.getBaseURI(); - } + uri = this.base.getBaseURI(); // Get fragment Expr fragment = null; @@ -197,10 +193,10 @@ final class DocumentFunction source = resolver.resolveDOM(null, base, uri); } Node node = source.getNode(); + // Strip whitespace + TransformerImpl.strip(stylesheet, node); if (fragment == null) - { - return Collections.singleton(node); - } + return Collections.singleton(node); else { Object ret = fragment.evaluate(node, 1, 1); @@ -216,9 +212,7 @@ final class DocumentFunction { String msg = "can't open " + uri; if (base != null) - { - msg += " with base " + base; - } + msg += " with base " + base; throw new RuntimeException(msg); } } @@ -227,16 +221,12 @@ final class DocumentFunction { Stylesheet s = stylesheet; if (context instanceof Stylesheet) - { - s = (Stylesheet) context; - } + s = (Stylesheet) context; DocumentFunction f = new DocumentFunction(s, base); int len = args.size(); List args2 = new ArrayList(len); for (int i = 0; i < len; i++) - { - args2.add(((Expr) args.get(i)).clone(context)); - } + args2.add(((Expr) args.get(i)).clone(context)); f.setArguments(args2); return f; } @@ -246,9 +236,7 @@ final class DocumentFunction for (Iterator i = args.iterator(); i.hasNext(); ) { if (((Expr) i.next()).references(var)) - { - return true; - } + return true; } return false; } diff --git a/libjava/classpath/gnu/xml/transform/ElementNode.java b/libjava/classpath/gnu/xml/transform/ElementNode.java index 092c56a4b64..b6a5c365b12 100644 --- a/libjava/classpath/gnu/xml/transform/ElementNode.java +++ b/libjava/classpath/gnu/xml/transform/ElementNode.java @@ -1,5 +1,5 @@ /* ElementNode.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004,2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -238,7 +238,7 @@ final class ElementNode public String toString() { - StringBuffer buf = new StringBuffer(getClass().getName()); + StringBuffer buf = new StringBuffer("element"); buf.append('['); buf.append("name="); if (namespace != null) diff --git a/libjava/classpath/gnu/xml/transform/ForEachNode.java b/libjava/classpath/gnu/xml/transform/ForEachNode.java index 8f9220f679b..c8f51a6febb 100644 --- a/libjava/classpath/gnu/xml/transform/ForEachNode.java +++ b/libjava/classpath/gnu/xml/transform/ForEachNode.java @@ -1,5 +1,5 @@ /* ForEachNode.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004,2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -70,19 +70,13 @@ final class ForEachNode int len = sortKeys.size(); List sortKeys2 = new ArrayList(len); for (int i = 0; i < len; i++) - { - sortKeys2.add(((Key) sortKeys.get(i)).clone(stylesheet)); - } + sortKeys2.add(((Key) sortKeys.get(i)).clone(stylesheet)); TemplateNode ret = new ForEachNode(select.clone(stylesheet), sortKeys2); if (children != null) - { - ret.children = children.clone(stylesheet); - } + ret.children = children.clone(stylesheet); if (next != null) - { - ret.next = next.clone(stylesheet); - } + ret.next = next.clone(stylesheet); return ret; } @@ -113,9 +107,7 @@ final class ForEachNode Collections.sort(list, new XSLComparator(sortKeys)); } else - { - Collections.sort(list, documentOrderComparator); - } + Collections.sort(list, documentOrderComparator); // Perform children for each node int l = list.size(); int p = 1; @@ -132,27 +124,21 @@ final class ForEachNode stylesheet.currentTemplate = saved; } if (next != null) - { - next.apply(stylesheet, mode, - context, pos, len, - parent, nextSibling); - } + next.apply(stylesheet, mode, + context, pos, len, + parent, nextSibling); } public boolean references(QName var) { if (select != null && select.references(var)) - { - return true; - } + return true; if (sortKeys != null) { for (Iterator i = sortKeys.iterator(); i.hasNext(); ) { if (((SortKey) i.next()).references(var)) - { - return true; - } + return true; } } return super.references(var); @@ -160,7 +146,7 @@ final class ForEachNode public String toString() { - StringBuffer buf = new StringBuffer(getClass().getName()); + StringBuffer buf = new StringBuffer("for-each"); buf.append('['); buf.append("select="); buf.append(select); diff --git a/libjava/classpath/gnu/xml/transform/IfNode.java b/libjava/classpath/gnu/xml/transform/IfNode.java index 17e2486fe83..2a00d64ca82 100644 --- a/libjava/classpath/gnu/xml/transform/IfNode.java +++ b/libjava/classpath/gnu/xml/transform/IfNode.java @@ -1,5 +1,5 @@ /* IfNode.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004,2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -62,19 +62,15 @@ final class IfNode { TemplateNode ret = new IfNode(test.clone(stylesheet)); if (children != null) - { - ret.children = children.clone(stylesheet); - } + ret.children = children.clone(stylesheet); if (next != null) - { - ret.next = next.clone(stylesheet); - } + ret.next = next.clone(stylesheet); return ret; } void doApply(Stylesheet stylesheet, QName mode, - Node context, int pos, int len, - Node parent, Node nextSibling) + Node context, int pos, int len, + Node parent, Node nextSibling) throws TransformerException { Object ret = test.evaluate(context, pos, len); @@ -84,32 +80,26 @@ final class IfNode if (success) { if (children != null) - { - children.apply(stylesheet, mode, - context, pos, len, - parent, nextSibling); - } + children.apply(stylesheet, mode, + context, pos, len, + parent, nextSibling); } if (next != null) - { - next.apply(stylesheet, mode, - context, pos, len, - parent, nextSibling); - } + next.apply(stylesheet, mode, + context, pos, len, + parent, nextSibling); } public boolean references(QName var) { if (test != null && test.references(var)) - { - return true; - } + return true; return super.references(var); } public String toString() { - StringBuffer buf = new StringBuffer(getClass().getName()); + StringBuffer buf = new StringBuffer("if"); buf.append('['); buf.append("test="); buf.append(test); diff --git a/libjava/classpath/gnu/xml/transform/LiteralNode.java b/libjava/classpath/gnu/xml/transform/LiteralNode.java index 453c22c5e0d..d4e283a6580 100644 --- a/libjava/classpath/gnu/xml/transform/LiteralNode.java +++ b/libjava/classpath/gnu/xml/transform/LiteralNode.java @@ -196,12 +196,7 @@ final class LiteralNode public String toString() { - StringBuffer buf = new StringBuffer(getClass().getName()); - buf.append('['); - buf.append("source="); - buf.append(source); - buf.append(']'); - return buf.toString(); + return source.toString(); } } diff --git a/libjava/classpath/gnu/xml/transform/MessageNode.java b/libjava/classpath/gnu/xml/transform/MessageNode.java index e8e07c6da29..890d76f6b1c 100644 --- a/libjava/classpath/gnu/xml/transform/MessageNode.java +++ b/libjava/classpath/gnu/xml/transform/MessageNode.java @@ -92,5 +92,17 @@ final class MessageNode if (next != null && !terminate) next.apply(stylesheet, mode, context, pos, len, parent, nextSibling); } + + public String toString() + { + StringBuffer buf = new StringBuffer("message"); + if (terminate) + { + buf.append('['); + buf.append("terminate"); + buf.append(']'); + } + return buf.toString(); + } } diff --git a/libjava/classpath/gnu/xml/transform/OtherwiseNode.java b/libjava/classpath/gnu/xml/transform/OtherwiseNode.java index 570310f6bd5..9d8168ce4f9 100644 --- a/libjava/classpath/gnu/xml/transform/OtherwiseNode.java +++ b/libjava/classpath/gnu/xml/transform/OtherwiseNode.java @@ -1,5 +1,5 @@ /* OtherwiseNode.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004,2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -54,13 +54,9 @@ final class OtherwiseNode { TemplateNode ret = new OtherwiseNode(); if (children != null) - { - ret.children = children.clone(stylesheet); - } + ret.children = children.clone(stylesheet); if (next != null) - { - ret.next = next.clone(stylesheet); - } + ret.next = next.clone(stylesheet); return ret; } @@ -70,25 +66,18 @@ final class OtherwiseNode throws TransformerException { if (children != null) - { - children.apply(stylesheet, mode, - context, pos, len, - parent, nextSibling); - } + children.apply(stylesheet, mode, + context, pos, len, + parent, nextSibling); if (next != null) - { - next.apply(stylesheet, mode, - context, pos, len, - parent, nextSibling); - } + next.apply(stylesheet, mode, + context, pos, len, + parent, nextSibling); } public String toString() { - StringBuffer buf = new StringBuffer(getClass().getName()); - buf.append('['); - buf.append(']'); - return buf.toString(); + return "otherwise"; } } diff --git a/libjava/classpath/gnu/xml/transform/ParameterNode.java b/libjava/classpath/gnu/xml/transform/ParameterNode.java index ef09ea5f9b2..8cd2677cf08 100644 --- a/libjava/classpath/gnu/xml/transform/ParameterNode.java +++ b/libjava/classpath/gnu/xml/transform/ParameterNode.java @@ -1,5 +1,5 @@ /* ParameterNode.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004,2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -73,13 +73,9 @@ final class ParameterNode select.clone(stylesheet), type); if (children != null) - { - ret.children = children.clone(stylesheet); - } + ret.children = children.clone(stylesheet); if (next != null) - { - ret.next = next.clone(stylesheet); - } + ret.next = next.clone(stylesheet); return ret; } @@ -96,18 +92,14 @@ final class ParameterNode { stylesheet.bindings.set(name, value, type); if (stylesheet.debug) - { - System.err.println(this + ": set to " + value); - } + System.err.println(this + ": set to " + value); } // variable and param don't process children as such // all subsequent instructions are processed with that variable context if (next != null) - { - next.apply(stylesheet, mode, - context, pos, len, - parent, nextSibling); - } + next.apply(stylesheet, mode, + context, pos, len, + parent, nextSibling); // pop the variable context stylesheet.bindings.pop(type); } @@ -117,9 +109,7 @@ final class ParameterNode throws TransformerException { if (select != null) - { - return select.evaluate(context, pos, len); - } + return select.evaluate(context, pos, len); else if (children != null) { Document doc = (context instanceof Document) ? (Document) context : @@ -129,17 +119,13 @@ final class ParameterNode return Collections.singleton(fragment); } else - { - return null; - } + return null; } public boolean references(QName var) { if (select != null && select.references(var)) - { - return true; - } + return true; return super.references(var); } @@ -151,33 +137,18 @@ final class ParameterNode boolean r1 = references(pn.name); boolean r2 = pn.references(name); if (r1 && r2) - { - throw new IllegalArgumentException("circular definitions"); - } + throw new IllegalArgumentException("circular definitions"); if (r1) - { - return 1; - } + return 1; if (r2) - { - return -1; - } + return -1; } return 0; } public String toString() { - StringBuffer buf = new StringBuffer(getClass().getName()); - buf.append('['); - buf.append("name="); - buf.append(name); - if (select != null) - { - buf.append(",select="); - buf.append(select); - } - buf.append(",type="); + StringBuffer buf = new StringBuffer(); switch (type) { case Bindings.VARIABLE: @@ -190,6 +161,14 @@ final class ParameterNode buf.append("with-param"); break; } + buf.append('['); + buf.append("name="); + buf.append(name); + if (select != null) + { + buf.append(",select="); + buf.append(select); + } buf.append(']'); return buf.toString(); } diff --git a/libjava/classpath/gnu/xml/transform/ProcessingInstructionNode.java b/libjava/classpath/gnu/xml/transform/ProcessingInstructionNode.java index d75f693663e..bf61fc03880 100644 --- a/libjava/classpath/gnu/xml/transform/ProcessingInstructionNode.java +++ b/libjava/classpath/gnu/xml/transform/ProcessingInstructionNode.java @@ -1,5 +1,5 @@ /* ProcessingInstructionNode.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004,2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -66,19 +66,15 @@ final class ProcessingInstructionNode { TemplateNode ret = new ProcessingInstructionNode(name); if (children != null) - { - ret.children = children.clone(stylesheet); - } + ret.children = children.clone(stylesheet); if (next != null) - { - ret.next = next.clone(stylesheet); - } + ret.next = next.clone(stylesheet); return ret; } void doApply(Stylesheet stylesheet, QName mode, - Node context, int pos, int len, - Node parent, Node nextSibling) + Node context, int pos, int len, + Node parent, Node nextSibling) throws TransformerException { String data = null; @@ -98,24 +94,18 @@ final class ProcessingInstructionNode ProcessingInstruction pi = doc.createProcessingInstruction(name, data); // Insert into result tree if (nextSibling != null) - { - parent.insertBefore(pi, nextSibling); - } + parent.insertBefore(pi, nextSibling); else - { - parent.appendChild(pi); - } + parent.appendChild(pi); if (next != null) - { - next.apply(stylesheet, mode, - context, pos, len, - parent, nextSibling); - } + next.apply(stylesheet, mode, + context, pos, len, + parent, nextSibling); } public String toString() { - StringBuffer buf = new StringBuffer(getClass().getName()); + StringBuffer buf = new StringBuffer("processing-instruction"); buf.append('['); buf.append("name="); buf.append(name); diff --git a/libjava/classpath/gnu/xml/transform/Stylesheet.java b/libjava/classpath/gnu/xml/transform/Stylesheet.java index 51accaa3b9a..73b22969114 100644 --- a/libjava/classpath/gnu/xml/transform/Stylesheet.java +++ b/libjava/classpath/gnu/xml/transform/Stylesheet.java @@ -408,7 +408,7 @@ class Stylesheet { if (debug) System.err.println("getTemplate: mode="+mode+" context="+context); - Set candidates = new TreeSet(); + Template selected = null; for (Iterator j = templates.iterator(); j.hasNext(); ) { Template t = (Template) j.next(); @@ -426,10 +426,21 @@ class Stylesheet } //System.err.println("\t"+context+" "+t+"="+isMatch); if (isMatch) - candidates.add(t); + { + // Conflict resolution + // @see http://www.w3.org/TR/xslt#conflict + if (selected == null) + selected = t; + else + { + if (t.precedence < selected.precedence || + t.priority < selected.priority) + continue; + selected = t; + } + } } - //System.err.println("\tcandidates="+candidates); - if (candidates.isEmpty()) + if (selected == null) { // Apply built-in template // Current template is unchanged @@ -451,32 +462,39 @@ class Stylesheet return null; } } - else - { - Template t = (Template) candidates.iterator().next(); - // Set current template - currentTemplate = t; - if (debug) - System.err.println("\ttemplate="+t+" context="+context); - return t.node; - } + // Set current template + currentTemplate = selected; + if (debug) + System.err.println("\ttemplate="+currentTemplate+" context="+context); + return currentTemplate.node; } TemplateNode getTemplate(QName mode, QName name) throws TransformerException { - Set candidates = new TreeSet(); + Template selected = null; for (Iterator j = templates.iterator(); j.hasNext(); ) { Template t = (Template) j.next(); boolean isMatch = t.matches(name); if (isMatch) - candidates.add(t); + { + // Conflict resolution + // @see http://www.w3.org/TR/xslt#conflict + if (selected == null) + selected = t; + else + { + if (t.precedence < selected.precedence || + t.priority < selected.priority) + continue; + selected = t; + } + } } - if (candidates.isEmpty()) + if (selected == null) return null; - Template t = (Template) candidates.iterator().next(); - return t.node; + return selected.node; } /** @@ -504,11 +522,9 @@ class Stylesheet String p = getAttribute(attrs, "priority"); String mm = getAttribute(attrs, "mode"); QName mode = (mm == null) ? null : getQName(mm); - double priority = (p == null) ? Template.DEFAULT_PRIORITY : - Double.parseDouble(p); Node children = node.getFirstChild(); return new Template(this, name, match, parse(children), - precedence, priority, mode); + precedence, p, mode); } /** @@ -799,7 +815,7 @@ class Stylesheet templates.add(new Template(this, null, new Root(), parse(rootClone), precedence, - Template.DEFAULT_PRIORITY, + null, null)); } else diff --git a/libjava/classpath/gnu/xml/transform/Template.java b/libjava/classpath/gnu/xml/transform/Template.java index e3c172fb559..1414dac9eb3 100644 --- a/libjava/classpath/gnu/xml/transform/Template.java +++ b/libjava/classpath/gnu/xml/transform/Template.java @@ -1,5 +1,5 @@ /* Template.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004,2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -66,51 +66,77 @@ class Template final double priority; final int precedence; final QName mode; + final boolean isAnyNode; // is the match simply "node()"? Template(Stylesheet stylesheet, QName name, Pattern match, TemplateNode node, - int precedence, double priority, QName mode) + int precedence, String priorityAttr, QName mode) { this.stylesheet = stylesheet; this.name = name; this.match = match; this.node = node; - // adjust priority if necessary - // see XSLT section 5.5 - Test test = getNodeTest(match); - if (test != null) + this.precedence = precedence; + this.mode = mode; + + double p = DEFAULT_PRIORITY; + boolean a = false; + if (priorityAttr != null) + p = Double.parseDouble(priorityAttr); + else { - if (test instanceof NameTest) + // adjust priority if necessary + // see XSLT section 5.5 + if (match instanceof Selector) { - NameTest nameTest = (NameTest) test; - if (nameTest.matchesAny() || - nameTest.matchesAnyLocalName()) - { - priority = -0.25d; - } - else + Selector selector = (Selector) match; + Test[] tests = selector.getTests(); + if (tests.length > 0) { - priority = 0.0d; - } - } - else - { - NodeTypeTest nodeTypeTest = (NodeTypeTest) test; - if (nodeTypeTest.getNodeType() == - Node.PROCESSING_INSTRUCTION_NODE && - nodeTypeTest.getData() != null) - { - priority = 0.0d; - } - else - { - priority = -0.5d; + Test test = tests[0]; + if (test instanceof NameTest) + { + NameTest nameTest = (NameTest) test; + if (nameTest.matchesAny()) + p = -0.25d; + else if (nameTest.matchesAnyLocalName()) + p = -0.20d; + else + p = 0.0d; + } + else + { + NodeTypeTest nodeTypeTest = (NodeTypeTest) test; + if (nodeTypeTest.getNodeType() == + Node.PROCESSING_INSTRUCTION_NODE && + nodeTypeTest.getData() != null) + p = 0.0d; + else + p = -0.5d; + a = (nodeTypeTest.getNodeType() == 0); + } + // Add a small difference for predicates + if (tests.length > 1) + p += ((double) tests.length - 1) * 0.001; } } } + this.priority = p; + this.isAnyNode = a; + } + + private Template(Stylesheet stylesheet, + QName name, Pattern match, TemplateNode node, + int precedence, double priority, QName mode, boolean isAnyNode) + { + this.stylesheet = stylesheet; + this.name = name; + this.match = match; + this.node = node; this.precedence = precedence; this.priority = priority; this.mode = mode; + this.isAnyNode = isAnyNode; } Template clone(Stylesheet stylesheet) @@ -124,7 +150,8 @@ class Template (node == null) ? null : node.clone(stylesheet), precedence, priority, - mode); + mode, + isAnyNode); } public int compareTo(Object other) @@ -134,29 +161,16 @@ class Template Template t = (Template) other; int d = t.precedence - precedence; if (d != 0) - { - return d; - } + return d; double d2 = t.priority - priority; if (d2 != 0.0d) - { - return (int) Math.round(d2 * 1000.0d); - } + return (int) Math.round(d2 * 1000.0d); } return 0; } Test getNodeTest(Expr expr) { - if (expr instanceof Selector) - { - Selector selector = (Selector) expr; - Test[] tests = selector.getTests(); - if (tests.length > 0) - { - return tests[0]; - } - } return null; } @@ -164,13 +178,11 @@ class Template { if ((mode == null && this.mode != null) || (mode != null && !mode.equals(this.mode))) - { - return false; - } + return false; if (match == null) - { - return false; - } + return false; + if (isAnyNode && node.getNodeType() == Node.DOCUMENT_NODE) + return false; // don't match document node return match.matches(node); } @@ -186,9 +198,7 @@ class Template ctx = ctx.parent) { if (ctx == stylesheet) - { - return true; - } + return true; } return false; } @@ -206,13 +216,12 @@ class Template Node parent, Node nextSibling) throws TransformerException { - System.err.println("...applying " + toString() + " to " + context); + if (stylesheet.debug) + System.err.println("...applying " + toString() + " to " + context); if (node != null) - { - node.apply(stylesheet, mode, - context, pos, len, - parent, nextSibling); - } + node.apply(stylesheet, mode, + context, pos, len, + parent, nextSibling); } public String toString() @@ -244,9 +253,7 @@ class Template { out.println(toString()); if (node != null) - { - node.list(1, out, true); - } + node.list(1, out, true); } } diff --git a/libjava/classpath/gnu/xml/transform/TemplateNode.java b/libjava/classpath/gnu/xml/transform/TemplateNode.java index 36b25cf5222..6ff727c073c 100644 --- a/libjava/classpath/gnu/xml/transform/TemplateNode.java +++ b/libjava/classpath/gnu/xml/transform/TemplateNode.java @@ -64,9 +64,7 @@ abstract class TemplateNode throws TransformerException { if (stylesheet.terminated) - { - return; - } + return; if (Thread.currentThread().isInterrupted()) { // Try to head off any infinite loops at the pass @@ -91,13 +89,9 @@ abstract class TemplateNode public boolean references(QName var) { if (children != null && children.references(var)) - { - return true; - } + return true; if (next != null && next.references(var)) - { - return true; - } + return true; return false; } @@ -107,18 +101,30 @@ abstract class TemplateNode void list(int depth, PrintStream out, boolean listNext) { for (int i = 0; i < depth; i++) - { - out.print(" "); - } + out.print(" "); out.println(toString()); if (children != null) - { - children.list(depth + 1, out, true); - } + children.list(depth + 1, out, true); if (listNext && next != null) + next.list(depth, out, listNext); + } + + /** + * Indicates whether the template for which this template node is the + * first node specifies the given parameter. + */ + boolean hasParam(QName name) + { + for (TemplateNode ctx = this; ctx != null; ctx = ctx.next) { - next.list(depth, out, listNext); + if (ctx instanceof ParameterNode) + { + ParameterNode param = (ParameterNode) ctx; + if (param.type == Bindings.PARAM && param.name.equals(name)) + return true; + } } + return false; } } diff --git a/libjava/classpath/gnu/xml/transform/TextNode.java b/libjava/classpath/gnu/xml/transform/TextNode.java index 1b581e5acbc..39423b270eb 100644 --- a/libjava/classpath/gnu/xml/transform/TextNode.java +++ b/libjava/classpath/gnu/xml/transform/TextNode.java @@ -1,5 +1,5 @@ /* TextNode.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004,2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -65,19 +65,15 @@ final class TextNode { TemplateNode ret = new TextNode(disableOutputEscaping); if (children != null) - { - ret.children = children.clone(stylesheet); - } + ret.children = children.clone(stylesheet); if (next != null) - { - ret.next = next.clone(stylesheet); - } + ret.next = next.clone(stylesheet); return ret; } void doApply(Stylesheet stylesheet, QName mode, - Node context, int pos, int len, - Node parent, Node nextSibling) + Node context, int pos, int len, + Node parent, Node nextSibling) throws TransformerException { String value = ""; @@ -96,24 +92,28 @@ final class TextNode } Text text = doc.createTextNode(value); if (disableOutputEscaping) - { - text.setUserData("disable-output-escaping", "yes", stylesheet); - } + text.setUserData("disable-output-escaping", "yes", stylesheet); // Insert into result tree if (nextSibling != null) - { - parent.insertBefore(text, nextSibling); - } + parent.insertBefore(text, nextSibling); else - { - parent.appendChild(text); - } + parent.appendChild(text); if (next != null) + next.apply(stylesheet, mode, + context, pos, len, + parent, nextSibling); + } + + public String toString() + { + StringBuffer buf = new StringBuffer("text"); + if (disableOutputEscaping) { - next.apply(stylesheet, mode, - context, pos, len, - parent, nextSibling); + buf.append('['); + buf.append("disable-output-escaping"); + buf.append(']'); } + return buf.toString(); } } diff --git a/libjava/classpath/gnu/xml/transform/TransformerImpl.java b/libjava/classpath/gnu/xml/transform/TransformerImpl.java index b7ff668843b..2c57e970be2 100644 --- a/libjava/classpath/gnu/xml/transform/TransformerImpl.java +++ b/libjava/classpath/gnu/xml/transform/TransformerImpl.java @@ -162,7 +162,7 @@ class TransformerImpl } // Make a copy of the source node, and strip it context = context.cloneNode(true); - strip(context); + strip(stylesheet, context); // XSLT transformation try { @@ -321,7 +321,7 @@ class TransformerImpl if (indent) { parent.normalize(); - strip(parent); + strip(stylesheet, parent); Document resultDoc = (parent instanceof Document) ? (Document) parent : parent.getOwnerDocument(); @@ -393,7 +393,7 @@ class TransformerImpl /** * Strip whitespace from the source tree. */ - boolean strip(Node node) + static boolean strip(Stylesheet stylesheet, Node node) throws TransformerConfigurationException { short nt = node.getNodeType(); @@ -444,7 +444,7 @@ class TransformerImpl Node child = node.getFirstChild(); while (child != null) { - boolean remove = strip(child); + boolean remove = strip(stylesheet, child); Node next = child.getNextSibling(); if (remove) node.removeChild(child); @@ -691,7 +691,7 @@ class TransformerImpl for (Iterator i = children.iterator(); i.hasNext(); ) { ctx = (Node) i.next(); - reindent(doc, ctx, offset + 1); + reindent(doc, ctx, offset); } } else @@ -709,9 +709,9 @@ class TransformerImpl } buf = new StringBuffer(); buf.append('\n'); - ws = buf.toString(); for (int i = 0; i < offset; i++) buf.append(INDENT_WHITESPACE); + ws = buf.toString(); node.appendChild(doc.createTextNode(ws)); } } diff --git a/libjava/classpath/gnu/xml/transform/ValueOfNode.java b/libjava/classpath/gnu/xml/transform/ValueOfNode.java index 24c229ea3b3..68f31e05ae3 100644 --- a/libjava/classpath/gnu/xml/transform/ValueOfNode.java +++ b/libjava/classpath/gnu/xml/transform/ValueOfNode.java @@ -126,7 +126,7 @@ final class ValueOfNode public String toString() { - StringBuffer buf = new StringBuffer(getClass().getName()); + StringBuffer buf = new StringBuffer("value-of"); buf.append('['); buf.append("select="); buf.append(select); diff --git a/libjava/classpath/gnu/xml/transform/WhenNode.java b/libjava/classpath/gnu/xml/transform/WhenNode.java index 231f2693b5b..fe3f403ab0c 100644 --- a/libjava/classpath/gnu/xml/transform/WhenNode.java +++ b/libjava/classpath/gnu/xml/transform/WhenNode.java @@ -1,5 +1,5 @@ /* WhenNode.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004,2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -62,19 +62,15 @@ final class WhenNode { TemplateNode ret = new WhenNode(test.clone(stylesheet)); if (children != null) - { - ret.children = children.clone(stylesheet); - } + ret.children = children.clone(stylesheet); if (next != null) - { - ret.next = next.clone(stylesheet); - } + ret.next = next.clone(stylesheet); return ret; } void doApply(Stylesheet stylesheet, QName mode, - Node context, int pos, int len, - Node parent, Node nextSibling) + Node context, int pos, int len, + Node parent, Node nextSibling) throws TransformerException { Object ret = test.evaluate(context, pos, len); @@ -84,35 +80,29 @@ final class WhenNode if (success) { if (children != null) - { - children.apply(stylesheet, mode, - context, pos, len, - parent, nextSibling); - } + children.apply(stylesheet, mode, + context, pos, len, + parent, nextSibling); } else { if (next != null) - { - next.apply(stylesheet, mode, - context, pos, len, - parent, nextSibling); - } + next.apply(stylesheet, mode, + context, pos, len, + parent, nextSibling); } } public boolean references(QName var) { if (test != null && test.references(var)) - { - return true; - } + return true; return super.references(var); } public String toString() { - StringBuffer buf = new StringBuffer(getClass().getName()); + StringBuffer buf = new StringBuffer("when"); buf.append('['); buf.append("test="); buf.append(test); |