]> granicus.if.org Git - docbook-dsssl/commitdiff
Updates for Xalan 2.0.x API as released by Apache
authorNorman Walsh <ndw@nwalsh.com>
Mon, 21 May 2001 15:00:26 +0000 (15:00 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Mon, 21 May 2001 15:00:26 +0000 (15:00 +0000)
xsl/extensions/xalan2/com/nwalsh/xalan/FormatCallout.java
xsl/extensions/xalan2/com/nwalsh/xalan/Table.java
xsl/extensions/xalan2/com/nwalsh/xalan/Verbatim.java

index 99363b5d122a3f275220764596b8f1666b9a0b3e..0c179a1dced5ccb5c625717d9744a4922c11209b 100644 (file)
@@ -3,6 +3,7 @@ package com.nwalsh.xalan;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.AttributesImpl;
 import org.w3c.dom.*;
+import org.apache.xpath.DOMHelper;
 import org.apache.xml.utils.DOMBuilder;
 import org.apache.xml.utils.AttList;
 import com.nwalsh.xalan.Callout;
@@ -32,6 +33,7 @@ public abstract class FormatCallout {
   protected static final String foURI = "http://www.w3.org/1999/XSL/Format";
   protected static final String xhURI = "http://www.w3.org/1999/xhtml";
   protected boolean stylesheetFO = false;
+  protected DOMHelper dh = null;
 
   public FormatCallout() {
     //nop;
@@ -39,7 +41,7 @@ public abstract class FormatCallout {
 
   public String areaLabel(Element area) {
     NamedNodeMap domAttr = area.getAttributes();
-    AttList attr = new AttList(domAttr);
+    AttList attr = new AttList(domAttr, dh);
     String label = null;
 
     if (attr.getValue("label") != null) {
@@ -49,7 +51,7 @@ public abstract class FormatCallout {
       // Otherwise, if its parent is an areaset and it has a label, use that
       Element parent = (Element) area.getParentNode();
       NamedNodeMap pdomAttr = parent.getAttributes();
-      AttList pAttr = new AttList(pdomAttr);
+      AttList pAttr = new AttList(pdomAttr, dh);
       if (parent != null
          && parent.getNodeName().equals("areaset")
          && pAttr.getValue("label") != null) {
index 02b323138cd29ef9a2f4537b8f85e9cd23810eec..6b365a9e944bbfb97a2293b5b407483328ac3838 100644 (file)
@@ -18,6 +18,7 @@ import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 import org.apache.xml.utils.QName;
+import org.apache.xpath.DOMHelper;
 import org.apache.xml.utils.AttList;
 
 /**
@@ -279,6 +280,10 @@ public class Table {
   public DocumentFragment adjustColumnWidths (ExpressionContext context,
                                              NodeIterator xalanNI) {
 
+    // HACK!!!
+    XPathContext xpcontext = (XPathContext) context;
+    DOMHelper dh = xpcontext.getDOMHelper();
+
     int nominalWidth = convertLength(Params.getString(context,
                                                      "nominal.table.width"));
     String tableWidth = Params.getString(context, "table.width");
@@ -324,7 +329,7 @@ public class Table {
                  && child.getLocalName().equals("table-column")))) {
        Element col = (Element) child;
        NamedNodeMap domAttr = col.getAttributes();
-       AttList attr = new AttList(domAttr);
+       AttList attr = new AttList(domAttr,dh);
 
        columns[colnum] = col;
 
@@ -477,7 +482,7 @@ public class Table {
       String localName = colgroup.getLocalName();
       String name = colgroup.getTagName();
       NamedNodeMap colgroupDomAttr = colgroup.getAttributes();
-      AttList colgroupAttr = new AttList(colgroupDomAttr);
+      AttList colgroupAttr = new AttList(colgroupDomAttr,dh);
 
       if (colgroup.getLocalName().equals("colgroup")) {
        rtf.startElement(ns, localName, name, colgroupAttr);
index 6797add570e1859a1d884be71dede9204bfe3bdf..63e952e561365276c39e7bed4b5a63c655e114c4 100644 (file)
@@ -15,6 +15,7 @@ import org.apache.xpath.objects.XObject;
 import org.apache.xpath.XPath;
 import org.apache.xpath.XPathContext;
 import org.apache.xpath.NodeSet;
+import org.apache.xpath.DOMHelper;
 import org.apache.xalan.extensions.XSLProcessorContext;
 import org.apache.xalan.extensions.ExpressionContext;
 import org.apache.xalan.transformer.TransformerImpl;
@@ -107,6 +108,8 @@ public class Verbatim {
   private static final String foURI = "http://www.w3.org/1999/XSL/Format";
   private static final String xhURI = "http://www.w3.org/1999/xhtml";
 
+  protected DOMHelper dh = null;
+
   /**
    * <p>Constructor for Verbatim</p>
    *
@@ -157,6 +160,10 @@ public class Verbatim {
   public DocumentFragment numberLines (ExpressionContext context,
                                       NodeIterator xalanNI) {
 
+    // HACK!!!
+    XPathContext xpcontext = (XPathContext) context;
+    dh = xpcontext.getDOMHelper();
+
     int xalanMod = Params.getInt(context, "linenumbering.everyNth");
     int xalanWidth = Params.getInt(context, "linenumbering.width");
     String xalanSep = Params.getString(context, "linenumbering.separator");
@@ -258,7 +265,7 @@ public class Verbatim {
        String localName = node.getLocalName();
        String name = ((Element) node).getTagName();
        NamedNodeMap domAttr = node.getAttributes();
-       AttList attr = new AttList(domAttr);
+       AttList attr = new AttList(domAttr, dh);
 
        rtf.startElement(ns, localName, name, attr);
        elementStack.push(node);
@@ -442,6 +449,10 @@ public class Verbatim {
                                          NodeIterator areaspecNodeSet,
                                          NodeIterator xalanNI) {
 
+    // HACK!!!
+    XPathContext xpcontext = (XPathContext) context;
+    dh = xpcontext.getDOMHelper();
+
     String type = Params.getString(context, "stylesheet.result.type");
     boolean useFO = type.equals("fo");
     int defaultColumn = Params.getInt(context, "callout.defaultcolumn");
@@ -599,7 +610,7 @@ public class Verbatim {
        String localName = node.getLocalName();
        String name = ((Element) node).getTagName();
        NamedNodeMap domAttr = node.getAttributes();
-       AttList attr = new AttList(domAttr);
+       AttList attr = new AttList(domAttr, dh);
 
        rtf.startElement(ns, localName, name, attr);
        elementStack.push(node);
@@ -720,7 +731,7 @@ public class Verbatim {
     Element area = (Element) node;
 
     NamedNodeMap domAttr = node.getAttributes();
-    AttList attr = new AttList(domAttr);
+    AttList attr = new AttList(domAttr, dh);
 
     String units = attr.getValue("units");
     String otherUnits = attr.getValue("otherunits");