diff options
Diffstat (limited to 'src/java/org/apache/fop/fo/PropertyList.java')
-rw-r--r-- | src/java/org/apache/fop/fo/PropertyList.java | 51 |
1 files changed, 24 insertions, 27 deletions
diff --git a/src/java/org/apache/fop/fo/PropertyList.java b/src/java/org/apache/fop/fo/PropertyList.java index 709c4303b..a1634e868 100644 --- a/src/java/org/apache/fop/fo/PropertyList.java +++ b/src/java/org/apache/fop/fo/PropertyList.java @@ -264,6 +264,13 @@ public abstract class PropertyList { return -1; } + private String addAttributeToList(Attributes attributes, + String attributeName) throws ValidationException { + String attributeValue = attributes.getValue(attributeName); + convertAttributeToProperty(attributes, attributeName, attributeValue); + return attributeValue; + } + /** * Adds the attributes, passed in by the parser to the PropertyList * @@ -278,44 +285,35 @@ public abstract class PropertyList { * need them before all others (possible from-table-column() on any * other property further in the list... */ - String attributeName = "column-number"; - String attributeValue = attributes.getValue(attributeName); - convertAttributeToProperty(attributes, attributeName, - attributeValue); - attributeName = "number-columns-spanned"; - attributeValue = attributes.getValue(attributeName); - convertAttributeToProperty(attributes, attributeName, - attributeValue); + addAttributeToList(attributes, "column-number"); + addAttributeToList(attributes, "number-columns-spanned"); /* * If font-size is set on this FO, must set it first, since * other attributes specified in terms of "ems" depend on it. */ - attributeName = "font"; - attributeValue = attributes.getValue(attributeName); - convertAttributeToProperty(attributes, attributeName, - attributeValue); - if (attributeValue == null) { + String checkValue = addAttributeToList(attributes, "font"); + if (checkValue == null || "".equals(checkValue)) { /* * font shorthand wasn't specified, so still need to process * explicit font-size */ - attributeName = "font-size"; - attributeValue = attributes.getValue(attributeName); - convertAttributeToProperty(attributes, attributeName, - attributeValue); + addAttributeToList(attributes, "font-size"); } + String attributeName; + String attributeValue; String attributeNS; FopFactory factory = getFObj().getUserAgent().getFactory(); for (int i = 0; i < attributes.getLength(); i++) { /* convert all attributes with the same namespace as the fo element - * the "xml:lang" property is a special case */ + * the "xml:lang" and "xml:base" properties are special cases */ attributeNS = attributes.getURI(i); attributeName = attributes.getQName(i); attributeValue = attributes.getValue(i); if (attributeNS == null || attributeNS.length() == 0 - || "xml:lang".equals(attributeName)) { + || "xml:lang".equals(attributeName) + || "xml:base".equals(attributeName)) { convertAttributeToProperty(attributes, attributeName, attributeValue); } else if (!factory.isNamespaceIgnored(attributeNS)) { ElementMapping mapping = factory.getElementMappingRegistry().getElementMapping( @@ -368,15 +366,14 @@ public abstract class PropertyList { String attributeValue) throws ValidationException { - if (attributeValue != null) { - - if (attributeName.startsWith("xmlns:") - || "xmlns".equals(attributeName)) { - //Ignore namespace declarations if the XML parser/XSLT processor - //reports them as 'regular' attributes - return; - } + if (attributeName.startsWith("xmlns:") + || "xmlns".equals(attributeName)) { + /* Ignore namespace declarations if the XML parser/XSLT processor + * reports them as 'regular' attributes */ + return; + } + if (attributeValue != null) { /* Handle "compound" properties, ex. space-before.minimum */ String basePropertyName = findBasePropertyName(attributeName); String subPropertyName = findSubPropertyName(attributeName); |