public String getSystemId(Templates templates) { if(templates instanceof PreparedStyleSheet) { DocumentImpl doc = ((PreparedStyleSheet)templates).getStyleSheetDocument(); if(doc != null) { return doc.getSystemId(); } } return null; }
@Override public void leave(NodeInfo node, Context arg1) { currentStep.end = System.nanoTime(); currentStep.endInsNo = instructionCount; if(currentStep.getTime() < granularity) { currentStep.parent.children.remove(currentStep); } else { if(recordAttributes) { if(node instanceof ElementWithAttributes) { currentStep.attributes = new HashMap<String, String>(); ElementWithAttributes elem = (ElementWithAttributes)node; AttributeCollection attrs = elem.getAttributeList(); for(int i=0; i<attrs.getLength(); i++) { currentStep.attributes.put(attrs.getQName(i), attrs.getValue(i)); } } } } currentStep = currentStep.parent; }
public void startSpan(Emitter rtf, String id) throws TransformerException { if (!foStylesheet && namePool != null) { if(xhStylesheet) { uri = xhURI; } int spanName = namePool.allocate("", uri, "span"); AttributeCollection spanAttr = new AttributeCollection(namePool); int namespaces[] = new int[1]; spanAttr.addAttribute("", uri, "class", "CDATA", "co"); spanAttr.addAttribute("", uri, "id", "CDATA", id); rtf.startElement(spanName, spanAttr, namespaces, 0); } }
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 = ""; newAttr.addAttribute(prefix, uri, localName, type, value);
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++]); 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++]);
private static void blockToSaxon6Node(Block b, Builder builder, NamePool pool, Config config) throws Exception { if (b.isStyled()) { AttributeCollection emptyAtts = new AttributeCollection(pool); int elemId = pool.allocate(config.prefix, config.uri, ((StyledBlock) b).getStyle()); builder.startElement(elemId, emptyAtts, new int[0], 0); builder.characters(b.getText().toCharArray(), 0, b.getText() .length()); builder.endElement(elemId); } else { builder.characters(b.getText().toCharArray(), 0, b.getText() .length()); } }
AttributeCollection newAttr = new AttributeCollection(namePool); for (int acount = 0; acount < attr.getLength(); acount++) { String localName = attr.getLocalName(acount); String type = attr.getType(acount); String value = attr.getValue(acount); String uri = attr.getURI(acount); String prefix = ""; newAttr.addAttribute(prefix, uri, localName, type, value);
imgAttr = new AttributeCollection(namePool); imgAttr.addAttribute("", "", "src", "CDATA", "url(" + graphicsPath + num + graphicsExt + ")"); imgAttr.addAttribute("", "", "id", "CDATA", id); imgAttr.addAttribute("", "", "content-width", "CDATA", iconSize); imgAttr.addAttribute("", "", "width", "CDATA", iconSize); imgAttr = new AttributeCollection(namePool); imgAttr.addAttribute("", "", "src", "CDATA", graphicsPath + num + graphicsExt); imgAttr.addAttribute("", "", "alt", "CDATA", label);
public static NodeEnumeration tokenize(Context context, String str, String pattern) throws XPathException { try { Builder builder = context.getController().makeBuilder(); NamePool pool = context.getController().getNamePool(); builder.setNamePool(pool); builder.startDocument(); int name = pool.allocate("", "", "token"); AttributeCollection emptyAtts = new AttributeCollection(pool); String[] tokens = str.split(pattern); for(String token: tokens) { builder.startElement(name, emptyAtts, new int[0], 0); builder.characters(token.toCharArray(), 0, token.length()); builder.endElement(name); } builder.endDocument(); DocumentInfo doc = builder.getCurrentDocument(); return doc.getEnumeration(Axis.CHILD, AnyNodeTest.getInstance()); } catch (Exception err) { ExtensionFunctionUtils.setExtensionFunctionError(err); throw new XPathException(err); } }
public void doPerformanceTracing(Transformer transformer, Templates templates) { String systemId = ((PreparedStyleSheet)templates).getStyleSheetDocument().getSystemId(); Saxon1XSLTraceListener tl=new Saxon1XSLTraceListener(systemId); Controller c=(Controller)transformer; c.setTraceListener(tl); c.setLineNumbering(true); }
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 = ""; newAttr.addAttribute(prefix, uri, localName, type, value);
if (foStylesheet) { inName = namePool.allocate("fo", foURI, "inline"); inAttr = new AttributeCollection(namePool); inAttr.addAttribute("", "", "font-family", "CDATA", unicodeFont); inAttr.addAttribute("", "", "id", "ID", id); inAttr = new AttributeCollection(namePool); inAttr.addAttribute("", "", "face", "CDATA", unicodeFont); inAttr.addAttribute("", "", "id", "ID", id);
AttributeCollection inlineAttr = new AttributeCollection(namePool); int namespaces[] = new int[1]; inlineAttr.addAttribute("", "", "id", "CDATA", id); rtfEmitter.startElement(inlineName, inlineAttr, namespaces, 0);