aruny 2004/07/15 00:00:18
Modified: java/src/org/apache/xalan/xsltc/runtime
AbstractTranslet.java
java/src/org/apache/xalan/xsltc/compiler Output.java
Log:
Description: Patch for the support of extension attribute "intent-amount" for
xsl:output. Supports the old URI {http://xml.apache.org/xslt} and new
URI{http://xml.apache.org/xalan}.
Revision Changes Path
1.56 +3 -1
xml-xalan/java/src/org/apache/xalan/xsltc/runtime/AbstractTranslet.java
Index: AbstractTranslet.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/AbstractTranslet.java,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- AbstractTranslet.java 25 May 2004 18:41:38 -0000 1.55
+++ AbstractTranslet.java 15 Jul 2004 07:00:18 -0000 1.56
@@ -66,6 +66,7 @@
public boolean _indent = false;
public String _mediaType = null;
public Vector _cdata = null;
+ public int _indentamount = -1;
public static final int FIRST_TRANSLET_VERSION = 100;
public static final int VER_SPLIT_NAMES_ARRAY = 101;
@@ -646,6 +647,7 @@
handler.setVersion(_version);
}
handler.setIndent(_indent);
+ handler.setIndentAmount(_indentamount);
if (_doctypeSystem != null) {
handler.setDoctype(_doctypeSystem, _doctypePublic);
}
1.26 +21 -2
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Output.java
Index: Output.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Output.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- Output.java 24 Feb 2004 03:55:48 -0000 1.25
+++ Output.java 15 Jul 2004 07:00:18 -0000 1.26
@@ -59,6 +59,7 @@
private boolean _indent = false;
private String _mediaType;
private String _cdataToMerge;
+ private String _indentamount;
// Disables this output element (when other element has higher
precedence)
private boolean _disabled = false;
@@ -236,7 +237,17 @@
else if (_method != null && _method.equals("html")) {
_indent = true;
}
-
+
+ // indent-amount: extension attribute of xsl:output
+ _indentamount =
getAttributes().getValue(lookupPrefix("http://xml.apache.org/xalan"),"indent-amount");
+ // Hack for supporting Old Namespace URI.
+ if(_indentamount == null || _indentamount.equals(EMPTYSTRING)){
+ _indentamount =
getAttributes().getValue(lookupPrefix("http://xml.apache.org/xslt"),"indent-amount");
+ }
+ if(_indentamount != null && !_indentamount.equals(EMPTYSTRING)) {
+ outputProperties.setProperty("indent_amount", _indentamount);
+ }
+
// Get the MIME type for the output file
_mediaType = getAttribute("media-type");
if (_mediaType.equals(Constants.EMPTYSTRING)) {
@@ -348,6 +359,14 @@
il.append(new PUTFIELD(field));
}
+ //Compile code to set indent amount.
+ if(_indentamount != null && !_indentamount.equals(EMPTYSTRING)){
+ field = cpg.addFieldref(TRANSLET_CLASS, "_indentamount", "I");
+ il.append(DUP);
+ il.append(new PUSH(cpg, Integer.parseInt(_indentamount)));
+ il.append(new PUTFIELD(field));
+ }
+
// Forward to the translet any elements that should be output as CDATA
if (_cdata != null) {
int index = cpg.addMethodref(TRANSLET_CLASS,
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]