public void merge(QName name, String value) { merge(new StyleSpecification(name, value)); }
private static StyleSet getISDStyleSet(Element elt) { Map<QName,String> attrs = Documents.getAttributes(elt); QName qnId = XML.getIdAttributeName(); String id = attrs.get(qnId); if ((id != null) && !id.isEmpty()) { StyleSet css = new StyleSet(id); for (Map.Entry<QName,String> e : attrs.entrySet()) { QName qn = e.getKey(); if (!qn.equals(qnId)) css.merge(qn, e.getValue()); } return css; } else return null; }
private static StyleSet getInlineStyles(Element e, int[] indices) { StyleSet styles = new StyleSet(generateStyleSetIndex(indices)); NamedNodeMap attrs = e.getAttributes(); for (int i = 0, n = attrs.getLength(); i < n; ++i) { Node node = attrs.item(i); if (node instanceof Attr) { Attr a = (Attr) node; String ns = a.getNamespaceURI(); if ((ns != null) && ns.equals(NAMESPACE_TT_STYLE)) { styles.merge(new StyleSpecification(new ComparableQName(a.getNamespaceURI(), a.getLocalName()), a.getValue())); } } } return styles; }
private static StyleSet getInlineStyles(Element elt, TransformerContext context) { StyleSet styles = new StyleSet(); NamedNodeMap attrs = elt.getAttributes(); for (int i = 0, n = attrs.getLength(); i < n; ++i) { Node node = attrs.item(i); if (node instanceof Attr) { Attr a = (Attr) node; String nsUri = a.getNamespaceURI(); if (nsUri != null) { QName styleName = new ComparableQName(a.getNamespaceURI(), a.getLocalName()); if (isDefinedStyle(styleName, context)) styles.merge(new StyleSpecification(styleName, a.getValue())); } } } return styles; }
private static StyleSet computeInitialStyleOverrides(Document doc, TransformerContext context) { StyleSet overrides = new StyleSet(); for (Element initial : getInitialElements(doc, context)) { overrides.merge(getInlineStyles(initial, context), context.getConditionEvaluatorState()); } return overrides; }
private static StyleSet applicableStyles(StyleSet ss, Element elt, TransformerContext context) { boolean containsInapplicableStyle = false; QName eltName = new QName(elt.getNamespaceURI(), elt.getLocalName()); for (StyleSpecification s : ss.getStyles().values()) { if (!doesStyleApply(eltName, s.getName(), context)) { containsInapplicableStyle = true; break; } } if (!containsInapplicableStyle) return ss; else { StyleSet ssNew = new StyleSet(ss.getGeneration()); for (StyleSpecification s : ss.getStyles().values()) { if (doesStyleApply(eltName, s.getName(), context)) { ssNew.merge(s); } } return ssNew; } }