--- /dev/null
+package com.nwalsh.saxon;
+
+import java.io.*;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.util.Date;
+import java.util.Locale;
+import java.util.TimeZone;
+import java.text.DateFormat;
+import java.text.ParseException;
+
+/**
+ * <p>Saxon extension to convert CVS date strings into local time</p>
+ *
+ * <p>$Id$</p>
+ *
+ * <p>Copyright (C) 2000 Norman Walsh.</p>
+ *
+ * <p>This class provides a
+ * <a href="http://users.iclway.co.uk/mhkay/saxon/">Saxon</a>
+ * extension to turn the CVS date strings, which are UTC:</p>
+ *
+ * <pre>$Date: 2000/11/09 02:34:20 $</pre>
+ *
+ * <p>into legibly formatted local time:</p>
+ *
+ * <pre>Wed Nov 08 18:34:20 PST 2000</pre>
+ *
+ * <p>(I happened to be in California when I wrote this documentation.)</p>
+
+ * <p><b>Change Log:</b></p>
+ * <dl>
+ * <dt>1.0</dt>
+ * <dd><p>Initial release.</p></dd>
+ * </dl>
+ *
+ * @author Norman Walsh
+ * <a href="mailto:ndw@nwalsh.com">ndw@nwalsh.com</a>
+ *
+ * @version $Id$
+ *
+ */
+public class CVS {
+ /**
+ * <p>Constructor for CVS</p>
+ *
+ * <p>All of the methods are static, so the constructor does nothing.</p>
+ */
+ public CVS() {
+ }
+
+ /**
+ * <p>Convert a CVS date string into local time.</p>
+ *
+ * @param cvsDate The CVS date string.
+ *
+ * @return The date, converted to local time and reformatted.
+ */
+ public static String localTime (String cvsDate) {
+ // A cvsDate has the following form "$Date$"
+ if (!cvsDate.startsWith("$Date: ")) {
+ return cvsDate;
+ }
+
+ String yrS = cvsDate.substring(7,11);
+ String moS = cvsDate.substring(12,14);
+ String daS = cvsDate.substring(15,17);
+ String hrS = cvsDate.substring(18,20);
+ String miS = cvsDate.substring(21,23);
+ String seS = cvsDate.substring(24,26);
+
+ TimeZone tz = TimeZone.getTimeZone("GMT+0");
+ GregorianCalendar gmtCal = new GregorianCalendar(tz);
+
+ try {
+ gmtCal.set(Integer.parseInt(yrS),
+ Integer.parseInt(moS)-1,
+ Integer.parseInt(daS),
+ Integer.parseInt(hrS),
+ Integer.parseInt(miS),
+ Integer.parseInt(seS));
+ } catch (NumberFormatException e) {
+ // nop
+ }
+
+ Date d = gmtCal.getTime();
+
+ return d.toString();
+ }
+}
--- /dev/null
+package com.nwalsh.saxon;
+
+import org.w3c.dom.*;
+
+/**
+ * <p>A class for maintaining information about callouts.</p>
+ *
+ * <p>To make processing callouts easier, they are parsed out of the
+ * input structure and stored in a sorted array. (The array is sorted
+ * according to the order in which the callouts occur.)</p>
+ *
+ * <p>This class is just the little record
+ * that we store in the array for each callout.</p>
+ */
+public class Callout implements Comparable {
+ /** The callout number. */
+ private int callout = 0;
+ /** The area Element item that generated this callout. */
+ private Element area = null;
+ /** The line on which this callout occurs. */
+ private int line = 0;
+ /** The column in which this callout appears. */
+ private int col = 0;
+
+ /** The constructor; initialize the private data structures. */
+ public Callout(int callout, Element area, int line, int col) {
+ this.callout = callout;
+ this.area = area;
+ this.line = line;
+ this.col = col;
+ }
+
+ /**
+ * <p>The compareTo method compares this Callout with another.</p>
+ *
+ * <p>Given two Callouts, A and B, A < B if:</p>
+ *
+ * <ol>
+ * <li>A.line < B.line, or</li>
+ * <li>A.line = B.line && A.col < B.col, or</li>
+ * <li>A.line = B.line && A.col = B.col && A.callout < B.callout</li>
+ * <li>Otherwise, they're equal.</li>
+ * </ol>
+ */
+ public int compareTo (Object o) {
+ Callout c = (Callout) o;
+
+ if (line == c.getLine()) {
+ if (col > c.getColumn()) {
+ return 1;
+ } else if (col < c.getColumn()) {
+ return -1;
+ } else {
+ if (callout < c.getCallout()) {
+ return -1;
+ } else if (callout > c.getCallout()) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+ } else {
+ if (line > c.getLine()) {
+ return 1;
+ } else {
+ return -1;
+ }
+ }
+ }
+
+ /** Access the Callout's area. */
+ public Element getArea() {
+ return area;
+ }
+
+ /** Access the Callout's line. */
+ public int getLine() {
+ return line;
+ }
+
+ /** Access the Callout's column. */
+ public int getColumn() {
+ return col;
+ }
+
+ /** Access the Callout's callout number. */
+ public int getCallout() {
+ return callout;
+ }
+}
--- /dev/null
+package com.nwalsh.saxon;
+
+import java.util.Stack;
+import java.util.StringTokenizer;
+import org.xml.sax.*;
+import org.w3c.dom.*;
+import javax.xml.transform.TransformerException;
+import com.icl.saxon.om.NamePool;
+import com.icl.saxon.output.Emitter;
+import com.icl.saxon.tree.AttributeCollection;
+
+/**
+ * <p>Saxon extension to decorate a result tree fragment with callouts.</p>
+ *
+ * <p>$Id$</p>
+ *
+ * <p>Copyright (C) 2000 Norman Walsh.</p>
+ *
+ * <p>This class provides the guts of a
+ * <a href="http://users.iclway.co.uk/mhkay/saxon/">Saxon 6.*</a>
+ * implementation of callouts for verbatim environments. (It is used
+ * by the Verbatim class.)</p>
+ *
+ * <p>The general design is this: the stylesheets construct a result tree
+ * fragment for some verbatim environment. The Verbatim class initializes
+ * a CalloutEmitter with information about the callouts that should be applied
+ * to the verbatim environment in question. Then the result tree fragment
+ * is "replayed" through the CalloutEmitter; the CalloutEmitter builds a
+ * new result tree fragment from this event stream, decorated with callouts,
+ * and that is returned.</p>
+ *
+ * <p><b>Change Log:</b></p>
+ * <dl>
+ * <dt>1.0</dt>
+ * <dd><p>Initial release.</p></dd>
+ * </dl>
+ *
+ * @see Verbatim
+ *
+ * @author Norman Walsh
+ * <a href="mailto:ndw@nwalsh.com">ndw@nwalsh.com</a>
+ *
+ * @version $Id$
+ *
+ */
+public class CalloutEmitter extends CopyEmitter {
+ /** A stack for the preserving information about open elements. */
+ protected Stack elementStack = null;
+
+ /** A stack for holding information about temporarily closed elements. */
+ protected Stack tempStack = null;
+
+ /** Is the next element absolutely the first element in the fragment? */
+ protected boolean firstElement = false;
+
+ /** The FO namespace name. */
+ protected static String foURI = "http://www.w3.org/1999/XSL/Format";
+
+ /** The default column for callouts that specify only a line. */
+ protected int defaultColumn = 60;
+
+ /** Is the stylesheet currently running an FO stylesheet? */
+ protected boolean foStylesheet = false;
+
+ /** The current line number. */
+ private static int lineNumber = 0;
+
+ /** The current column number. */
+ private static int colNumber = 0;
+
+ /** The (sorted) array of callouts obtained from the areaspec. */
+ private static Callout callout[] = null;
+
+ /** The number of callouts in the callout array. */
+ private static int calloutCount = 0;
+
+ /** A pointer used to keep track of our position in the callout array. */
+ private static int calloutPos = 0;
+
+ /** The FormatCallout object to use for formatting callouts. */
+ private static FormatCallout fCallout = null;
+
+ /** <p>Constructor for the CalloutEmitter.</p>
+ *
+ * @param namePool The name pool to use for constructing elements and attributes.
+ * @param graphicsPath The path to callout number graphics.
+ * @param graphicsExt The extension for callout number graphics.
+ * @param graphicsMax The largest callout number that can be represented as a graphic.
+ * @param defaultColumn The default column for callouts.
+ * @param foStylesheet Is this an FO stylesheet?
+ */
+ public CalloutEmitter(NamePool namePool,
+ int defaultColumn,
+ boolean foStylesheet,
+ FormatCallout fCallout) {
+ super(namePool);
+ elementStack = new Stack();
+ firstElement = true;
+
+ this.defaultColumn = defaultColumn;
+ this.foStylesheet = foStylesheet;
+ this.fCallout = fCallout;
+ }
+
+ /**
+ * <p>Examine the areaspec and determine the number and position of
+ * callouts.</p>
+ *
+ * <p>The <code><a href="http://docbook.org/tdg/html/areaspec.html">areaspecNodeSet</a></code>
+ * is examined and a sorted list of the callouts is constructed.</p>
+ *
+ * <p>This data structure is used to augment the result tree fragment
+ * with callout bullets.</p>
+ *
+ * @param areaspecNodeSet The source document <areaspec> element.
+ *
+ */
+ public void setupCallouts (NodeList areaspecNodeList) {
+ callout = new Callout[10];
+ calloutCount = 0;
+ calloutPos = 0;
+ lineNumber = 1;
+ colNumber = 1;
+
+ // First we walk through the areaspec to calculate the position
+ // of the callouts
+ // <areaspec>
+ // <areaset id="ex.plco.const" coords="">
+ // <area id="ex.plco.c1" coords="4"/>
+ // <area id="ex.plco.c2" coords="8"/>
+ // </areaset>
+ // <area id="ex.plco.ret" coords="12"/>
+ // <area id="ex.plco.dest" coords="12"/>
+ // </areaspec>
+ int pos = 0;
+ int coNum = 0;
+ boolean inAreaSet = false;
+ Node areaspec = areaspecNodeList.item(0);
+ NodeList children = areaspec.getChildNodes();
+
+ for (int count = 0; count < children.getLength(); count++) {
+ Node node = children.item(count);
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ if (node.getNodeName().equalsIgnoreCase("areaset")) {
+ coNum++;
+ NodeList areas = node.getChildNodes();
+ for (int acount = 0; acount < areas.getLength(); acount++) {
+ Node area = areas.item(acount);
+ if (area.getNodeType() == Node.ELEMENT_NODE) {
+ if (area.getNodeName().equalsIgnoreCase("area")) {
+ addCallout(coNum, area, defaultColumn);
+ } else {
+ System.out.println("Unexpected element in areaset: "
+ + area.getNodeName());
+ }
+ }
+ }
+ } else if (node.getNodeName().equalsIgnoreCase("area")) {
+ coNum++;
+ addCallout(coNum, node, defaultColumn);
+ } else {
+ System.out.println("Unexpected element in areaspec: "
+ + node.getNodeName());
+ }
+ }
+ }
+
+ // Now sort them
+ java.util.Arrays.sort(callout, 0, calloutCount);
+ }
+
+ /** Process characters. */
+ public void characters(char[] chars, int start, int len)
+ throws TransformerException {
+
+ // If we hit characters, then there's no first element...
+ firstElement = false;
+
+ if (lineNumber == 0) {
+ // if there are any text nodes, there's at least one line
+ lineNumber++;
+ colNumber = 1;
+ }
+
+ // Walk through the text node looking for callout positions
+ char[] newChars = new char[len];
+ int pos = 0;
+ for (int count = start; count < start+len; count++) {
+ if (calloutPos < calloutCount
+ && callout[calloutPos].getLine() == lineNumber
+ && callout[calloutPos].getColumn() == colNumber) {
+ if (pos > 0) {
+ rtfEmitter.characters(newChars, 0, pos);
+ pos = 0;
+ }
+
+ closeOpenElements(rtfEmitter);
+
+ while (calloutPos < calloutCount
+ && callout[calloutPos].getLine() == lineNumber
+ && callout[calloutPos].getColumn() == colNumber) {
+ fCallout.formatCallout(rtfEmitter, callout[calloutPos]);
+ calloutPos++;
+ }
+
+ openClosedElements(rtfEmitter);
+ }
+
+ if (chars[count] == '\n') {
+ // What if we need to pad this line?
+ if (calloutPos < calloutCount
+ && callout[calloutPos].getLine() == lineNumber
+ && callout[calloutPos].getColumn() > colNumber) {
+
+ if (pos > 0) {
+ rtfEmitter.characters(newChars, 0, pos);
+ pos = 0;
+ }
+
+ closeOpenElements(rtfEmitter);
+
+ while (calloutPos < calloutCount
+ && callout[calloutPos].getLine() == lineNumber
+ && callout[calloutPos].getColumn() > colNumber) {
+ formatPad(callout[calloutPos].getColumn() - colNumber);
+ colNumber = callout[calloutPos].getColumn();
+ while (calloutPos < calloutCount
+ && callout[calloutPos].getLine() == lineNumber
+ && callout[calloutPos].getColumn() == colNumber) {
+ fCallout.formatCallout(rtfEmitter, callout[calloutPos]);
+ calloutPos++;
+ }
+ }
+
+ openClosedElements(rtfEmitter);
+ }
+
+ lineNumber++;
+ colNumber = 1;
+ } else {
+ colNumber++;
+ }
+ newChars[pos++] = chars[count];
+ }
+
+ if (pos > 0) {
+ rtfEmitter.characters(newChars, 0, pos);
+ }
+ }
+
+ /**
+ * <p>Add blanks to the result tree fragment.</p>
+ *
+ * <p>This method adds <tt>numBlanks</tt> to the result tree fragment.
+ * It's used to pad lines when callouts occur after the last existing
+ * characater in a line.</p>
+ *
+ * @param numBlanks The number of blanks to add.
+ */
+ protected void formatPad(int numBlanks) {
+ char chars[] = new char[numBlanks];
+ for (int count = 0; count < numBlanks; count++) {
+ chars[count] = ' ';
+ }
+
+ try {
+ rtfEmitter.characters(chars, 0, numBlanks);
+ } catch (TransformerException e) {
+ System.out.println("Transformer Exception in formatPad");
+ }
+ }
+
+ /**
+ * <p>Add a callout to the global callout array</p>
+ *
+ * <p>This method examines a callout <tt>area</tt> and adds it to
+ * the global callout array if it can be interpreted.</p>
+ *
+ * <p>Only the <tt>linecolumn</tt> and <tt>linerange</tt> units are
+ * supported. If no unit is specifed, <tt>linecolumn</tt> is assumed.
+ * If only a line is specified, the callout decoration appears in
+ * the <tt>defaultColumn</tt>.</p>
+ *
+ * @param coNum The callout number.
+ * @param node The <tt>area</tt>.
+ * @param defaultColumn The default column for callouts.
+ */
+ protected void addCallout (int coNum,
+ Node node,
+ int defaultColumn) {
+
+ Element area = (Element) node;
+ String units = null;
+ String coords = null;
+
+ if (area.hasAttribute("units")) {
+ units = area.getAttribute("units");
+ }
+
+ if (area.hasAttribute("coords")) {
+ coords = area.getAttribute("coords");
+ }
+
+ if (units != null
+ && !units.equalsIgnoreCase("linecolumn")
+ && !units.equalsIgnoreCase("linerange")) {
+ System.out.println("Only linecolumn and linerange units are supported");
+ return;
+ }
+
+ if (coords == null) {
+ System.out.println("Coords must be specified");
+ return;
+ }
+
+ // Now let's see if we can interpret the coordinates...
+ StringTokenizer st = new StringTokenizer(coords);
+ int tokenCount = 0;
+ int c1 = 0;
+ int c2 = 0;
+ while (st.hasMoreTokens()) {
+ tokenCount++;
+ if (tokenCount > 2) {
+ System.out.println("Unparseable coordinates");
+ return;
+ }
+ try {
+ String token = st.nextToken();
+ int coord = Integer.parseInt(token);
+ c2 = coord;
+ if (tokenCount == 1) {
+ c1 = coord;
+ }
+ } catch (NumberFormatException e) {
+ System.out.println("Unparseable coordinate");
+ return;
+ }
+ }
+
+ // Make sure we aren't going to blow past the end of our array
+ if (calloutCount == callout.length) {
+ Callout bigger[] = new Callout[calloutCount+10];
+ for (int count = 0; count < callout.length; count++) {
+ bigger[count] = callout[count];
+ }
+ callout = bigger;
+ }
+
+ // Ok, add the callout
+ if (tokenCount == 2) {
+ if (units != null && units.equalsIgnoreCase("linerange")) {
+ for (int count = c1; count <= c2; count++) {
+ callout[calloutCount++] = new Callout(coNum, area,
+ count, defaultColumn);
+ }
+ } else {
+ // assume linecolumn
+ callout[calloutCount++] = new Callout(coNum, area, c1, c2);
+ }
+ } else {
+ // if there's only one number, assume it's the line
+ callout[calloutCount++] = new Callout(coNum, area, c1, defaultColumn);
+ }
+ }
+
+ /** Process end element events. */
+ public void endElement(int nameCode)
+ throws TransformerException {
+
+ if (!elementStack.empty()) {
+ // if we didn't push the very first element (an fo:block or
+ // pre or div surrounding the whole block), then the stack will
+ // be empty when we get to the end of the first element...
+ elementStack.pop();
+ }
+ rtfEmitter.endElement(nameCode);
+ }
+
+ /** Process start element events. */
+ public void startElement(int nameCode,
+ org.xml.sax.Attributes attributes,
+ int[] namespaces,
+ int nscount)
+ throws TransformerException {
+
+ if (!skipThisElement(nameCode)) {
+ StartElementInfo sei = new StartElementInfo(nameCode, attributes,
+ namespaces, nscount);
+ elementStack.push(sei);
+ }
+
+ firstElement = false;
+
+ rtfEmitter.startElement(nameCode, attributes, namespaces, nscount);
+ }
+
+ /**
+ * <p>Protect the outer-most block wrapper.</p>
+ *
+ * <p>Open elements in the result tree fragment are closed and reopened
+ * around callouts (so that callouts don't appear inside links or other
+ * environments). But if the result tree fragment is a single block
+ * (a div or pre in HTML, an fo:block in FO), that outer-most block is
+ * treated specially.</p>
+ *
+ * <p>This method returns true if the element in question is that
+ * outermost block.</p>
+ *
+ * @param nameCode The name code for the element
+ *
+ * @return True if the element is the outer-most block, false otherwise.
+ */
+ protected boolean skipThisElement(int nameCode) {
+ if (firstElement) {
+ int thisFingerprint = namePool.getFingerprint(nameCode);
+ int foBlockFingerprint = namePool.getFingerprint(foURI, "block");
+ int htmlPreFingerprint = namePool.getFingerprint("", "pre");
+ int htmlDivFingerprint = namePool.getFingerprint("", "div");
+
+ if ((foStylesheet && thisFingerprint == foBlockFingerprint)
+ || (!foStylesheet && (thisFingerprint == htmlPreFingerprint
+ || thisFingerprint == htmlDivFingerprint))) {
+ // Don't push the outer-most wrapping div, pre, or fo:block
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private void closeOpenElements(Emitter rtfEmitter)
+ throws TransformerException {
+ // Close all the open elements...
+ tempStack = new Stack();
+ while (!elementStack.empty()) {
+ StartElementInfo elem = (StartElementInfo) elementStack.pop();
+ rtfEmitter.endElement(elem.getNameCode());
+ tempStack.push(elem);
+ }
+ }
+
+ private void openClosedElements(Emitter rtfEmitter)
+ throws TransformerException {
+ // Now "reopen" the elements that we closed...
+ while (!tempStack.empty()) {
+ StartElementInfo elem = (StartElementInfo) tempStack.pop();
+ AttributeCollection attr = (AttributeCollection) elem.getAttributes();
+ AttributeCollection newAttr = new AttributeCollection(namePool);
+
+ for (int acount = 0; acount < attr.getLength(); acount++) {
+ String localName = attr.getLocalName(acount);
+ int nameCode = attr.getNameCode(acount);
+ String type = attr.getType(acount);
+ String value = attr.getValue(acount);
+ String uri = attr.getURI(acount);
+ String prefix = "";
+
+ if (localName.indexOf(':') > 0) {
+ prefix = localName.substring(0, localName.indexOf(':'));
+ localName = localName.substring(localName.indexOf(':')+1);
+ }
+
+ if (uri.equals("")
+ && ((foStylesheet
+ && localName.equals("id"))
+ || (!foStylesheet
+ && (localName.equals("id")
+ || localName.equals("name"))))) {
+ // skip this attribute
+ } else {
+ newAttr.addAttribute(prefix, uri, localName, type, value);
+ }
+ }
+
+ rtfEmitter.startElement(elem.getNameCode(),
+ newAttr,
+ elem.getNamespaces(),
+ elem.getNSCount());
+
+ elementStack.push(elem);
+ }
+ }
+
+ /**
+ * <p>A private class for maintaining the information required to call
+ * the startElement method.</p>
+ *
+ * <p>In order to close and reopen elements, information about those
+ * elements has to be maintained. This class is just the little record
+ * that we push on the stack to keep track of that info.</p>
+ */
+ private class StartElementInfo {
+ private int _nameCode;
+ org.xml.sax.Attributes _attributes;
+ int[] _namespaces;
+ int _nscount;
+
+ public StartElementInfo(int nameCode,
+ org.xml.sax.Attributes attributes,
+ int[] namespaces,
+ int nscount) {
+ _nameCode = nameCode;
+ _attributes = attributes;
+ _namespaces = namespaces;
+ _nscount = nscount;
+ }
+
+ public int getNameCode() {
+ return _nameCode;
+ }
+
+ public org.xml.sax.Attributes getAttributes() {
+ return _attributes;
+ }
+
+ public int[] getNamespaces() {
+ return _namespaces;
+ }
+
+ public int getNSCount() {
+ return _nscount;
+ }
+ }
+}
--- /dev/null
+package com.nwalsh.saxon;
+
+import org.xml.sax.*;
+import javax.xml.transform.TransformerException;
+import com.icl.saxon.output.*;
+import com.icl.saxon.om.*;
+import com.icl.saxon.expr.FragmentValue;
+
+/**
+ * <p>Saxon extension to scan the column widthsin a result tree fragment.</p>
+ *
+ * <p>$Id$</p>
+ *
+ * <p>Copyright (C) 2000 Norman Walsh.</p>
+ *
+ * <p>This class provides a
+ * <a href="http://users.iclway.co.uk/mhkay/saxon/">Saxon 6.*</a>
+ * implementation to scan the column widths in a result tree
+ * fragment.</p>
+ *
+ * <p>The general design is this: the stylesheets construct a result tree
+ * fragment for some colgroup environment. That result tree fragment
+ * is "replayed" through the ColumnScanEmitter; the ColumnScanEmitter watches
+ * the cols go by and extracts the column widths that it sees. These
+ * widths are then made available.</p>
+ *
+ * <p><b>Change Log:</b></p>
+ * <dl>
+ * <dt>1.0</dt>
+ * <dd><p>Initial release.</p></dd>
+ * </dl>
+ *
+ * @author Norman Walsh
+ * <a href="mailto:ndw@nwalsh.com">ndw@nwalsh.com</a>
+ *
+ * @version $Id$
+ *
+ */
+public class ColumnScanEmitter extends com.icl.saxon.output.Emitter {
+ /** The number of columns seen. */
+ protected int numColumns = 0;
+ protected String width[] = new String[5];
+ protected NamePool namePool = null;
+
+ /** The FO namespace name. */
+ protected static String foURI = "http://www.w3.org/1999/XSL/Format";
+
+ /** Construct a new ColumnScanEmitter. */
+ public ColumnScanEmitter(NamePool namePool) {
+ numColumns = 0;
+ this.namePool = namePool;
+ }
+
+ /** Return the number of columns. */
+ public int columnCount() {
+ return numColumns;
+ }
+
+ /** Return the number of columns. */
+ public String[] columnWidths() {
+ return width;
+ }
+
+ /** Discarded. */
+ public void characters(char[] chars, int start, int len)
+ throws TransformerException {
+ // nop
+ }
+
+ /** Discarded. */
+ public void comment(char[] chars, int start, int length)
+ throws TransformerException {
+ // nop
+ }
+
+ /** Discarded. */
+ public void endDocument()
+ throws TransformerException {
+ // nop
+ }
+
+ /** Discarded. */
+ public void endElement(int nameCode)
+ throws TransformerException {
+ // nop
+ }
+
+ /** Discarded. */
+ public void processingInstruction(java.lang.String name,
+ java.lang.String data)
+ throws TransformerException {
+ // nop
+ }
+
+ /** Discarded. */
+ public void setDocumentLocator(org.xml.sax.Locator locator) {
+ // nop
+ }
+
+ /** Discarded. */
+ public void setEscaping(boolean escaping)
+ throws TransformerException {
+ // nop
+ }
+
+ /** Discarded. */
+ public void setNamePool(NamePool namePool) {
+ // nop
+ }
+
+ /** Discarded. */
+ public void setUnparsedEntity(java.lang.String name, java.lang.String uri)
+ throws TransformerException {
+ // nop
+ }
+
+ /** Discarded. */
+ public void setWriter(java.io.Writer writer) {
+ // nop
+ }
+
+ /** Discarded. */
+ public void startDocument()
+ throws TransformerException {
+ // nop
+ }
+
+ /** Examine for column info. */
+ public void startElement(int nameCode,
+ org.xml.sax.Attributes attributes,
+ int[] namespaces, int nscount)
+ throws TransformerException {
+
+ int thisFingerprint = namePool.getFingerprint(nameCode);
+ int colFingerprint = namePool.getFingerprint("", "col");
+ int foColFingerprint = namePool.getFingerprint(foURI, "table-column");
+
+ if (thisFingerprint == colFingerprint
+ || thisFingerprint == foColFingerprint) {
+ if (numColumns >= width.length) {
+ String newWidth[] = new String[width.length+10];
+ for (int count = 0; count < width.length; count++) {
+ newWidth[count] = width[count];
+ }
+ width = newWidth;
+ }
+
+ if (thisFingerprint == colFingerprint) {
+ if (attributes.getValue("width") == null) {
+ width[numColumns++] = "1*";
+ } else {
+ width[numColumns++] = attributes.getValue("width");
+ }
+ } else {
+ if (attributes.getValue("column-width") == null) {
+ width[numColumns++] = "1*";
+ } else {
+ width[numColumns++] = attributes.getValue("column-width");
+ }
+ }
+ }
+ }
+}
+
+
--- /dev/null
+package com.nwalsh.saxon;
+
+import org.xml.sax.*;
+import com.icl.saxon.output.*;
+import com.icl.saxon.om.*;
+import javax.xml.transform.TransformerException;
+import com.icl.saxon.expr.FragmentValue;
+import com.icl.saxon.tree.AttributeCollection;
+
+/**
+ * <p>Saxon extension to scan the column widthsin a result tree fragment.</p>
+ *
+ * <p>$Id$</p>
+ *
+ * <p>Copyright (C) 2000 Norman Walsh.</p>
+ *
+ * <p>This class provides a
+ * <a href="http://users.iclway.co.uk/mhkay/saxon/">Saxon 6.*</a>
+ * implementation to scan the column widths in a result tree
+ * fragment.</p>
+ *
+ * <p>The general design is this: the stylesheets construct a result tree
+ * fragment for some colgroup environment. That result tree fragment
+ * is "replayed" through the ColumnUpdateEmitter; the ColumnUpdateEmitter watches
+ * the cols go by and extracts the column widths that it sees. These
+ * widths are then made available.</p>
+ *
+ * <p><b>Change Log:</b></p>
+ * <dl>
+ * <dt>1.0</dt>
+ * <dd><p>Initial release.</p></dd>
+ * </dl>
+ *
+ * @author Norman Walsh
+ * <a href="mailto:ndw@nwalsh.com">ndw@nwalsh.com</a>
+ *
+ * @version $Id$
+ *
+ */
+public class ColumnUpdateEmitter extends CopyEmitter {
+ /** The number of columns seen. */
+ protected int numColumns = 0;
+ protected String width[] = null;
+ protected NamePool namePool = null;
+
+ /** The FO namespace name. */
+ protected static String foURI = "http://www.w3.org/1999/XSL/Format";
+
+ /** Construct a new ColumnUpdateEmitter. */
+ public ColumnUpdateEmitter(NamePool namePool,
+ String width[]) {
+ super(namePool);
+ numColumns = 0;
+ this.width = width;
+ this.namePool = namePool;
+ }
+
+ /** Examine for column info. */
+ public void startElement(int nameCode,
+ org.xml.sax.Attributes attributes,
+ int[] namespaces, int nscount)
+ throws TransformerException {
+
+ int thisFingerprint = namePool.getFingerprint(nameCode);
+ int colFingerprint = namePool.getFingerprint("", "col");
+ int foColFingerprint = namePool.getFingerprint(foURI, "table-column");
+
+ if (thisFingerprint == colFingerprint) {
+ AttributeCollection attr = new AttributeCollection(namePool, attributes);
+ int widthFingerprint = namePool.getFingerprint("", "width");
+
+ if (attr.getValueByFingerprint(widthFingerprint) == null) {
+ attr.addAttribute(widthFingerprint, "CDATA", width[numColumns++]);
+ } else {
+ attr.setAttribute(widthFingerprint, "CDATA", width[numColumns++]);
+ }
+ attributes = attr;
+ } else if (thisFingerprint == foColFingerprint) {
+ AttributeCollection attr = new AttributeCollection(namePool, attributes);
+ int widthFingerprint = namePool.getFingerprint("", "column-width");
+
+ if (attr.getValueByFingerprint(widthFingerprint) == null) {
+ attr.addAttribute(widthFingerprint, "CDATA", width[numColumns++]);
+ } else {
+ attr.setAttribute(widthFingerprint, "CDATA", width[numColumns++]);
+ }
+ attributes = attr;
+ }
+
+ rtfEmitter.startElement(nameCode, attributes, namespaces, nscount);
+ }
+}
+
+
--- /dev/null
+package com.nwalsh.saxon;
+
+import java.util.Stack;
+import java.util.StringTokenizer;
+import org.xml.sax.*;
+import org.w3c.dom.*;
+import javax.xml.transform.TransformerException;
+import com.icl.saxon.Context;
+import com.icl.saxon.expr.*;
+import com.icl.saxon.functions.Extensions;
+import com.icl.saxon.om.*;
+import com.icl.saxon.output.*;
+import com.icl.saxon.pattern.*;
+import com.icl.saxon.tree.*;
+
+/**
+ * <p>A Saxon 6.0 Emitter that clones its input.</p>
+ *
+ * <p>$Id$</p>
+ *
+ * <p>Copyright (C) 2000 Norman Walsh.</p>
+ *
+ * <p>This class provides a
+ * <a href="http://users.iclway.co.uk/mhkay/saxon/">Saxon 6.*</a>
+ * implementation of an emitter that manufactures a cloned result
+ * tree fragment.</p>
+ *
+ * <p>The purpose of this emitter is to provide something for
+ * CalloutEmitter and NumberLinesEmitter to extend.
+ * This emitter simply copies all input to a new result tree fragment.</p>
+ *
+ * <p><b>Change Log:</b></p>
+ * <dl>
+ * <dt>1.0</dt>
+ * <dd><p>Initial release.</p></dd>
+ * </dl>
+ *
+ * @see CalloutEmitter
+ * @see NumberLinesEmitter
+ *
+ * @author Norman Walsh
+ * <a href="mailto:ndw@nwalsh.com">ndw@nwalsh.com</a>
+ *
+ * @version $Id$
+ *
+ */
+public class CopyEmitter extends com.icl.saxon.output.Emitter {
+ /** The result tree fragment containing the copied fragment. */
+ protected FragmentValue rtf = null;
+ protected Emitter rtfEmitter = null;
+
+ /** <p>The namePool.</p>
+ *
+ * <p>Copied from the caller, it should be the runtime name pool.</p>
+ */
+ protected NamePool namePool = null;
+
+ /** <p>Constructor for the CopyEmitter.</p>
+ *
+ * @param namePool The name pool to use for constructing elements and attributes.
+ */
+ public CopyEmitter(NamePool namePool) {
+ rtf = new FragmentValue();
+ rtfEmitter = rtf.getEmitter();
+ this.namePool = namePool;
+ }
+
+ /**
+ * <p>Return the result tree fragment constructed by replaying events
+ * through this emitter.</p>
+ */
+ public FragmentValue getResultTreeFragment() {
+ return rtf;
+ }
+
+ /** Copy characters. */
+ public void characters(char[] chars, int start, int len)
+ throws TransformerException {
+ rtfEmitter.characters(chars, start, len);
+ }
+
+ /** Copy comments. */
+ public void comment(char[] chars, int start, int length)
+ throws TransformerException {
+ rtfEmitter.comment(chars, start, length);
+ }
+
+ /** Copy end document events. */
+ public void endDocument()
+ throws TransformerException {
+ rtfEmitter.endDocument();
+ }
+
+ /** Copy end element events. */
+ public void endElement(int nameCode)
+ throws TransformerException {
+ rtfEmitter.endElement(nameCode);
+ }
+
+ /** Copy processing instructions. */
+ public void processingInstruction(java.lang.String name,
+ java.lang.String data)
+ throws TransformerException {
+ rtfEmitter.processingInstruction(name, data);
+ }
+
+ /** Copy set document locator events. */
+ public void setDocumentLocator(org.xml.sax.Locator locator) {
+ rtfEmitter.setDocumentLocator(locator);
+ }
+
+ /** Copy set escaping events. */
+ public void setEscaping(boolean escaping)
+ throws TransformerException {
+ rtfEmitter.setEscaping(escaping);
+ }
+
+ /** Copy set name pool events. */
+ public void setNamePool(NamePool namePool) {
+ rtfEmitter.setNamePool(namePool);
+ }
+
+ /** Copy set unparsed entity events. */
+ public void setUnparsedEntity(java.lang.String name, java.lang.String uri)
+ throws TransformerException {
+ rtfEmitter.setUnparsedEntity(name, uri);
+ }
+
+ /** Copy set writer events. */
+ public void setWriter(java.io.Writer writer) {
+ rtfEmitter.setWriter(writer);
+ }
+
+ /** Copy start document events. */
+ public void startDocument()
+ throws TransformerException {
+ rtfEmitter.startDocument();
+ }
+
+ /** Copy start element events. */
+ public void startElement(int nameCode,
+ org.xml.sax.Attributes attributes,
+ int[] namespaces,
+ int nscount)
+ throws TransformerException {
+ rtfEmitter.startElement(nameCode, attributes, namespaces, nscount);
+ }
+}
--- /dev/null
+package com.nwalsh.saxon;
+
+import org.xml.sax.SAXException;
+import org.w3c.dom.*;
+
+import javax.xml.transform.TransformerException;
+
+import com.icl.saxon.om.NamePool;
+import com.icl.saxon.output.Emitter;
+import com.icl.saxon.tree.AttributeCollection;
+
+import com.nwalsh.saxon.Callout;
+
+/**
+ * <p>Utility class for the Verbatim extension (ignore this).</p>
+ *
+ * <p>$Id$</p>
+ *
+ * <p>Copyright (C) 2000, 2001 Norman Walsh.</p>
+ *
+ * <p><b>Change Log:</b></p>
+ * <dl>
+ * <dt>1.0</dt>
+ * <dd><p>Initial release.</p></dd>
+ * </dl>
+ *
+ * @author Norman Walsh
+ * <a href="mailto:ndw@nwalsh.com">ndw@nwalsh.com</a>
+ *
+ * @see Verbatim
+ *
+ * @version $Id$
+ **/
+
+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 foStylesheet = false;
+ protected NamePool namePool = null;
+
+ public FormatCallout(NamePool nPool, boolean fo) {
+ namePool = nPool;
+ foStylesheet = fo;
+ }
+
+ public String areaLabel(Element area) {
+ String label = null;
+
+ if (area.getAttribute("label") != null) {
+ // If this area has a label, use it
+ label = area.getAttribute("label");
+ } else {
+ // Otherwise, if its parent is an areaset and it has a label, use that
+ Element parent = (Element) area.getParentNode();
+ if (parent != null
+ && parent.getLocalName().equalsIgnoreCase("areaset")
+ && parent.getAttribute("label") != null) {
+ label = parent.getAttribute("label");
+ }
+ }
+
+ return label;
+ }
+
+ public void startSpan(Emitter rtf)
+ throws TransformerException {
+ // no point in doing this for FO, right?
+ if (!foStylesheet && namePool != null) {
+ int spanName = namePool.allocate("", "", "span");
+ AttributeCollection spanAttr = new AttributeCollection(namePool);
+ int namespaces[] = new int[1];
+ spanAttr.addAttribute("", "", "class", "CDATA", "co");
+ rtf.startElement(spanName, spanAttr, namespaces, 0);
+ }
+ }
+
+ public void endSpan(Emitter rtf)
+ throws TransformerException {
+ // no point in doing this for FO, right?
+ if (!foStylesheet && namePool != null) {
+ int spanName = namePool.allocate("", "", "span");
+ rtf.endElement(spanName);
+ }
+ }
+
+ public void formatTextCallout(Emitter rtfEmitter,
+ Callout callout) {
+ Element area = callout.getArea();
+ int num = callout.getCallout();
+ String userLabel = areaLabel(area);
+ String label = "(" + num + ")";
+
+ if (userLabel != null) {
+ label = userLabel;
+ }
+
+ char chars[] = label.toCharArray();
+
+ try {
+ startSpan(rtfEmitter);
+ rtfEmitter.characters(chars, 0, label.length());
+ endSpan(rtfEmitter);
+ } catch (TransformerException e) {
+ System.out.println("Transformer Exception in formatTextCallout");
+ }
+ }
+
+ public abstract void formatCallout(Emitter rtfEmitter,
+ Callout callout);
+}
+
--- /dev/null
+package com.nwalsh.saxon;
+
+import org.xml.sax.SAXException;
+import org.w3c.dom.*;
+
+import javax.xml.transform.TransformerException;
+
+import com.icl.saxon.om.NamePool;
+import com.icl.saxon.output.Emitter;
+import com.icl.saxon.tree.AttributeCollection;
+
+import com.nwalsh.saxon.Callout;
+
+/**
+ * <p>Utility class for the Verbatim extension (ignore this).</p>
+ *
+ * <p>$Id$</p>
+ *
+ * <p>Copyright (C) 2000, 2001 Norman Walsh.</p>
+ *
+ * <p><b>Change Log:</b></p>
+ * <dl>
+ * <dt>1.0</dt>
+ * <dd><p>Initial release.</p></dd>
+ * </dl>
+ *
+ * @author Norman Walsh
+ * <a href="mailto:ndw@nwalsh.com">ndw@nwalsh.com</a>
+ *
+ * @see Verbatim
+ *
+ * @version $Id$
+ **/
+
+public class FormatDingbatCallout extends FormatCallout {
+ int graphicsMax = 0;
+
+ public FormatDingbatCallout(NamePool nPool, int max, boolean fo) {
+ super(nPool, fo);
+ graphicsMax = max;
+ }
+
+ public void formatCallout(Emitter rtfEmitter,
+ Callout callout) {
+ Element area = callout.getArea();
+ int num = callout.getCallout();
+ String userLabel = areaLabel(area);
+ String label = "";
+
+ if (userLabel != null) {
+ label = userLabel;
+ }
+
+ try {
+ if (userLabel == null && num <= graphicsMax) {
+ int inName = 0;
+ AttributeCollection inAttr = null;
+ int namespaces[] = new int[1];
+
+ if (foStylesheet) {
+ inName = namePool.allocate("fo", foURI, "inline");
+ inAttr = new AttributeCollection(namePool);
+ inAttr.addAttribute("", "", "font-family", "CDATA", "ZapfDingbats");
+ } else {
+ inName = namePool.allocate("", "", "font");
+ inAttr = new AttributeCollection(namePool);
+ inAttr.addAttribute("", "", "face", "CDATA", "ZapfDingbats");
+ }
+
+ startSpan(rtfEmitter);
+ rtfEmitter.startElement(inName, inAttr, namespaces, 0);
+
+ char chars[] = new char[1];
+ chars[0] = (char) (0x2775 + num);
+ rtfEmitter.characters(chars, 0, 1);
+
+ rtfEmitter.endElement(inName);
+ endSpan(rtfEmitter);
+ } else {
+ formatTextCallout(rtfEmitter, callout);
+ }
+ } catch (TransformerException e) {
+ System.out.println("Transformer Exception in graphic formatCallout");
+ }
+ }
+}
--- /dev/null
+package com.nwalsh.saxon;
+
+import org.xml.sax.SAXException;
+import org.w3c.dom.*;
+
+import javax.xml.transform.TransformerException;
+
+import com.icl.saxon.om.NamePool;
+import com.icl.saxon.output.Emitter;
+import com.icl.saxon.tree.AttributeCollection;
+
+import com.nwalsh.saxon.Callout;
+
+/**
+ * <p>Utility class for the Verbatim extension (ignore this).</p>
+ *
+ * <p>$Id$</p>
+ *
+ * <p>Copyright (C) 2000, 2001 Norman Walsh.</p>
+ *
+ * <p><b>Change Log:</b></p>
+ * <dl>
+ * <dt>1.0</dt>
+ * <dd><p>Initial release.</p></dd>
+ * </dl>
+ *
+ * @author Norman Walsh
+ * <a href="mailto:ndw@nwalsh.com">ndw@nwalsh.com</a>
+ *
+ * @see Verbatim
+ *
+ * @version $Id$
+ **/
+
+public class FormatGraphicCallout extends FormatCallout {
+ String graphicsPath = "";
+ String graphicsExt = "";
+ int graphicsMax = 0;
+
+ public FormatGraphicCallout(NamePool nPool, String path, String ext, int max, boolean fo) {
+ super(nPool, fo);
+ graphicsPath = path;
+ graphicsExt = ext;
+ graphicsMax = max;
+ }
+
+ public void formatCallout(Emitter rtfEmitter,
+ Callout callout) {
+ Element area = callout.getArea();
+ int num = callout.getCallout();
+ String userLabel = areaLabel(area);
+ String label = "(" + num + ")";
+
+ if (userLabel != null) {
+ label = userLabel;
+ }
+
+ try {
+ if (userLabel == null && num <= graphicsMax) {
+ int imgName = 0;
+ AttributeCollection imgAttr = null;
+ int namespaces[] = new int[1];
+
+ if (foStylesheet) {
+ imgName = namePool.allocate("fo", foURI, "external-graphic");
+ imgAttr = new AttributeCollection(namePool);
+ imgAttr.addAttribute("", "", "src", "CDATA",
+ graphicsPath + num + graphicsExt);
+ } else {
+ imgName = namePool.allocate("", "", "img");
+ imgAttr = new AttributeCollection(namePool);
+ imgAttr.addAttribute("", "", "src", "CDATA",
+ graphicsPath + num + graphicsExt);
+ imgAttr.addAttribute("", "", "alt", "CDATA", label);
+ }
+
+ startSpan(rtfEmitter);
+ rtfEmitter.startElement(imgName, imgAttr, namespaces, 0);
+ rtfEmitter.endElement(imgName);
+ endSpan(rtfEmitter);
+ } else {
+ formatTextCallout(rtfEmitter, callout);
+ }
+ } catch (TransformerException e) {
+ System.out.println("Transformer Exception in graphic formatCallout");
+ }
+ }
+}
--- /dev/null
+package com.nwalsh.saxon;
+
+import org.xml.sax.SAXException;
+import org.w3c.dom.*;
+
+import javax.xml.transform.TransformerException;
+
+import com.icl.saxon.om.NamePool;
+import com.icl.saxon.output.Emitter;
+
+import com.nwalsh.saxon.Callout;
+
+/**
+ * <p>Utility class for the Verbatim extension (ignore this).</p>
+ *
+ * <p>$Id$</p>
+ *
+ * <p>Copyright (C) 2000, 2001 Norman Walsh.</p>
+ *
+ * <p><b>Change Log:</b></p>
+ * <dl>
+ * <dt>1.0</dt>
+ * <dd><p>Initial release.</p></dd>
+ * </dl>
+ *
+ * @author Norman Walsh
+ * <a href="mailto:ndw@nwalsh.com">ndw@nwalsh.com</a>
+ *
+ * @see Verbatim
+ *
+ * @version $Id$
+ **/
+
+public class FormatTextCallout extends FormatCallout {
+ public FormatTextCallout(NamePool nPool, boolean fo) {
+ super(nPool, fo);
+ }
+
+ public void formatCallout(Emitter rtfEmitter,
+ Callout callout) {
+ formatTextCallout(rtfEmitter, callout);
+ }
+}
--- /dev/null
+package com.nwalsh.saxon;
+
+import org.xml.sax.SAXException;
+import org.w3c.dom.*;
+
+import javax.xml.transform.TransformerException;
+
+import com.icl.saxon.om.NamePool;
+import com.icl.saxon.output.Emitter;
+import com.icl.saxon.tree.AttributeCollection;
+
+import com.nwalsh.saxon.Callout;
+
+/**
+ * <p>Utility class for the Verbatim extension (ignore this).</p>
+ *
+ * <p>$Id$</p>
+ *
+ * <p>Copyright (C) 2000, 2001 Norman Walsh.</p>
+ *
+ * <p><b>Change Log:</b></p>
+ * <dl>
+ * <dt>1.0</dt>
+ * <dd><p>Initial release.</p></dd>
+ * </dl>
+ *
+ * @author Norman Walsh
+ * <a href="mailto:ndw@nwalsh.com">ndw@nwalsh.com</a>
+ *
+ * @see Verbatim
+ *
+ * @version $Id$
+ **/
+
+public class FormatUnicodeCallout extends FormatCallout {
+ int unicodeMax = 0;
+ int unicodeStart = 0;
+
+ public FormatUnicodeCallout(NamePool nPool, int start, int max, boolean fo) {
+ super(nPool, fo);
+ unicodeMax = max;
+ unicodeStart = start;
+ }
+
+ public void formatCallout(Emitter rtfEmitter,
+ Callout callout) {
+
+ Element area = callout.getArea();
+ int num = callout.getCallout();
+ String label = areaLabel(area);
+
+ try {
+ if (label == null && num <= unicodeMax) {
+ char chars[] = new char[1];
+ chars[0] = (char) (unicodeStart + num - 1);
+
+ startSpan(rtfEmitter);
+ rtfEmitter.characters(chars, 0, 1);
+ endSpan(rtfEmitter);
+ } else {
+ formatTextCallout(rtfEmitter, callout);
+ }
+ } catch (TransformerException e) {
+ System.out.println("Transformer Exception in graphic formatCallout");
+ }
+ }
+}
--- /dev/null
+package com.nwalsh.saxon;
+
+import org.xml.sax.*;
+import javax.xml.transform.TransformerException;
+import com.icl.saxon.output.*;
+import com.icl.saxon.om.*;
+import com.icl.saxon.expr.FragmentValue;
+
+/**
+ * <p>Saxon extension to count the lines in a result tree fragment.</p>
+ *
+ * <p>$Id$</p>
+ *
+ * <p>Copyright (C) 2000 Norman Walsh.</p>
+ *
+ * <p>This class provides a
+ * <a href="http://users.iclway.co.uk/mhkay/saxon/">Saxon 6.*</a>
+ * implementation to count the number of lines in a result tree
+ * fragment.</p>
+ *
+ * <p>The general design is this: the stylesheets construct a result tree
+ * fragment for some verbatim environment. That result tree fragment
+ * is "replayed" through the LineCountEmitter; the LineCountEmitter watches
+ * characters go by and counts the number of line feeds that it sees.
+ * That number is then returned.</p>
+ *
+ * <p><b>Change Log:</b></p>
+ * <dl>
+ * <dt>1.0</dt>
+ * <dd><p>Initial release.</p></dd>
+ * </dl>
+ *
+ * @see Verbatim
+ *
+ * @author Norman Walsh
+ * <a href="mailto:ndw@nwalsh.com">ndw@nwalsh.com</a>
+ *
+ * @version $Id$
+ *
+ */
+public class LineCountEmitter extends com.icl.saxon.output.Emitter {
+ /** The number of lines seen. */
+ protected int numLines = 0;
+
+ /** Construct a new LineCountEmitter. */
+ public LineCountEmitter() {
+ numLines = 0;
+ }
+
+ /** Reset the number of lines. */
+ public void reset() {
+ numLines = 0;
+ }
+
+ /** Return the number of lines. */
+ public int lineCount() {
+ return numLines;
+ }
+
+ /** Process characters. */
+ public void characters(char[] chars, int start, int len)
+ throws javax.xml.transform.TransformerException {
+
+ if (numLines == 0) {
+ // If there are any characters at all, there's at least one line
+ numLines++;
+ }
+
+ for (int count = start; count < start+len; count++) {
+ if (chars[count] == '\n') {
+ numLines++;
+ }
+ }
+ }
+
+ /** Discarded. */
+ public void comment(char[] chars, int start, int length)
+ throws javax.xml.transform.TransformerException {
+ // nop
+ }
+
+ /** Discarded. */
+ public void endDocument()
+ throws javax.xml.transform.TransformerException {
+ // nop
+ }
+
+ /** Discarded. */
+ public void endElement(int nameCode)
+ throws javax.xml.transform.TransformerException {
+ // nop
+ }
+
+ /** Discarded. */
+ public void processingInstruction(java.lang.String name,
+ java.lang.String data)
+ throws javax.xml.transform.TransformerException {
+ // nop
+ }
+
+ /** Discarded. */
+ public void setDocumentLocator(org.xml.sax.Locator locator) {
+ // nop
+ }
+
+ /** Discarded. */
+ public void setEscaping(boolean escaping)
+ throws javax.xml.transform.TransformerException {
+ // nop
+ }
+
+ /** Discarded. */
+ public void setNamePool(NamePool namePool) {
+ // nop
+ }
+
+ /** Discarded. */
+ public void setUnparsedEntity(java.lang.String name, java.lang.String uri)
+ throws javax.xml.transform.TransformerException {
+ // nop
+ }
+
+ /** Discarded. */
+ public void setWriter(java.io.Writer writer) {
+ // nop
+ }
+
+ /** Discarded. */
+ public void startDocument()
+ throws javax.xml.transform.TransformerException {
+ // nop
+ }
+
+ /** Discarded. */
+ public void startElement(int nameCode,
+ org.xml.sax.Attributes attributes,
+ int[] namespaces, int nscount)
+ throws javax.xml.transform.TransformerException {
+ // nop
+ }
+}
--- /dev/null
+package com.nwalsh.saxon;
+
+import java.util.Stack;
+import java.util.StringTokenizer;
+import org.xml.sax.*;
+import org.w3c.dom.*;
+import javax.xml.transform.TransformerException;
+import com.icl.saxon.output.*;
+import com.icl.saxon.om.*;
+import com.icl.saxon.tree.AttributeCollection;
+import com.icl.saxon.expr.FragmentValue;
+
+/**
+ * <p>Saxon extension to decorate a result tree fragment with line numbers.</p>
+ *
+ * <p>$Id$</p>
+ *
+ * <p>Copyright (C) 2000 Norman Walsh.</p>
+ *
+ * <p>This class provides the guts of a
+ * <a href="http://users.iclway.co.uk/mhkay/saxon/">Saxon 6.*</a>
+ * implementation of line numbering for verbatim environments. (It is used
+ * by the Verbatim class.)</p>
+ *
+ * <p>The general design is this: the stylesheets construct a result tree
+ * fragment for some verbatim environment. The Verbatim class initializes
+ * a NumberLinesEmitter with information about what lines should be
+ * numbered and how. Then the result tree fragment
+ * is "replayed" through the NumberLinesEmitter; the NumberLinesEmitter
+ * builds a
+ * new result tree fragment from this event stream, decorated with line
+ * numbers,
+ * and that is returned.</p>
+ *
+ * <p><b>Change Log:</b></p>
+ * <dl>
+ * <dt>1.0</dt>
+ * <dd><p>Initial release.</p></dd>
+ * </dl>
+ *
+ * @see Verbatim
+ *
+ * @author Norman Walsh
+ * <a href="mailto:ndw@nwalsh.com">ndw@nwalsh.com</a>
+ *
+ * @version $Id$
+ *
+ */
+public class NumberLinesEmitter extends CopyEmitter {
+ /** A stack for the preserving information about open elements. */
+ protected Stack elementStack = null;
+
+ /** The current line number. */
+ protected int lineNumber = 0;
+
+ /** Is the next element absolutely the first element in the fragment? */
+ protected boolean firstElement = false;
+
+ /** The FO namespace name. */
+ protected static String foURI = "http://www.w3.org/1999/XSL/Format";
+
+ /** Every <code>modulus</code> line will be numbered. */
+ protected int modulus = 5;
+
+ /** Line numbers are <code>width</code> characters wide. */
+ protected int width = 3;
+
+ /** Line numbers are separated from the listing by <code>separator</code>. */
+ protected String separator = " ";
+
+ /** Is the stylesheet currently running an FO stylesheet? */
+ protected boolean foStylesheet = false;
+
+ /** <p>Constructor for the NumberLinesEmitter.</p>
+ *
+ * @param namePool The name pool to use for constructing elements and attributes.
+ * @param modulus The modulus to use for this listing.
+ * @param width The width to use for line numbers in this listing.
+ * @param separator The separator to use for this listing.
+ * @param foStylesheet Is this an FO stylesheet?
+ */
+ public NumberLinesEmitter(NamePool namePool,
+ int modulus,
+ int width,
+ String separator,
+ boolean foStylesheet) {
+ super(namePool);
+ elementStack = new Stack();
+ firstElement = true;
+
+ this.modulus = modulus;
+ this.width = width;
+ this.separator = separator;
+ this.foStylesheet = foStylesheet;
+ }
+
+ /** Process characters. */
+ public void characters(char[] chars, int start, int len)
+ throws TransformerException {
+
+ // If we hit characters, then there's no first element...
+ firstElement = false;
+
+ if (lineNumber == 0) {
+ // The first line is always numbered
+ formatLineNumber(++lineNumber);
+ }
+
+ // Walk through the text node looking for newlines
+ char[] newChars = new char[len];
+ int pos = 0;
+ for (int count = start; count < start+len; count++) {
+ if (chars[count] == '\n') {
+ // This is the tricky bit; if we find a newline, make sure
+ // it doesn't occur inside any markup.
+
+ if (pos > 0) {
+ // Output any characters that preceded this newline
+ rtfEmitter.characters(newChars, 0, pos);
+ pos = 0;
+ }
+
+ // Close all the open elements...
+ Stack tempStack = new Stack();
+ while (!elementStack.empty()) {
+ StartElementInfo elem = (StartElementInfo) elementStack.pop();
+ rtfEmitter.endElement(elem.getNameCode());
+ tempStack.push(elem);
+ }
+
+ // Copy the newline to the output
+ newChars[pos++] = chars[count];
+ rtfEmitter.characters(newChars, 0, pos);
+ pos = 0;
+
+ // Add the line number
+ formatLineNumber(++lineNumber);
+
+ // Now "reopen" the elements that we closed...
+ while (!tempStack.empty()) {
+ StartElementInfo elem = (StartElementInfo) tempStack.pop();
+ AttributeCollection attr = (AttributeCollection)elem.getAttributes();
+ AttributeCollection newAttr = new AttributeCollection(namePool);
+
+ for (int acount = 0; acount < attr.getLength(); acount++) {
+ String localName = attr.getLocalName(acount);
+ int nameCode = attr.getNameCode(acount);
+ String type = attr.getType(acount);
+ String value = attr.getValue(acount);
+ String uri = attr.getURI(acount);
+ String prefix = "";
+
+ if (localName.indexOf(':') > 0) {
+ prefix = localName.substring(0, localName.indexOf(':'));
+ localName = localName.substring(localName.indexOf(':')+1);
+ }
+
+ if (uri.equals("")
+ && ((foStylesheet
+ && localName.equals("id"))
+ || (!foStylesheet
+ && (localName.equals("id")
+ || localName.equals("name"))))) {
+ // skip this attribute
+ } else {
+ newAttr.addAttribute(prefix, uri, localName, type, value);
+ }
+ }
+
+ rtfEmitter.startElement(elem.getNameCode(),
+ newAttr,
+ elem.getNamespaces(),
+ elem.getNSCount());
+
+ elementStack.push(elem);
+ }
+ } else {
+ newChars[pos++] = chars[count];
+ }
+ }
+
+ if (pos > 0) {
+ rtfEmitter.characters(newChars, 0, pos);
+ pos = 0;
+ }
+ }
+
+ /**
+ * <p>Add a formatted line number to the result tree fragment.</p>
+ *
+ * @param lineNumber The number of the current line.
+ */
+ protected void formatLineNumber(int lineNumber)
+ throws TransformerException {
+
+ char ch = 160; //
+
+ String lno = "";
+ if (lineNumber == 1
+ || (modulus >= 1 && (lineNumber % modulus == 0))) {
+ lno = "" + lineNumber;
+ }
+
+ while (lno.length() < width) {
+ lno = ch + lno;
+ }
+
+ lno += separator;
+
+ char chars[] = new char[lno.length()];
+ for (int count = 0; count < lno.length(); count++) {
+ chars[count] = lno.charAt(count);
+ }
+
+ characters(chars, 0, lno.length());
+ }
+
+ /** Process end element events. */
+ public void endElement(int nameCode)
+ throws TransformerException {
+ if (!elementStack.empty()) {
+ // if we didn't push the very first element (an fo:block or
+ // pre or div surrounding the whole block), then the stack will
+ // be empty when we get to the end of the first element...
+ elementStack.pop();
+ }
+ rtfEmitter.endElement(nameCode);
+ }
+
+ /** Process start element events. */
+ public void startElement(int nameCode,
+ org.xml.sax.Attributes attributes,
+ int[] namespaces,
+ int nscount)
+ throws TransformerException {
+
+ if (!skipThisElement(nameCode)) {
+ StartElementInfo sei = new StartElementInfo(nameCode, attributes,
+ namespaces, nscount);
+ elementStack.push(sei);
+ }
+
+ firstElement = false;
+
+ rtfEmitter.startElement(nameCode, attributes, namespaces, nscount);
+ }
+
+ /**
+ * <p>Protect the outer-most block wrapper.</p>
+ *
+ * <p>Open elements in the result tree fragment are closed and reopened
+ * around callouts (so that callouts don't appear inside links or other
+ * environments). But if the result tree fragment is a single block
+ * (a div or pre in HTML, an fo:block in FO), that outer-most block is
+ * treated specially.</p>
+ *
+ * <p>This method returns true if the element in question is that
+ * outermost block.</p>
+ *
+ * @param nameCode The name code for the element
+ *
+ * @return True if the element is the outer-most block, false otherwise.
+ */
+ protected boolean skipThisElement(int nameCode) {
+ if (firstElement) {
+ int thisFingerprint = namePool.getFingerprint(nameCode);
+ int foBlockFingerprint = namePool.getFingerprint(foURI, "block");
+ int htmlPreFingerprint = namePool.getFingerprint("", "pre");
+ int htmlDivFingerprint = namePool.getFingerprint("", "div");
+
+ if ((foStylesheet && thisFingerprint == foBlockFingerprint)
+ || (!foStylesheet && (thisFingerprint == htmlPreFingerprint
+ || thisFingerprint == htmlDivFingerprint))) {
+ // Don't push the outer-most wrapping div, pre, or fo:block
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * <p>A private class for maintaining the information required to call
+ * the startElement method.</p>
+ *
+ * <p>In order to close and reopen elements, information about those
+ * elements has to be maintained. This class is just the little record
+ * that we push on the stack to keep track of that info.</p>
+ */
+ private class StartElementInfo {
+ private int _nameCode;
+ org.xml.sax.Attributes _attributes;
+ int[] _namespaces;
+ int _nscount;
+
+ public StartElementInfo(int nameCode,
+ org.xml.sax.Attributes attributes,
+ int[] namespaces,
+ int nscount) {
+ _nameCode = nameCode;
+ _attributes = attributes;
+ _namespaces = namespaces;
+ _nscount = nscount;
+ }
+
+ public int getNameCode() {
+ return _nameCode;
+ }
+
+ public org.xml.sax.Attributes getAttributes() {
+ return _attributes;
+ }
+
+ public int[] getNamespaces() {
+ return _namespaces;
+ }
+
+ public int getNSCount() {
+ return _nscount;
+ }
+ }
+}
--- /dev/null
+// Verbatim.java - Saxon extensions supporting DocBook verbatim environments
+
+package com.nwalsh.saxon;
+
+import java.util.Hashtable;
+import org.xml.sax.*;
+import org.w3c.dom.*;
+import javax.xml.transform.TransformerException;
+import com.icl.saxon.expr.*;
+import com.icl.saxon.om.*;
+import com.icl.saxon.pattern.*;
+import com.icl.saxon.Context;
+import com.icl.saxon.tree.*;
+import com.icl.saxon.functions.Extensions;
+
+/**
+ * <p>Saxon extensions supporting Tables</p>
+ *
+ * <p>$Id$</p>
+ *
+ * <p>Copyright (C) 2000 Norman Walsh.</p>
+ *
+ * <p>This class provides a
+ * <a href="http://users.iclway.co.uk/mhkay/saxon/">Saxon</a>
+ * implementation of some code to adjust CALS Tables to HTML
+ * Tables.</p>
+ *
+ * <p><b>Column Widths</b></p>
+ * <p>The <tt>adjustColumnWidths</tt> method takes a result tree
+ * fragment (assumed to contain the colgroup of an HTML Table)
+ * and returns the result tree fragment with the column widths
+ * adjusted to HTML terms.</p>
+ *
+ * <p><b>Convert Lengths</b></p>
+ * <p>The <tt>convertLength</tt> method takes a length specification
+ * of the form 9999.99xx (where "xx" is a unit) and returns that length
+ * as an integral number of pixels. For convenience, percentage lengths
+ * are returned unchanged.</p>
+ * <p>The recognized units are: inches (in), centimeters (cm),
+ * millimeters (mm), picas (pc, 1pc=12pt), points (pt), and pixels (px).
+ * A number with no units is assumed to be pixels.</p>
+ *
+ * <p><b>Change Log:</b></p>
+ * <dl>
+ * <dt>1.0</dt>
+ * <dd><p>Initial release.</p></dd>
+ * </dl>
+ *
+ * @author Norman Walsh
+ * <a href="mailto:ndw@nwalsh.com">ndw@nwalsh.com</a>
+ *
+ * @version $Id$
+ *
+ */
+public class Table {
+ /** The number of pixels per inch */
+ private static int pixelsPerInch = 96;
+
+ /** The nominal table width (6in by default). */
+ private static int nominalWidth = 6 * pixelsPerInch;
+
+ /** The default table width (100% by default). */
+ private static String tableWidth = "100%";
+
+ /** Is this an FO stylesheet? */
+ private static boolean foStylesheet = false;
+
+ /** The hash used to associate units with a length in pixels. */
+ protected static Hashtable unitHash = null;
+
+ /**
+ * <p>Constructor for Verbatim</p>
+ *
+ * <p>All of the methods are static, so the constructor does nothing.</p>
+ */
+ public Table() {
+ }
+
+ /** Initialize the internal hash table with proper values. */
+ protected static void initializeHash() {
+ unitHash = new Hashtable();
+ unitHash.put("in", new Float(pixelsPerInch));
+ unitHash.put("cm", new Float(pixelsPerInch / 2.54));
+ unitHash.put("mm", new Float(pixelsPerInch / 25.4));
+ unitHash.put("pc", new Float((pixelsPerInch / 72) * 12));
+ unitHash.put("pt", new Float(pixelsPerInch / 72));
+ unitHash.put("px", new Float(1));
+ }
+
+ /** Set the pixels-per-inch value. Only positive values are legal. */
+ public static void setPixelsPerInch(int value) {
+ if (value > 0) {
+ pixelsPerInch = value;
+ initializeHash();
+ }
+ }
+
+ /** Return the current pixels-per-inch value. */
+ public int getPixelsPerInch() {
+ return pixelsPerInch;
+ }
+
+ /**
+ * <p>Convert a length specification to a number of pixels.</p>
+ *
+ * <p>The specified length should be of the form [+/-]999.99xx,
+ * where xx is a valid unit.</p>
+ */
+ public static int convertLength(String length) {
+ // The format of length should be 999.999xx
+ int sign = 1;
+ String digits = "";
+ String units = "";
+ char lench[] = length.toCharArray();
+ float flength = 0;
+ boolean done = false;
+ int pos = 0;
+ float factor = 1;
+ int pixels = 0;
+
+ if (unitHash == null) {
+ initializeHash();
+ }
+
+ if (lench[pos] == '+' || lench[pos] == '-') {
+ if (lench[pos] == '-') {
+ sign = -1;
+ }
+ pos++;
+ }
+
+ while (!done) {
+ if (pos >= lench.length) {
+ done = true;
+ } else {
+ if ((lench[pos] > '9' || lench[pos] < '0') && lench[pos] != '.') {
+ done = true;
+ units = length.substring(pos);
+ } else {
+ digits += lench[pos++];
+ }
+ }
+ }
+
+ try {
+ flength = Float.parseFloat(digits);
+ } catch (NumberFormatException e) {
+ System.out.println(digits + " is not a number; 1 used instead.");
+ flength = 1;
+ }
+
+ Float f = null;
+
+ if (!units.equals("")) {
+ f = (Float) unitHash.get(units);
+ if (f == null) {
+ System.out.println(units + " is not a known unit; 1 used instead.");
+ factor = 1;
+ } else {
+ factor = f.floatValue();
+ }
+ } else {
+ factor = 1;
+ }
+
+ f = new Float(flength * factor);
+
+ pixels = f.intValue() * sign;
+
+ return pixels;
+ }
+
+ /**
+ * <p>Find the string value of a stylesheet variable or parameter</p>
+ *
+ * <p>Returns the string value of <code>varName</code> in the current
+ * <code>context</code>. Returns the empty string if the variable is
+ * not defined.</p>
+ *
+ * @param context The current stylesheet context
+ * @param varName The name of the variable (without the dollar sign)
+ *
+ * @return The string value of the variable
+ */
+ protected static String getVariable(Context context, String varName)
+ throws TransformerException {
+ Value variable = null;
+ String varString = null;
+
+ try {
+ variable = Extensions.evaluate(context, "$" + varName);
+ varString = variable.asString();
+ return varString;
+ } catch (IllegalArgumentException e) {
+ System.out.println("Undefined variable: " + varName);
+ return "";
+ }
+ }
+
+ /**
+ * <p>Setup the parameters associated with column width calculations</p>
+ *
+ * <p>This method queries the stylesheet for the variables
+ * associated with table column widths. It is called automatically before
+ * column widths are adjusted. The context is used to retrieve the values,
+ * this allows templates to redefine these variables.</p>
+ *
+ * <p>The following variables are queried. If the variables do not
+ * exist, builtin defaults will be used (but you may also get a bunch
+ * of messages from the Java interpreter).</p>
+ *
+ * <dl>
+ * <dt><code>nominal.table.width</code></dt>
+ * <dd>The "normal" width for tables. This must be an absolute length.</dd>
+ * <dt><code>table.width</code></dt>
+ * <dd>The width for tables. This may be either an absolute
+ * length or a percentage.</dd>
+ * </dl>
+ *
+ * @param context The current stylesheet context
+ *
+ */
+ private static void setupColumnWidths(Context context) {
+ // Hardcoded defaults
+ nominalWidth = 6 * pixelsPerInch;
+ tableWidth = "100%";
+
+ String varString = null;
+
+ try {
+ // Get the stylesheet type
+ varString = getVariable(context, "stylesheet.result.type");
+ foStylesheet = varString.equals("fo");
+
+ // Get the nominal table width
+ varString = getVariable(context, "nominal.table.width");
+ nominalWidth = convertLength(varString);
+
+ // Get the table width
+ varString = getVariable(context, "table.width");
+ tableWidth = varString;
+ } catch (TransformerException e) {
+ //nop, can't happen
+ }
+ }
+
+ /**
+ * <p>Adjust column widths in an HTML table.</p>
+ *
+ * <p>The specification of column widths in CALS (a relative width
+ * plus an optional absolute width) are incompatible with HTML column
+ * widths. This method adjusts CALS column width specifiers in an
+ * attempt to produce equivalent HTML specifiers.</p>
+ *
+ * <p>In order for this method to work, the CALS width specifications
+ * should be placed in the "width" attribute of the <col>s within
+ * a <colgroup>. Then the colgroup result tree fragment is passed
+ * to this method.</p>
+ *
+ * <p>This method makes use of two parameters from the XSL stylesheet
+ * that calls it: <code>nominal.table.width</code> and
+ * <code>table.width</code>. The value of <code>nominal.table.width</code>
+ * must be an absolute distance. The value of <code>table.width</code>
+ * can be either absolute or relative.</p>
+ *
+ * <p>Presented with a mixture of relative and
+ * absolute lengths, the table width is used to calculate
+ * appropriate values. If the <code>table.width</code> is relative,
+ * the nominal width is used for this calculation.</p>
+ *
+ * <p>There are three possible combinations of values:</p>
+ *
+ * <ol>
+ * <li>There are no relative widths; in this case the absolute widths
+ * are used in the HTML table.</li>
+ * <li>There are no absolute widths; in this case the relative widths
+ * are used in the HTML table.</li>
+ * <li>There are a mixture of absolute and relative widths:
+ * <ol>
+ * <li>If the table width is absolute, all widths become absolute.</li>
+ * <li>If the table width is relative, make all the widths absolute
+ * relative to the nominal table width then turn them all
+ * back into relative widths.</li>
+ * </ol>
+ * </li>
+ * </ol>
+ *
+ * @param context The stylesheet context; supplied automatically by Saxon
+ * @param rtf The result tree fragment containing the colgroup.
+ *
+ * @return The result tree fragment containing the adjusted colgroup.
+ *
+ */
+ public static NodeSetValue adjustColumnWidths (Context context,
+ NodeSetValue rtf_ns) {
+
+ FragmentValue rtf = (FragmentValue) rtf_ns;
+
+ setupColumnWidths(context);
+
+ try {
+ NamePool namePool = context.getController().getNamePool();
+
+ ColumnScanEmitter csEmitter = new ColumnScanEmitter(namePool);
+ rtf.replay(csEmitter);
+
+ int numColumns = csEmitter.columnCount();
+ String widths[] = csEmitter.columnWidths();
+
+ float relTotal = 0;
+ float relParts[] = new float[numColumns];
+
+ float absTotal = 0;
+ float absParts[] = new float[numColumns];
+
+ for (int count = 0; count < numColumns; count++) {
+ String width = widths[count];
+
+ int pos = width.indexOf("*");
+ if (pos >= 0) {
+ String relPart = width.substring(0, pos);
+ String absPart = width.substring(pos+1);
+
+ try {
+ float rel = Float.parseFloat(relPart);
+ relTotal += rel;
+ relParts[count] = rel;
+ } catch (NumberFormatException e) {
+ System.out.println(relPart + " is not a valid relative unit.");
+ }
+
+ int pixels = 0;
+ if (absPart != null && !absPart.equals("")) {
+ pixels = convertLength(absPart);
+ }
+
+ absTotal += pixels;
+ absParts[count] = pixels;
+ } else {
+ relParts[count] = 0;
+
+ int pixels = 0;
+ if (width != null && !width.equals("")) {
+ pixels = convertLength(width);
+ }
+
+ absTotal += pixels;
+ absParts[count] = pixels;
+ }
+ }
+
+ // Ok, now we have the relative widths and absolute widths in
+ // two parallel arrays.
+ //
+ // - If there are no relative widths, output the absolute widths
+ // - If there are no absolute widths, output the relative widths
+ // - If there are a mixture of relative and absolute widths,
+ // - If the table width is absolute, turn these all into absolute
+ // widths.
+ // - If the table width is relative, turn these all into absolute
+ // widths in the nominalWidth and then turn them back into
+ // percentages.
+
+ if (relTotal == 0) {
+ for (int count = 0; count < numColumns; count++) {
+ Float f = new Float(absParts[count]);
+ if (foStylesheet) {
+ int pixels = f.intValue();
+ float inches = (float) pixels / pixelsPerInch;
+ widths[count] = inches + "in";
+ } else {
+ widths[count] = Integer.toString(f.intValue());
+ }
+ }
+ } else if (absTotal == 0) {
+ for (int count = 0; count < numColumns; count++) {
+ float rel = relParts[count] / relTotal * 100;
+ Float f = new Float(rel);
+ widths[count] = Integer.toString(f.intValue()) + "%";
+ }
+ } else {
+ int pixelWidth = nominalWidth;
+
+ if (tableWidth.indexOf("%") <= 0) {
+ pixelWidth = convertLength(tableWidth);
+ }
+
+ if (pixelWidth <= absTotal) {
+ System.out.println("Table is wider than table width.");
+ } else {
+ pixelWidth -= absTotal;
+ }
+
+ absTotal = 0;
+ for (int count = 0; count < numColumns; count++) {
+ float rel = relParts[count] / relTotal * pixelWidth;
+ relParts[count] = rel + absParts[count];
+ absTotal += rel + absParts[count];
+ }
+
+ if (tableWidth.indexOf("%") <= 0) {
+ for (int count = 0; count < numColumns; count++) {
+ Float f = new Float(relParts[count]);
+ if (foStylesheet) {
+ int pixels = f.intValue();
+ float inches = (float) pixels / pixelsPerInch;
+ widths[count] = inches + "in";
+ } else {
+ widths[count] = Integer.toString(f.intValue());
+ }
+ }
+ } else {
+ for (int count = 0; count < numColumns; count++) {
+ float rel = relParts[count] / absTotal * 100;
+ Float f = new Float(rel);
+ widths[count] = Integer.toString(f.intValue()) + "%";
+ }
+ }
+ }
+
+ ColumnUpdateEmitter cuEmitter = new ColumnUpdateEmitter(namePool,
+ widths);
+ rtf.replay(cuEmitter);
+ return cuEmitter.getResultTreeFragment();
+ } catch (TransformerException e) {
+ // This "can't" happen.
+ System.out.println("Transformer Exception in adjustColumnWidths");
+ return rtf;
+ }
+ }
+}
--- /dev/null
+// Text - Saxon extension element for inserting text
+
+package com.nwalsh.saxon;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.FileNotFoundException;
+import java.net.URL;
+import java.net.MalformedURLException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerConfigurationException;
+import com.icl.saxon.*;
+import com.icl.saxon.style.*;
+import com.icl.saxon.expr.*;
+import com.icl.saxon.output.*;
+import org.xml.sax.AttributeList;
+
+/**
+ * <p>Saxon extension element for inserting text
+ *
+ * <p>$Id$</p>
+ *
+ * <p>Copyright (C) 2000 Norman Walsh.</p>
+ *
+ * <p>This class provides a
+ * <a href="http://users.iclway.co.uk/mhkay/saxon/">Saxon</a>
+ * extension element for inserting text into a result tree.</p>
+ *
+ * <p><b>Change Log:</b></p>
+ * <dl>
+ * <dt>1.0</dt>
+ * <dd><p>Initial release.</p></dd>
+ * </dl>
+ *
+ * @author Norman Walsh
+ * <a href="mailto:ndw@nwalsh.com">ndw@nwalsh.com</a>
+ *
+ * @version $Id$
+ *
+ */
+public class Text extends StyleElement {
+ /**
+ * <p>Constructor for Text</p>
+ *
+ * <p>Does nothing.</p>
+ */
+ public Text() {
+ }
+
+ /**
+ * <p>Is this element an instruction?</p>
+ *
+ * <p>Yes, it is.</p>
+ *
+ * @return true
+ */
+ public boolean isInstruction() {
+ return true;
+ }
+
+ /**
+ * <p>Can this element contain a template-body?</p>
+ *
+ * <p>Yes, it can, but only so that it can contain xsl:fallback.</p>
+ *
+ * @return true
+ */
+ public boolean mayContainTemplateBody() {
+ return true;
+ }
+
+ /**
+ * <p>Validate the arguments</p>
+ *
+ * <p>The element must have an href attribute.</p>
+ */
+ public void prepareAttributes() throws TransformerConfigurationException {
+ // Get mandatory href attribute
+ String fnAtt = getAttribute("href");
+ if (fnAtt == null) {
+ reportAbsence("href");
+ }
+ }
+
+ /** Validate that the element occurs in a reasonable place. */
+ public void validate() throws TransformerConfigurationException {
+ checkWithinTemplate();
+ }
+
+ /**
+ * <p>Insert the text of the file into the result tree</p>
+ *
+ * <p>Processing this element inserts the contents of the URL named
+ * by the href attribute into the result tree as plain text.</p>
+ *
+ */
+ public void process( Context context ) throws TransformerException {
+ Outputter out = context.getOutputter();
+
+ String hrefAtt = getAttribute("href");
+ Expression hrefExpr = makeAttributeValueTemplate(hrefAtt);
+ String href = hrefExpr.evaluateAsString(context);
+ URL fileURL = null;
+
+ try {
+ try {
+ fileURL = new URL(href);
+ } catch (MalformedURLException e1) {
+ try {
+ fileURL = new URL("file:" + href);
+ } catch (MalformedURLException e2) {
+ System.out.println("Cannot open " + href);
+ return;
+ }
+ }
+
+ InputStreamReader isr = new InputStreamReader(fileURL.openStream());
+ BufferedReader is = new BufferedReader(isr);
+
+ char chars[] = new char[4096];
+ int len = 0;
+ while ((len = is.read(chars)) > 0) {
+ out.writeContent(chars, 0, len);
+ }
+ is.close();
+ } catch (Exception e) {
+ System.out.println("Cannot read " + href);
+ }
+ }
+}
--- /dev/null
+// TextFactory - Saxon extension element factory
+
+package com.nwalsh.saxon;
+
+import com.icl.saxon.style.ExtensionElementFactory;
+import org.xml.sax.SAXException;
+
+/**
+ * <p>Saxon extension element factory
+ *
+ * <p>$Id$</p>
+ *
+ * <p>Copyright (C) 2000 Norman Walsh.</p>
+ *
+ * <p>This class provides a
+ * <a href="http://users.iclway.co.uk/mhkay/saxon/">Saxon</a>
+ * extension element factory for the Text extension element
+ * family.</p>
+ *
+ * <p><b>Change Log:</b></p>
+ * <dl>
+ * <dt>1.0</dt>
+ * <dd><p>Initial release.</p></dd>
+ * </dl>
+ *
+ * @author Norman Walsh
+ * <a href="mailto:ndw@nwalsh.com">ndw@nwalsh.com</a>
+ *
+ * @version $Id$
+ *
+ * @see Text
+ *
+ */
+public class TextFactory implements ExtensionElementFactory {
+ /**
+ * <p>Constructor for TextFactory</p>
+ *
+ * <p>Does nothing.</p>
+ */
+ public TextFactory() {
+ }
+
+ /**
+ * <p>Return the class that implements a particular extension element.</p>
+ *
+ * @param localname The local name of the extension element.
+ *
+ * @return The class that handles that extension element.
+ *
+ * @exception SAXException("Unknown Text extension element")
+ */
+ public Class getExtensionClass(String localname) {
+ if (localname.equals("insertfile")) {
+ try {
+ return Class.forName("com.nwalsh.saxon.Text");
+ } catch (ClassNotFoundException e) {
+ return null;
+ }
+ }
+ return null;
+ }
+}
+
+
+
+
+
--- /dev/null
+// Verbatim.java - Saxon extensions supporting DocBook verbatim environments
+
+package com.nwalsh.saxon;
+
+import java.util.Stack;
+import java.util.StringTokenizer;
+import org.xml.sax.*;
+import org.w3c.dom.*;
+import javax.xml.transform.TransformerException;
+import com.icl.saxon.expr.*;
+import com.icl.saxon.om.*;
+import com.icl.saxon.pattern.*;
+import com.icl.saxon.Context;
+import com.icl.saxon.tree.*;
+import com.icl.saxon.functions.Extensions;
+import com.nwalsh.saxon.NumberLinesEmitter;
+import com.nwalsh.saxon.CalloutEmitter;
+
+/**
+ * <p>Saxon extensions supporting DocBook verbatim environments</p>
+ *
+ * <p>$Id$</p>
+ *
+ * <p>Copyright (C) 2000 Norman Walsh.</p>
+ *
+ * <p>This class provides a
+ * <a href="http://users.iclway.co.uk/mhkay/saxon/">Saxon</a>
+ * implementation of two features that would be impractical to
+ * implement directly in XSLT: line numbering and callouts.</p>
+ *
+ * <p><b>Line Numbering</b></p>
+ * <p>The <tt>numberLines</tt> method takes a result tree
+ * fragment (assumed to contain the contents of a formatted verbatim
+ * element in DocBook: programlisting, screen, address, literallayout,
+ * or synopsis) and returns a result tree fragment decorated with
+ * line numbers.</p>
+ *
+ * <p><b>Callouts</b></p>
+ * <p>The <tt>insertCallouts</tt> method takes an
+ * <tt>areaspec</tt> and a result tree fragment
+ * (assumed to contain the contents of a formatted verbatim
+ * element in DocBook: programlisting, screen, address, literallayout,
+ * or synopsis) and returns a result tree fragment decorated with
+ * callouts.</p>
+ *
+ * <p><b>Change Log:</b></p>
+ * <dl>
+ * <dt>1.0</dt>
+ * <dd><p>Initial release.</p></dd>
+ * </dl>
+ *
+ * @author Norman Walsh
+ * <a href="mailto:ndw@nwalsh.com">ndw@nwalsh.com</a>
+ *
+ * @version $Id$
+ *
+ */
+public class Verbatim {
+ /** True if the stylesheet is producing formatting objects */
+ private static boolean foStylesheet = false;
+ /** The modulus for line numbering (every 'modulus' line is numbered). */
+ private static int modulus = 0;
+ /** The width (in characters) of line numbers (for padding). */
+ private static int width = 0;
+ /** The separator between the line number and the verbatim text. */
+ private static String separator = "";
+
+ /** True if callouts have been setup */
+ private static boolean calloutsSetup = false;
+ /** The default column for callouts that have only a line or line range */
+ private static int defaultColumn = 60;
+ /** The path to use for graphical callout decorations. */
+ private static String graphicsPath = null;
+ /** The extension to use for graphical callout decorations. */
+ private static String graphicsExt = null;
+ /** The largest callout number that can be represented graphically. */
+ private static int graphicsMax = 10;
+
+ /** The FormatCallout object to use for formatting callouts. */
+ private static FormatCallout fCallout = null;
+
+ /**
+ * <p>Constructor for Verbatim</p>
+ *
+ * <p>All of the methods are static, so the constructor does nothing.</p>
+ */
+ public Verbatim() {
+ }
+
+ /**
+ * <p>Find the string value of a stylesheet variable or parameter</p>
+ *
+ * <p>Returns the string value of <code>varName</code> in the current
+ * <code>context</code>. Returns the empty string if the variable is
+ * not defined.</p>
+ *
+ * @param context The current stylesheet context
+ * @param varName The name of the variable (without the dollar sign)
+ *
+ * @return The string value of the variable
+ */
+ protected static String getVariable(Context context, String varName) {
+ Value variable = null;
+ String varString = null;
+
+ try {
+ variable = Extensions.evaluate(context, "$" + varName);
+ varString = variable.asString();
+ return varString;
+ } catch (TransformerException te) {
+ System.out.println("Undefined variable: " + varName);
+ return "";
+ } catch (IllegalArgumentException iae) {
+ System.out.println("Undefined variable: " + varName);
+ return "";
+ }
+ }
+
+ /**
+ * <p>Setup the parameters associated with line numbering</p>
+ *
+ * <p>This method queries the stylesheet for the variables
+ * associated with line numbering. It is called automatically before
+ * lines are numbered. The context is used to retrieve the values,
+ * this allows templates to redefine these variables.</p>
+ *
+ * <p>The following variables are queried. If the variables do not
+ * exist, builtin defaults will be used (but you may also get a bunch
+ * of messages from the Java interpreter).</p>
+ *
+ * <dl>
+ * <dt><code>linenumbering.everyNth</code></dt>
+ * <dd>Specifies the lines that will be numbered. The first line is
+ * always numbered. (builtin default: 5).</dd>
+ * <dt><code>linenumbering.width</code></dt>
+ * <dd>Specifies the width of the numbers. If the specified width is too
+ * narrow for the largest number needed, it will automatically be made
+ * wider. (builtin default: 3).</dd>
+ * <dt><code>linenumbering.separator</code></dt>
+ * <dd>Specifies the string that separates line numbers from lines
+ * in the program listing. (builtin default: " ").</dd>
+ * <dt><code>stylesheet.result.type</code></dt>
+ * <dd>Specifies the stylesheet result type. The value is either 'fo'
+ * (for XSL Formatting Objects) or it isn't. (builtin default: html).</dd>
+ * </dl>
+ *
+ * @param context The current stylesheet context
+ *
+ */
+ private static void setupLineNumbering(Context context) {
+ // Hardcoded defaults
+ modulus = 5;
+ width = 3;
+ separator = " ";
+ foStylesheet = false;
+
+ String varString = null;
+
+ // Get the modulus
+ varString = getVariable(context, "linenumbering.everyNth");
+ try {
+ modulus = Integer.parseInt(varString);
+ } catch (NumberFormatException nfe) {
+ System.out.println("$linenumbering.everyNth is not a number: " + varString);
+ }
+
+ // Get the width
+ varString = getVariable(context, "linenumbering.width");
+ try {
+ width = Integer.parseInt(varString);
+ } catch (NumberFormatException nfe) {
+ System.out.println("$linenumbering.width is not a number: " + varString);
+ }
+
+ // Get the separator
+ varString = getVariable(context, "linenumbering.separator");
+ separator = varString;
+
+ // Get the stylesheet type
+ varString = getVariable(context, "stylesheet.result.type");
+ foStylesheet = (varString.equals("fo"));
+ }
+
+ /**
+ * <p>Number lines in a verbatim environment</p>
+ *
+ * <p>The extension function expects the following variables to be
+ * available in the calling context: $linenumbering.everyNth,
+ * $linenumbering.width, $linenumbering.separator, and
+ * $stylesheet.result.type.</p>
+ *
+ * <p>This method adds line numbers to a result tree fragment. Each
+ * newline that occurs in a text node is assumed to start a new line.
+ * The first line is always numbered, every subsequent 'everyNth' line
+ * is numbered (so if everyNth=5, lines 1, 5, 10, 15, etc. will be
+ * numbered. If there are fewer than everyNth lines in the environment,
+ * every line is numbered.</p>
+ *
+ * <p>Every line number will be right justified in a string 'width'
+ * characters long. If the line number of the last line in the
+ * environment is too long to fit in the specified width, the width
+ * is automatically increased to the smallest value that can hold the
+ * number of the last line. (In other words, if you specify the value 2
+ * and attempt to enumerate the lines of an environment that is 100 lines
+ * long, the value 3 will automatically be used for every line in the
+ * environment.)</p>
+ *
+ * <p>The 'separator' string is inserted between the line
+ * number and the original program listing. Lines that aren't numbered
+ * are preceded by a 'width' blank string and the separator.</p>
+ *
+ * <p>If inline markup extends across line breaks, markup changes are
+ * required. All the open elements are closed before the line break and
+ * "reopened" afterwards. The reopened elements will have the same
+ * attributes as the originals, except that 'name' and 'id' attributes
+ * are not duplicated if the stylesheet.result.type is "html" and
+ * 'id' attributes will not be duplicated if the result type is "fo".</p>
+ *
+ * @param rtf The result tree fragment of the verbatim environment.
+ *
+ * @return The modified result tree fragment.
+ */
+ public static NodeSetValue numberLines (Context context,
+ NodeSetValue rtf_ns) {
+
+ FragmentValue rtf = (FragmentValue) rtf_ns;
+
+ setupLineNumbering(context);
+
+ try {
+ LineCountEmitter lcEmitter = new LineCountEmitter();
+ rtf.replay(lcEmitter);
+ int numLines = lcEmitter.lineCount();
+
+ int listingModulus = numLines < modulus ? 1 : modulus;
+
+ double log10numLines = Math.log(numLines) / Math.log(10);
+
+ int listingWidth = width < log10numLines+1
+ ? (int) Math.floor(log10numLines + 1)
+ : width;
+
+ NamePool namePool = context.getController().getNamePool();
+ NumberLinesEmitter nlEmitter = new NumberLinesEmitter(namePool,
+ listingModulus,
+ listingWidth,
+ separator,
+ foStylesheet);
+ rtf.replay(nlEmitter);
+ return nlEmitter.getResultTreeFragment();
+ } catch (TransformerException e) {
+ // This "can't" happen.
+ System.out.println("Transformer Exception in numberLines");
+ return rtf;
+ }
+ }
+
+ /**
+ * <p>Setup the parameters associated with callouts</p>
+ *
+ * <p>This method queries the stylesheet for the variables
+ * associated with line numbering. It is called automatically before
+ * callouts are processed. The context is used to retrieve the values,
+ * this allows templates to redefine these variables.</p>
+ *
+ * <p>The following variables are queried. If the variables do not
+ * exist, builtin defaults will be used (but you may also get a bunch
+ * of messages from the Java interpreter).</p>
+ *
+ * <dl>
+ * <dt><code>callout.graphics</code></dt>
+ * <dd>Are we using callout graphics? A value of 0 or "" is false,
+ * any other value is true. If callout graphics are not used, the
+ * parameters related to graphis are not queried.</dd>
+ * <dt><code>callout.graphics.path</code></dt>
+ * <dd>Specifies the path to callout graphics.</dd>
+ * <dt><code>callout.graphics.extension</code></dt>
+ * <dd>Specifies the extension ot use for callout graphics.</dd>
+ * <dt><code>callout.graphics.number.limit</code></dt>
+ * <dd>Identifies the largest number that can be represented as a
+ * graphic. Larger callout numbers will be represented using text.</dd>
+ * <dt><code>callout.defaultcolumn</code></dt>
+ * <dd>Specifies the default column for callout bullets that do not
+ * specify a column.</dd>
+ * <dt><code>stylesheet.result.type</code></dt>
+ * <dd>Specifies the stylesheet result type. The value is either 'fo'
+ * (for XSL Formatting Objects) or it isn't. (builtin default: html).</dd>
+ * </dl>
+ *
+ * @param context The current stylesheet context
+ *
+ */
+ private static void setupCallouts(Context context) {
+ NamePool namePool = context.getController().getNamePool();
+
+ boolean useGraphics = false;
+ boolean useUnicode = false;
+ boolean useDingbats = false;
+
+ int unicodeStart = 49;
+ int unicodeMax = 0;
+ int dingbatMax = 10;
+
+ // Hardcoded defaults
+ defaultColumn = 60;
+ graphicsPath = null;
+ graphicsExt = null;
+ graphicsMax = 0;
+ foStylesheet = false;
+ calloutsSetup = true;
+
+ Value variable = null;
+ String varString = null;
+
+ // Get the stylesheet type
+ varString = getVariable(context, "stylesheet.result.type");
+ foStylesheet = (varString.equals("fo"));
+
+ // Get the default column
+ varString = getVariable(context, "callout.defaultcolumn");
+ try {
+ defaultColumn = Integer.parseInt(varString);
+ } catch (NumberFormatException nfe) {
+ System.out.println("$callout.defaultcolumn is not a number: "
+ + varString);
+ }
+
+ // Use graphics at all?
+ varString = getVariable(context, "callout.graphics");
+ useGraphics = !(varString.equals("0") || varString.equals(""));
+
+ // Use unicode at all?
+ varString = getVariable(context, "callout.unicode");
+ useUnicode = !(varString.equals("0") || varString.equals(""));
+
+ // Use dingbats at all?
+ varString = getVariable(context, "callout.dingbats");
+ useDingbats = !(varString.equals("0") || varString.equals(""));
+
+ if (useGraphics) {
+ // Get the graphics path
+ varString = getVariable(context, "callout.graphics.path");
+ graphicsPath = varString;
+
+ // Get the graphics extension
+ varString = getVariable(context, "callout.graphics.extension");
+ graphicsExt = varString;
+
+ // Get the number limit
+ varString = getVariable(context, "callout.graphics.number.limit");
+ try {
+ graphicsMax = Integer.parseInt(varString);
+ } catch (NumberFormatException nfe) {
+ System.out.println("$callout.graphics.number.limit is not a number: "
+ + varString);
+ graphicsMax = 0;
+ }
+
+ fCallout = new FormatGraphicCallout(namePool,
+ graphicsPath,
+ graphicsExt,
+ graphicsMax,
+ foStylesheet);
+ } else if (useUnicode) {
+ // Get the starting character
+ varString = getVariable(context, "callout.unicode.start.character");
+ try {
+ unicodeStart = Integer.parseInt(varString);
+ } catch (NumberFormatException nfe) {
+ System.out.println("$callout.unicode.start.character is not a number: "
+ + varString);
+ unicodeStart = 48;
+ }
+
+ // Get the number limit
+ varString = getVariable(context, "callout.unicode.number.limit");
+ try {
+ unicodeMax = Integer.parseInt(varString);
+ } catch (NumberFormatException nfe) {
+ System.out.println("$callout.unicode.number.limit is not a number: "
+ + varString);
+ unicodeStart = 0;
+ }
+
+ fCallout = new FormatUnicodeCallout(namePool,
+ unicodeStart,
+ unicodeMax,
+ foStylesheet);
+ } else if (useDingbats) {
+ fCallout = new FormatDingbatCallout(namePool,
+ dingbatMax,
+ foStylesheet);
+ } else {
+ fCallout = new FormatTextCallout(namePool, foStylesheet);
+ }
+ }
+
+ /**
+ * <p>Insert text callouts into a verbatim environment.</p>
+ *
+ * <p>This method examines the <tt>areaset</tt> and <tt>area</tt> elements
+ * in the supplied <tt>areaspec</tt> and decorates the supplied
+ * result tree fragment with appropriate callout markers.</p>
+ *
+ * <p>If a <tt>label</tt> attribute is supplied on an <tt>area</tt>,
+ * its content will be used for the label, otherwise the callout
+ * number will be used, surrounded by parenthesis. Callout numbers may
+ * also be represented as graphics. Callouts are
+ * numbered in document order. All of the <tt>area</tt>s in an
+ * <tt>areaset</tt> get the same number.</p>
+ *
+ * <p>Only the <tt>linecolumn</tt> and <tt>linerange</tt> units are
+ * supported. If no unit is specifed, <tt>linecolumn</tt> is assumed.
+ * If only a line is specified, the callout decoration appears in
+ * the defaultColumn. Lines will be padded with blanks to reach the
+ * necessary column, but callouts that are located beyond the last
+ * line of the verbatim environment will be ignored.</p>
+ *
+ * <p>Callouts are inserted before the character at the line/column
+ * where they are to occur.</p>
+ *
+ * <p>If graphical callouts are used, and the callout number is less
+ * than or equal to the $callout.graphics.number.limit, the following image
+ * will be generated for HTML:
+ *
+ * <pre>
+ * <img src="$callout.graphics.path/999$callout.graphics.ext"
+ * alt="conumber">
+ * </pre>
+ *
+ * If the $stylesheet.result.type is 'fo', the following image will
+ * be generated:
+ *
+ * <pre>
+ * <fo:external-graphic src="$callout.graphics.path/999$callout.graphics.ext"/>
+ * </pre>
+ *
+ * <p>If the callout number exceeds $callout.graphics.number.limit,
+ * the callout will be the callout number surrounded by
+ * parenthesis.</p>
+ *
+ * @param context The stylesheet context.
+ * @param areaspecNodeSet The source node set that contains the areaspec.
+ * @param rtf The result tree fragment of the verbatim environment.
+ *
+ * @return The modified result tree fragment.
+ */
+
+ public static NodeSetValue insertCallouts (Context context,
+ NodeList areaspecNodeList,
+ NodeSetValue rtf_ns) {
+
+ FragmentValue rtf = (FragmentValue) rtf_ns;
+
+ setupCallouts(context);
+
+ try {
+ NamePool namePool = context.getController().getNamePool();
+ CalloutEmitter cEmitter = new CalloutEmitter(namePool,
+ defaultColumn,
+ foStylesheet,
+ fCallout);
+ cEmitter.setupCallouts(areaspecNodeList);
+ rtf.replay(cEmitter);
+ return cEmitter.getResultTreeFragment();
+ } catch (TransformerException e) {
+ // This "can't" happen.
+ System.out.println("Transformer Exception in insertCallouts");
+ return rtf;
+ }
+ }
+}
--- /dev/null
+<html>
+<head>
+<title>Norman Walsh's Saxon Extensions Package</title>
+</head>
+<body>
+<p>Norman Walsh's Saxon Extensions Package for Saxon 6.*</p>
+
+<p>This package implements Saxon extensions for XSLT.</p>
+
+<p><b>Copyright (C) 2000 Norman Walsh</b></p>
+<p>Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use, copy,
+modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:</p>
+
+<p>The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.</p>
+
+<p>Except as contained in this notice, the names of individuals
+credited with contribution to this software shall not be used in
+advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the
+individuals in question.</p>
+
+<p>Anything derived from this Software that is publically
+distributed will be identified with a different name and the
+version strings in any derived Software will be changed so that no
+possibility of confusion between the derived package and this
+Software will exist.</p>
+</blockquote>
+
+<blockquote>
+<p><b>Warranty</b></p>
+<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL NORMAN WALSH OR ANY OTHER
+CONTRIBUTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.</p>
+</blockquote>
+
+</body>
+</html>
--- /dev/null
+
+
+
+
+
+
+
+
+
+
+(jde-set-project-name "saxon")
+(jde-set-variables
+ '(jde-gen-session-bean-template (quote ("(jde-import-insert-imports-into-buffer (list \"javax.ejb.*\"
+\"java.rmi.RemoteException\"))" "(jde-wiz-update-implements-clause \"SessionBean\")" "'> \"public void ejbActivate() throws RemoteException {\"'>'n \"}\"'>'n
+'>'n" "'> \"public void ejbPassivate() throws RemoteException {\"'>'n \"}\"'>'n
+'>'n" "'> \"public void ejbRemove() throws RemoteException {\"'>'n \"}\"'>'n '>'n" "'> \"public void setSessionContext(SessionContext ctx) throws
+RemoteException {\"" "'>'n \"}\"'>'n '>'n" "'> \"public void unsetSessionContext() throws RemoteException {\"'>'n
+\"}\"'>'n '>'n'>")))
+ '(jde-gen-beep (quote ("(end-of-line) '&" "\"Toolkit.getDefaultToolkit().beep();\"'>'n'>")))
+ '(jde-which-method-format (quote ("[" jde-which-method-current "]")))
+ '(jde-run-classic-mode-vm nil)
+ '(jde-javadoc-gen-nodeprecatedlist nil)
+ '(jde-which-method-max-length 20)
+ '(jde-imenu-include-classdef t)
+ '(jde-javadoc-gen-link-online nil)
+ '(jde-gen-code-templates (quote (("Get Set Pair" . jde-gen-get-set) ("toString method" . jde-gen-to-string-method) ("Action Listener" . jde-gen-action-listener) ("Window Listener" . jde-gen-window-listener) ("Mouse Listener" . jde-gen-mouse-listener) ("Mouse Motion Listener" . jde-gen-mouse-motion-listener) ("Inner Class" . jde-gen-inner-class) ("println" . jde-gen-println) ("beep" . jde-gen-beep) ("property change support" . jde-gen-property-change-support) ("EJB Entity Bean" . jde-gen-entity-bean) ("EJB Session Bean" . jde-gen-session-bean))))
+ '(jde-gen-cflow-else (quote ("(if (jde-parse-comment-or-quoted-p)" "'(l \"else\")" "'(l '> \"else \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n'>'r'n" "\"} // end of else\"'>'n'>)" ")")))
+ '(jde-make-args "")
+ '(jde-javadoc-gen-destination-directory "JavaDoc")
+ '(jde-mode-line-format (quote ("-" mode-line-mule-info mode-line-modified mode-line-frame-identification mode-line-buffer-identification " " global-mode-string " %[(" mode-name mode-line-process minor-mode-alist "%n" ")%]--" (line-number-mode "L%l--") (column-number-mode "C%c--") (-3 . "%p") (jde-which-method-mode ("--" jde-which-method-format "--")) "-%-")))
+ '(jde-mode-abbreviations (quote (("ab" . "abstract") ("bo" . "boolean") ("br" . "break") ("by" . "byte") ("byv" . "byvalue") ("cas" . "cast") ("ca" . "catch") ("ch" . "char") ("cl" . "class") ("co" . "const") ("con" . "continue") ("de" . "default") ("dou" . "double") ("el" . "else") ("ex" . "extends") ("fa" . "false") ("fi" . "final") ("fin" . "finally") ("fl" . "float") ("fo" . "for") ("fu" . "future") ("ge" . "generic") ("go" . "goto") ("impl" . "implements") ("impo" . "import") ("ins" . "instanceof") ("in" . "int") ("inte" . "interface") ("lo" . "long") ("na" . "native") ("ne" . "new") ("nu" . "null") ("pa" . "package") ("pri" . "private") ("pro" . "protected") ("pu" . "public") ("re" . "return") ("sh" . "short") ("st" . "static") ("su" . "super") ("sw" . "switch") ("sy" . "synchronized") ("th" . "this") ("thr" . "throw") ("throw" . "throws") ("tra" . "transient") ("tr" . "true") ("vo" . "void") ("vol" . "volatile") ("wh" . "while"))))
+ '(jde-imenu-enable t)
+ '(jde-compile-option-verbose nil)
+ '(jde-db-option-heap-size (quote ((1 . "megabytes") (16 . "megabytes"))))
+ '(jde-bug-debugger-host-address "localhost" t)
+ '(jde-make-working-directory "")
+ '(jde-bug-breakpoint-marker-colors (quote ("red" . "yellow")))
+ '(jde-javadoc-gen-use nil)
+ '(jde-gen-buffer-boilerplate nil)
+ '(jde-bug-raise-frame-p t)
+ '(jde-db-option-application-args (quote ("-IN" "/share/xsl/docbook/test/exttest.xml" "-XSL " "/share/xsl/docbook/test/exttest.xsl")) t)
+ '(jde-javadoc-gen-nonavbar nil)
+ '(jde-javadoc-gen-nohelp nil)
+ '(jde-bug-vm-includes-jpda-p nil)
+ '(jde-gen-jfc-app-buffer-template (quote ("(funcall jde-gen-boilerplate-function) '>'n" "\"import java.awt.Dimension;\" '>'n" "\"import java.awt.Graphics;\" '>'n" "\"import java.awt.Graphics2D;\" '>'n" "\"import java.awt.Color;\" '>'n" "\"import java.awt.geom.Ellipse2D;\" '>'n" "\"import java.awt.event.WindowAdapter;\" '>'n" "\"import java.awt.event.WindowEvent;\" '>'n" "\"import javax.swing.JFrame;\" '>'n" "\"import javax.swing.JPanel;\" '>'n" "\"import javax.swing.JScrollPane;\" '>'n" "\"import javax.swing.JMenuBar;\" '>'n" "\"import javax.swing.JMenu;\" '>'n" "\"import java.awt.event.ActionEvent;\" '>'n" "\"import javax.swing.AbstractAction;\" '>'n '>'n" "\"/**\" '>'n" "\" * \"" "(file-name-nondirectory buffer-file-name) '>'n" "\" *\" '>'n" "\" *\" '>'n" "\" * Created: \" (current-time-string) '>'n" "\" *\" '>'n" "\" * @author <a href=\\\"mailto: \\\"\" (user-full-name) \"</a>\"'>'n" "\" * @version\" '>'n" "\" */\" '>'n" "'>'n" "\"public class \"" "(file-name-sans-extension (file-name-nondirectory buffer-file-name))" "\" extends JFrame\"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "\"class Canvas extends JPanel\"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "\"public Canvas () \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "\"setSize(getPreferredSize());\" '>'n" "\"Canvas.this.setBackground(Color.white);\" '>'n" "\"}\"'>'n '>'n" "\"public Dimension getPreferredSize() \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "\"return new Dimension(600, 600);\" '>'n" "\"}\"'>'n '>'n" "\"public void paintComponent(Graphics g) \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "\"super.paintComponent(g);\" '>'n" "\"Graphics2D g2d = (Graphics2D) g;\" '>'n" "\"Ellipse2D circle = new Ellipse2D.Double(0d, 0d, 100d, 100d);\" '>'n" "\"g2d.setColor(Color.red);\" '>'n" "\"g2d.translate(10, 10);\" '>'n" "\"g2d.draw(circle);\" '>'n" "\"g2d.fill(circle);\" '>'n" "\"}\"'>'n " "\"}\"'>'n '>'n" "\"public \"" "(file-name-sans-extension (file-name-nondirectory buffer-file-name))" "\"()\"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "\"super(\\\"\" (P \"Enter app title: \") \"\\\");\" '>'n" "\"setSize(300, 300);\" '>'n" "\"addWindowListener(new WindowAdapter() \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "\"public void windowClosing(WindowEvent e) {System.exit(0);}\" '>'n" "\"public void windowOpened(WindowEvent e) {}\" '>'n" "\"});\"'>'n" "\"setJMenuBar(createMenu());\" '>'n" "\"getContentPane().add(new JScrollPane(new Canvas()));\" '>'n" "\"}\"'>'n" "'>'n" "\"public static void main(String[] args) \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "'>'n" "(file-name-sans-extension (file-name-nondirectory buffer-file-name))" "\" f = new \"" "(file-name-sans-extension (file-name-nondirectory buffer-file-name))" "\"();\" '>'n" "\"f.show();\" '>'n" "\"}\"'>'n '>'n" "\"protected JMenuBar createMenu() \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "\"JMenuBar mb = new JMenuBar();\" '>'n" "\"JMenu menu = new JMenu(\\\"File\\\");\" '>'n" "\"menu.add(new AbstractAction(\\\"Exit\\\") \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "\"public void actionPerformed(ActionEvent e) \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "\"System.exit(0);\" '>'n" "\"}\" '>'n" "\"});\" '>'n" "\"mb.add(menu);\" '>'n" "\"return mb;\" '>'n" "\"}\"'>'n " "\"} // \"'>" "(file-name-sans-extension (file-name-nondirectory buffer-file-name))" "'>'n")))
+ '(jde-bug-key-bindings (quote (("[?\ 3 ?\1a ?\13]" . jde-bug-step-over) ("[?\ 3 ?\1a ?\18]" . jde-bug-step-into) ("[?\ 3 ?\1a ?\ 1]" . jde-bug-step-into-all) ("[?\ 3 ?\1a ?\17]" . jde-bug-step-out) ("[?\ 3 ?\1a ?\ 3]" . jde-bug-continue) ("[?\ 3 ?\1a ?\ 2]" . jde-bug-toggle-breakpoint))))
+ '(jde-compile-finish-hook (quote (jde-compile-finish-refresh-speedbar jde-compile-finish-flush-completion-cache)))
+ '(jde-compile-option-nowarn nil)
+ '(jde-setnu-mode-threshold 20000)
+ '(jde-run-java-vm-w "javaw")
+ '(jde-compile-option-encoding nil)
+ '(jde-run-option-java-profile (quote (nil . "./java.prof")))
+ '(jde-bug-jpda-directory "/usr/local/jdk1.2.2" t)
+ '(jde-read-compile-args nil)
+ '(jde-run-java-vm "java")
+ '(jde-db-option-verbose (quote (nil nil nil)))
+ '(jde-which-method-class-min-length 4)
+ '(jde-db-read-app-args nil)
+ '(jde-javadoc-gen-nodeprecated nil)
+ '(jde-run-option-heap-profile (quote (nil "./java.hprof" 5 20 "Allocation objects")))
+ '(jde-gen-println (quote ("(end-of-line) '&" "\"System.out.println(\" (P \"Print out: \") \");\" '>'n'>")))
+ '(jde-enable-abbrev-mode nil)
+ '(jde-auto-parse-max-buffer-size 50000)
+ '(jde-gen-cflow-main (quote ("(if (jde-parse-comment-or-quoted-p)" "'(l \"main\")" "'(l '> \"public static void main (String[] args) \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n'>'r'n" "\"} // end of main ()\"'>'n'>)" ")")))
+ '(jde-javadoc-exception-tag-template "\"* @exception \" type \" if an error occurs\"")
+ '(jde-global-classpath nil t)
+ '(jde-gen-window-listener-template (quote ("(end-of-line) '& (P \"Window name: \")" "\".addWindowListener(new WindowAdapter() \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "'> \"public void windowActivated(WindowEvent e) \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "\"}\"" "'>'n \"public void windowClosed(WindowEvent e)\"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "'>'n \"}\"" "'>'n \"public void windowClosing(WindowEvent e) \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "'>'n \"System.exit(0);\" '>'n \"}\"" "'>'n \"public void windowDeactivated(WindowEvent e) \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "'>'n \"}\"" "'>'n \"public void windowDeiconified(WindowEvent e) \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "'>'n \"}\"" "'>'n \"public void windowIconified(WindowEvent e) \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "'>'n \"}\"" "'>'n \"public void windowOpened(WindowEvent e) \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "'>'n \"}\"" "'>'n \"});\" '>'n'>")))
+ '(jde-run-working-directory "/share/xsl/docbook/extensions" t)
+ '(jde-gen-property-change-support (quote ("(end-of-line) '&" "\"protected PropertyChangeSupport pcs = new PropertyChangeSupport(this);\" '>'n '>'n" "\"/**\" '>'n" "\"* Adds a PropertyChangeListener to the listener list.\" '>'n" "\"* The listener is registered for all properties.\" '>'n" "\"*\" '>'n" "\"* @param listener The PropertyChangeListener to be added\" '>'n" "\"*/\" '>'n" "\"public void addPropertyChangeListener(PropertyChangeListener listener) \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "\"pcs.addPropertyChangeListener(listener);\" '>'n \"}\" '>'n '>'n" "\"/**\" '>'n" "\"* Removes a PropertyChangeListener from the listener list.\" '>'n" "\"* This removes a PropertyChangeListener that was registered for all properties.\" '>'n" "\"*\" '>'n " "\"* @param listener The PropertyChangeListener to be removed\" '>'n" "\"*/\" '>'n" "\"public void removePropertyChangeListener(PropertyChangeListener listener) \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "'>\"pcs.removePropertyChangeListener(listener);\" '>'n \"}\" '>'n '>'n" "\"/**\" '>'n\"* Adds a PropertyChangeListener for a specific property.\" '>'n" "\"* The listener will be invoked only when a call on firePropertyChange\" '>'n" "\"* names that specific property.\" '>'n" "\"*\" '>'n \"* @param propertyName The name of the property to listen on\" '>'n" "\"* @param listener The PropertyChangeListener to be added\" '>'n \"*/\" '>'n" "\"public void addPropertyChangeListener(String propertyName,\" '>'n" "\"PropertyChangeListener listener) \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "'> \"pcs.addPropertyChangeListener(propertyName, listener);\" '>'n \"}\" '>'n '>'n" "\"/**\" '>'n\"* Removes a PropertyChangeListener for a specific property.\" '>'n" "\"*\" '>'n \"* @param propertyName The name of the property that was listened on\" '>'n" "\"* @param listener The PropertyChangeListener to be removed\" '>'n \"*/\" '>'n" "\"public void removePropertyChangeListener(String propertyName,\" '>'n" "\"PropertyChangeListener listener) \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "'> \"pcs.removePropertyChangeListener(propertyName, listener);\" '>'n \"}\" '>'n '>'n" "\"/**\" '>'n\"* Reports a bound property update to any registered listeners. \" '>'n" "\"* No event is fired if old and new are equal and non-null.\" '>'n" "\"*\" '>'n \"* @param propertyName The programmatic name of the property that was changed\" '>'n" "\"* @param oldValue The old value of the property\" '>'n" "\"* @param newValue The new value of the property.\" '>'n \"*/\" '>'n" "\"public void firePropertyChange(String propertyName, Object oldValue, Object newValue) \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "'> \"pcs.firePropertyChange(propertyName, oldValue, newValue);\" '>'n \"}\" '>'n '>'n" "\"/**\" '>'n\"* Reports a bound property update to any registered listeners. \" '>'n" "\"* No event is fired if old and new are equal and non-null.\" '>'n" "\"* This is merely a convenience wrapper around the more general\" '>'n" "\"* firePropertyChange method that takes Object values.\" '>'n" "\"* No event is fired if old and new are equal and non-null.\" '>'n" "\"*\" '>'n \"* @param propertyName The programmatic name of the property that was changed\" '>'n" "\"* @param oldValue The old value of the property\" '>'n" "\"* @param newValue The new value of the property.\" '>'n \"*/\" '>'n" "\"public void firePropertyChange(String propertyName, int oldValue, int newValue) \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "'> \"pcs.firePropertyChange(propertyName, oldValue, newValue);\" '>'n \"}\" '>'n '>'n" "\"/**\" '>'n\"* Reports a bound property update to any registered listeners. \" '>'n" "\"* No event is fired if old and new are equal and non-null.\" '>'n" "\"* This is merely a convenience wrapper around the more general\" '>'n" "\"* firePropertyChange method that takes Object values.\" '>'n" "\"* No event is fired if old and new are equal and non-null.\" '>'n" "\"*\" '>'n \"* @param propertyName The programmatic name of the property that was changed\" '>'n" "\"* @param oldValue The old value of the property\" '>'n" "\"* @param newValue The new value of the property.\" '>'n \"*/\" '>'n" "\"public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "'> \"pcs.firePropertyChange(propertyName, oldValue, newValue);\" '>'n \"}\" '>'n '>'n" "\"/**\" '>'n\"* Fires an existing PropertyChangeEvent to any registered listeners.\" '>'n" "\"* No event is fired if the given event's old and new values are equal and non-null. \" '>'n" "\"*\" '>'n \"* @param evt The PropertyChangeEvent object.\" '>'n\"*/\" '>'n" "\"public void firePropertyChange(PropertyChangeEvent evt) \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "'> \"pcs.firePropertyChange(evt);\" '>'n \"}\" '>'n '>'n" "\"/**\" '>'n\"* Checks if there are any listeners for a specific property.\" '>'n" "\"*\" '>'n \"* @param evt The PropertyChangeEvent object.\" '>'n" "\"* @return <code>true</code>if there are one or more listeners for the given property\" '>'n" "\"*/\" '>'n" "\"public boolean hasListeners(String propertyName) \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "'> \"return pcs.hasListeners(propertyName);\" '>'n \"}\" '>'n '>'n'>")))
+ '(jde-javadoc-describe-interface-template "\"* Describe interface \" (jde-javadoc-code name) \" here.\"")
+ '(jde-imenu-include-signature t)
+ '(jde-db-marker-regexp "^.*: thread=.*, \\(\\(.*[.]\\)*\\)\\([^$]*\\)\\($.*\\)*[.].+(), line=\\([0-9]*\\),")
+ '(jde-gen-mouse-motion-listener-template (quote ("(end-of-line) '& (P \"Component name: \")" "\".addMouseMotionListener(new MouseMotionAdapter() \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>" "'>'n \"public void mouseDragged(MouseEvent e) \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "\"}\"'>" "'>'n \"public void mouseMoved(MouseEvent e) \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "\"}\"'>" "'>'n \"});\"'>'n'>")))
+ '(jde-key-bindings (quote (("[?\ 3 ?\16 ?\ 1]" . jde-run-menu-run-applet) ("[?\ 3 ?\16 ?\ 2]" . jde-build) ("[?\ 3 ?\16 ?\ 3]" . jde-compile) ("[?\ 3 ?\16 ?\ 4]" . jde-debug) ("[?\ 3 ?\16 ?\ 6]" . jde-wiz-implement-interface) ("[?\ 3 ?\16 ?j]" . jde-javadoc-generate-javadoc-template) ("[?\ 3 ?\16 ?\v]" . bsh) ("[?\ 3 ?\16 ?\f]" . jde-gen-println) ("[?\ 3 ?\16 ?\ e]" . jde-browse-jdk-doc) ("[?\ 3 ?\16 ?\10]" . jde-save-project) ("[?\ 3 ?\16 ?\11]" . jde-wiz-update-class-list) ("[?\ 3 ?\16 ?\12]" . jde-run) ("[?\ 3 ?\16 ?\13]" . speedbar-frame-mode) ("[?\ 3 ?\16 ?\14]" . jde-db-menu-debug-applet) ("[?\ 3 ?\16 ?\17]" . jde-help-symbol) ("[?\ 3 ?\16 ?\19]" . jde-show-class-source) ("[?\ 3 ?\16 ?\1a]" . jde-import-find-and-import) ("[(control c) (control v) (control ?.)]" . jde-complete-at-point-menu) ("[(control c) (control v) ?.]" . jde-complete-at-point))))
+ '(jde-gen-cflow-for-i (quote ("(if (jde-parse-comment-or-quoted-p)" "'(l \"fori\")" "'(l '> \"for (int \" (p \"variable: \" var) \" = 0; \"" "(s var)" "\" < \"(p \"upper bound: \" ub)\"; \" (s var) \"++) \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n'>'r'n" "\"} // end of for (int \" (s var) \" = 0; \"" "(s var) \" < \" (s ub) \"; \" (s var) \"++)\"'>'n'>)" ")")))
+ '(jde-run-option-classpath (quote ("/share/xsl/docbook/extensions/xalan2/.classes" "/projects/apache/xml-xalan/java/build/classes" "/projects/apache/xml-xalan/java/bin/bsf.jar" "/projects/apache/xml-xalan/java/bin/xerces.jar" "/projects/sun/resolver/.classes" "/projects/apache/xml-xerces/java/build/classes" "/home/ndw/java")) t)
+ '(jde-javadoc-gen-detail-switch (quote ("-protected")))
+ '(jde-bug-sio-connect-delay 1)
+ '(jde-javadoc-param-tag-template "\"* @param \" name \" \" (jde-javadoc-a type)
+ \" \" (jde-javadoc-code type) \" value\"")
+ '(jde-compile-option-verbose-path nil)
+ '(jde-javadoc-display-doc t)
+ '(jde-imenu-modifier-abbrev-alist (quote (("public" . 43) ("protected" . 177) ("private" . 172) ("static" . 2215) ("transient" . 35) ("volatile" . 126) ("abstract" . 170) ("final" . 182) ("native" . 36) ("synchronized" . 64) ("strictfp" . 37))))
+ '(jde-db-debugger (quote ("JDEbug" "/usr/local/jdk1.2.2/lib/i386" . "Executable")) t)
+ '(jde-jdk-doc-url "http://www.javasoft.com/products/jdk/1.1/docs/index.html")
+ '(jde-gen-cflow-enable t)
+ '(jde-compiler "javac")
+ '(jde-javadoc-gen-verbose nil)
+ '(jde-javadoc-describe-method-template "\"* Describe \" (jde-javadoc-code name) \" method here.\"")
+ '(jde-gen-class-buffer-template (quote ("(funcall jde-gen-boilerplate-function) '>'n" "\"/**\" '>'n" "\" * \"" "(file-name-nondirectory buffer-file-name) '>'n" "\" *\" '>'n" "\" *\" '>'n" "\" * Created: \" (current-time-string) '>'n" "\" *\" '>'n" "\" * @author <a href=\\\"mailto: \\\"\" (user-full-name) \"</a>\"'>'n" "\" * @version\" '>'n" "\" */\" '>'n'" "'>'n" "\"public class \"" "(file-name-sans-extension (file-name-nondirectory buffer-file-name))" "\" \" (jde-gen-get-super-class)" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "\"public \"" "(file-name-sans-extension (file-name-nondirectory buffer-file-name))" "\" ()\"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "'>'p'n" "\"}\">" "'>'n" "\"}\">" "\"// \"" "(file-name-sans-extension (file-name-nondirectory buffer-file-name))" "'>'n")))
+ '(jde-javadoc-checker-level (quote protected))
+ '(jde-appletviewer-option-vm-args nil)
+ '(jde-run-executable-args nil)
+ '(jde-db-option-garbage-collection (quote (t t)))
+ '(jde-javadoc-gen-stylesheetfile "")
+ '(jde-use-font-lock t)
+ '(jde-compile-option-bootclasspath nil)
+ '(jde-make-program "make")
+ '(jde-javadoc-gen-group nil)
+ '(jde-javadoc-gen-link-offline nil)
+ '(jde-entering-java-buffer-hook (quote (jde-reload-project-file jde-which-method-update-on-entering-buffer)))
+ '(jde-javadoc-gen-doc-title "")
+ '(jde-javadoc-gen-header "")
+ '(jde-run-option-vm-args nil)
+ '(jde-javadoc-gen-window-title "")
+ '(jde-compile-option-directory "/sourceforge/docbook/xsl/extensions/saxon64/.classes" t)
+ '(jde-imenu-create-index-function (quote semantic-create-imenu-index))
+ '(jde-gen-console-buffer-template (quote ("(funcall jde-gen-boilerplate-function) '>'n" "\"/**\" '>'n" "\" * \"" "(file-name-nondirectory buffer-file-name) '>'n" "\" *\" '>'n" "\" *\" '>'n" "\" * Created: \" (current-time-string) '>'n" "\" *\" '>'n" "\" * @author <a href=\\\"mailto: \\\"\" (user-full-name) \"</a>\"'>'n" "\" * @version\" '>'n" "\" */\" '>'n" "'>'n" "\"public class \"" "(file-name-sans-extension (file-name-nondirectory buffer-file-name))" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "\"public \"" "(file-name-sans-extension (file-name-nondirectory buffer-file-name))" "\" ()\"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "'>'n" "\"}\"'>'n" "'>'n" "\"public static void main(String[] args)\"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "'>'p'n" "\"}\"'>'n" "\"} // \"'>" "(file-name-sans-extension (file-name-nondirectory buffer-file-name))" "'>'n")))
+ '(jde-read-make-args nil)
+ '(jde-javadoc-gen-noindex nil)
+ '(jde-gen-mouse-listener-template (quote ("(end-of-line) '& (P \"Component name: \")" "\".addMouseListener(new MouseAdapter() \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'> " "'>'n \"public void mouseClicked(MouseEvent e) \" " "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "\"}\" '>" "'>'n \"public void mouseEntered(MouseEvent e) \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "\"}\" '>" "'>'n \"public void mouseExited(MouseEvent e) \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "\"}\"'>" "'>'n \"public void mousePressed(MouseEvent e) \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "\"}\" '>" "'>'n \"public void mouseReleased(MouseEvent e) \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "\"}\"'>" "'>'n \"});\"'>'n'>")))
+ '(jde-run-option-application-args (quote ("-IN" "test.xml" "-XSL" "test.xsl")) t)
+ '(jde-bug-vm-executable (quote ("java")))
+ '(jde-db-set-initial-breakpoint t)
+ '(jde-bug-debugger-command-timeout 10)
+ '(jde-db-option-stack-size (quote ((128 . "kilobytes") (400 . "kilobytes"))))
+ '(jde-db-option-properties nil t)
+ '(jde-db-source-directories (quote ("/share/xsl/docbook/extensions/xalan2/" "/projects/apache/xml-xalan/java/src/" "/projects/apache/xml-xerces/java/build/src/" "/projects/sun/resolver/" "/home/ndw/java/")) t)
+ '(jde-run-read-app-args nil)
+ '(jde-gen-to-string-method-template (quote ("(end-of-line) '&" "\"public String toString() \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "\"}\"'>'n'>")))
+ '(jde-quote-classpath t)
+ '(jde-bug-window-message nil)
+ '(jde-build-use-make nil)
+ '(jde-javadoc-author-tag-template "\"* @author <a href=\\\"mailto:\" user-mail-address
+ \"\\\">\" user-full-name \"</a>\"")
+ '(jde-javadoc-describe-field-template "\"* Describe \" (jde-javadoc-field-type modifiers)
+ \" \" (jde-javadoc-code name) \" here.\"")
+ '(jde-javadoc-gen-link-URL nil)
+ '(jde-compile-option-classpath (quote ("/sourceforge/docbook/xsl/extensions/saxon64/.classes" "/usr/local/java/saxon-6.4.2/saxon.jar" "/usr/local/jaxp-1.1/jaxp.jar" "/usr/local/jaxp-1.1/crimson.jar")) t)
+ '(jde-bug-jdk-directory "/usr/local/jdk1.2.2" t)
+ '(jde-gen-boilerplate-function (quote jde-gen-create-buffer-boilerplate))
+ '(jde-gen-entity-bean-template (quote ("(jde-import-insert-imports-into-buffer (list \"javax.ejb.*\"
+\"java.rmi.RemoteException\"))" "'> \"public void ejbActivate() throws RemoteException \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "\"}\"'>'n '>'n" "'> \"public void ejbPassivate() throws RemoteException \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "\"}\"'>'n '>'n" "'> \"public void ejbLoad() throws RemoteException \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "\"}\"'>'n '>'n" "'> \"public void ejbStore() throws RemoteException \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "\"}\"'>'n '>'n" "'> \"public void ejbRemove() throws RemoteException \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "\"}\"'>'n '>'n" "'> \"public void setEntityContext(EntityContext ctx) throws RemoteException \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "\"}\"'>'n '>'n" "'> \"public void unsetEntityContext() throws RemoteException \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "\"}\"'>'n '>'n'>")))
+ '(jde-javadoc-describe-constructor-template "\"* Creates a new \" (jde-javadoc-code name) \" instance.\"")
+ '(jde-bug-server-shmem-name (quote (t . "JDEbug")))
+ '(jde-db-startup-commands nil)
+ '(jde-javadoc-gen-docletpath nil)
+ '(jde-javadoc-gen-split-index nil)
+ '(jde-compile-option-deprecation nil t)
+ '(jde-import-group-of-rules (quote (("^javax?\\."))))
+ '(jde-which-method-mode t)
+ '(jde-gen-k&r t)
+ '(jde-javadoc-gen-bottom "")
+ '(jde-javadoc-gen-footer "")
+ '(jde-db-option-classpath (quote ("/share/xsl/docbook/extensions/xalan2/.classes" "/projects/apache/xml-xalan/java/build/classes" "/projects/apache/xml-xalan/java/bin/bsf.jar" "/projects/apache/xml-xalan/java/bin/xerces.jar" "/projects/sun/resolver/.classes" "/projects/apache/xml-xerces/java/build/classes" "/home/ndw/java")) t)
+ '(jde-gen-cflow-for (quote ("(if (jde-parse-comment-or-quoted-p)" "'(l \"for\")" "'(l '> \"for (\" (p \"for-clause: \" clause) \") \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n'>'r'n" "\"} // end of for (\" (s clause) \")\"'>'n'>)" ")")))
+ '(jde-run-mode-hook nil)
+ '(jde-db-option-verify (quote (nil t)))
+ '(jde-compile-option-extdirs nil)
+ '(jde-imenu-sort nil)
+ '(jde-gen-get-set-var-template (quote ("(end-of-line) '&" "(P \"Variable type: \" type) \" \"" "(P \"Variable name: \" name) \";\" '>'n '>'n" "\"/**\" '>'n" "\"* Get the value of \" (s name) \".\" '>'n" "\"* @return value of \" (s name) \".\" '>'n" "\"*/\" '>'n" "'>'\"public \" (s type)" "(if (string= \"boolean\" (jde-gen-lookup-named 'type) ) " "\" is\" " "\" get\" ) " "(jde-gen-init-cap (jde-gen-lookup-named 'name))" "\"() \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\" '>'n" "\"return \" (s name) \";\" '>'n \"}\"" "'>'n '>'n" "\"/**\" '>'n" "\"* Set the value of \" (s name) \".\" '>'n" "\"* @param v Value to assign to \" (s name) \".\" '>'n" "\"*/\" '>'n" "'>'\"public void set\" (jde-gen-init-cap (jde-gen-lookup-named 'name))" "\"(\" (s type) \" v) \" " "(if jde-gen-k&r " "()" "'>'n)" "\"{\" '>'n" "'>'\"this.\" (s name) \" = v;\" '>'n \"}\" '>'n'>")))
+ '(jde-bug-saved-breakpoints nil)
+ '(jde-compile-option-sourcepath (quote ("/share/xsl/docbook/extensions/xalan2" "/projects/apache/xml-xalan/java/build/src" "/projects/apache/xml-xerces/java/build/src" "/projects/sun/resolver")) t)
+ '(jde-gen-cflow-if (quote ("(if (jde-parse-comment-or-quoted-p)" "'(l \"if\")" "'(l '> \"if (\" (p \"if-clause: \" clause) \") \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n'>'r'n" "\"} // end of if (\" (s clause) \")\"'>'n'>)" ")")))
+ '(jde-db-option-java-profile (quote (nil . "./java.prof")))
+ '(jde-javadoc-gen-author t)
+ '(jde-compile-option-depend-switch (quote ("-Xdepend")))
+ '(jde-setnu-mode-enable nil)
+ '(jde-run-applet-doc "")
+ '(jde-compile-option-vm-args nil)
+ '(jde-javadoc-gen-overview "")
+ '(jde-javadoc-gen-notree nil)
+ '(jde-run-option-garbage-collection (quote (t t)))
+ '(jde-db-mode-hook nil)
+ '(jde-javadoc-command-path "javadoc")
+ '(jde-db-option-heap-profile (quote (nil "./java.hprof" 5 20 "Allocation objects")))
+ '(jde-import-group-function (quote jde-import-group-of))
+ '(jde-db-read-vm-args nil)
+ '(jde-bug-debug nil)
+ '(jde-javadoc-end-block-template nil)
+ '(jde-javadoc-gen-packages nil)
+ '(jde-gen-cflow-if-else (quote ("(if (jde-parse-comment-or-quoted-p)" "'(l \"ife\")" "'(l '> \"if (\" (p \"if-clause: \" clause) \") \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n'>'r'n" "\"} // end of if (\" (s clause) \")\"'> n" "'> \"else \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n'>'r'n" "\"} // end of if (\" (s clause) \")else\"'>'n'>)" ")")))
+ '(jde-gen-cflow-while (quote ("(if (jde-parse-comment-or-quoted-p)" "'(l \"while\")" "'(l '> \"while (\" (p \"while-clause: \" clause) \") \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n'>'r'n" "\"} // end of while (\" (s clause) \")\"'>'n'>)" ")")))
+ '(jde-bug-server-socket (quote (t . "2112")))
+ '(jde-imenu-include-modifiers nil)
+ '(jde-appletviewer-option-encoding "")
+ '(jde-bug-breakpoint-cursor-colors (quote ("cyan" . "brown")))
+ '(jde-compile-option-target (quote ("1.1")))
+ '(jde-run-executable "")
+ '(jde-run-option-heap-size (quote ((1 . "megabytes") (16 . "megabytes"))))
+ '(jde-gen-cflow-switch (quote ("(if (jde-parse-comment-or-quoted-p)" "'(l \"switch\")" "'(l '> \"switch (\" (p \"switch-condition: \" clause) \") \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n'" "\"case \" (p \"first value: \") \":\"'>'n'>'p'n" "\"break;\"'>'n'>'p'n" "\"default:\"'>'n'>'p'n" "\"break;\"'>'n" "\"} // end of switch (\" (s clause) \")\"'>'n'>)" ")")))
+ '(jde-which-method-abbrev-symbol "~")
+ '(jde-db-option-vm-args nil)
+ '(jde-run-application-class "org.apache.xalan.xslt.Process" t)
+ '(jde-javadoc-gen-doclet "")
+ '(jde-import-auto-sort nil)
+ '(jde-run-option-verbose (quote (nil nil nil)))
+ '(jde-project-file-name "prj.el")
+ '(jde-compile-option-debug (quote ("selected" (t nil nil))) t)
+ '(jde-bug-jre-home "")
+ '(jde-import-sorted-groups nil)
+ '(jde-run-applet-viewer "")
+ '(jde-javadoc-return-tag-template "\"* @return \" (jde-javadoc-a type)
+ \" \" (jde-javadoc-code type) \" value\"")
+ '(jde-javadoc-gen-version t)
+ '(jde-javadoc-gen-helpfile "")
+ '(jde-import-excluded-packages (quote ("bsh.*")))
+ '(jde-run-read-vm-args nil)
+ '(jde-help-docsets nil)
+ '(jde-gen-inner-class-template (quote ("(end-of-line) '& \"class \" (P \"Class name: \" class)" "(P \"Superclass: \" super t)" "(let ((parent (jde-gen-lookup-named 'super)))" "(if (not (string= parent \"\"))" "(concat \" extends \" parent ))) " "(if jde-gen-k&r " "()" "'>'n)" "\"{\" '>'n" "\"public \" (s class) \"() \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "\"}\"'>'n" "\"}\" '>'n'>")))
+ '(jde-auto-parse-buffer-interval 180)
+ '(jde-run-option-verify (quote (nil t)))
+ '(jde-import-reverse-sort-group nil)
+ '(jde-compile-option-optimize nil)
+ '(jde-gen-cflow-case (quote ("(if (jde-parse-comment-or-quoted-p)" "'(l \"case\")" "'(l 'n \"case \" (p \"value: \") \":\"'>'n'>'p'n" "\"break;\"'>'n'>'p)" ")")))
+ '(jde-compile-option-depend nil)
+ '(jde-javadoc-describe-class-template "\"* Describe class \" (jde-javadoc-code name) \" here.\"")
+ '(jde-javadoc-gen-serialwarn nil)
+ '(jde-gen-action-listener-template (quote ("'& (P \"Component name: \")" "\".addActionListener(new ActionListener() \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "\"public void actionPerformed(ActionEvent e) \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "\"}\"'>'n \"});\"'>'n'>")))
+ '(jde-auto-parse-enable t)
+ '(jde-compile-option-command-line-args "")
+ '(jde-gen-buffer-templates (quote (("Class" . jde-gen-class) ("Console" . jde-gen-console) ("Swing App" . jde-gen-jfc-app))))
+ '(jde-project-context-switching-enabled-p t)
+ '(jde-javadoc-gen-args nil)
+ '(jde-run-option-stack-size (quote ((128 . "kilobytes") (400 . "kilobytes"))))
+ '(jde-run-option-properties nil t))
+
+