You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mo...@apache.org on 2001/11/02 12:31:28 UTC
cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/dom NodeCounter.java SingleNodeCounter.java
morten 01/11/02 03:31:28
Modified: java/src/org/apache/xalan/xsltc/compiler PositionCall.java
java/src/org/apache/xalan/xsltc/dom NodeCounter.java
SingleNodeCounter.java
Log:
A fix for the <xsl:number> element.
PR: n/a
Obtained from: n/a
Submitted by: morten@xml.apache.org / todd.miller@sun.com
Reviewed by: morten@xml.apache.org
Revision Changes Path
1.5 +10 -4 xml-xalan/java/src/org/apache/xalan/xsltc/compiler/PositionCall.java
Index: PositionCall.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/PositionCall.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- PositionCall.java 2001/09/21 09:39:38 1.4
+++ PositionCall.java 2001/11/02 11:31:28 1.5
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: PositionCall.java,v 1.4 2001/09/21 09:39:38 morten Exp $
+ * @(#)$Id: PositionCall.java,v 1.5 2001/11/02 11:31:28 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -96,9 +96,15 @@
if ((_type == DOM.ELEMENT) || (_type == DOM.ATTRIBUTE))
_type = -1;
}
-
- if ((parent instanceof Predicate) && (granny instanceof StepPattern)){
- _type = ((StepPattern)granny).getNodeType();
+ else {
+ while ((granny != null) && !(granny instanceof StepPattern)) {
+ parent = granny;
+ granny = granny.getParent();
+ }
+ if ((parent instanceof Predicate) &&
+ (granny instanceof StepPattern)){
+ _type = ((StepPattern)granny).getNodeType();
+ }
}
if (methodGen instanceof CompareGenerator) {
1.5 +1 -2 xml-xalan/java/src/org/apache/xalan/xsltc/dom/NodeCounter.java
Index: NodeCounter.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/NodeCounter.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- NodeCounter.java 2001/11/01 15:00:00 1.4
+++ NodeCounter.java 2001/11/02 11:31:28 1.5
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: NodeCounter.java,v 1.4 2001/11/01 15:00:00 morten Exp $
+ * @(#)$Id: NodeCounter.java,v 1.5 2001/11/02 11:31:28 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -273,7 +273,6 @@
* lang="en".
*/
private void formatValue(int value, String format, StringBuffer buffer) {
- if (value <= 0) return;
char c = format.charAt(0);
if (Character.isDigit(c)) {
1.2 +8 -13 xml-xalan/java/src/org/apache/xalan/xsltc/dom/SingleNodeCounter.java
Index: SingleNodeCounter.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/SingleNodeCounter.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SingleNodeCounter.java 2001/04/17 18:52:35 1.1
+++ SingleNodeCounter.java 2001/11/02 11:31:28 1.2
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: SingleNodeCounter.java,v 1.1 2001/04/17 18:52:35 sboag Exp $
+ * @(#)$Id: SingleNodeCounter.java,v 1.2 2001/11/02 11:31:28 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -105,20 +105,15 @@
}
if (next != END) {
- result++; // count target
_countSiblings.setStartNode(next);
- while ((next = _countSiblings.next()) != END) {
- if (matchesCount(next)) {
- result++;
- }
- }
+ do {
+ if (matchesCount(next)) result++;
+ } while ((next = _countSiblings.next()) != END);
+ }
+ else {
+ // If no target found then pass the empty list
+ return formatNumbers(EmptyArray);
}
- /*
- else {
- // If no target found then pass the empty list
- return formatNumbers(EmptyArray);
- }
- */
}
return formatNumbers(result);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org