diff --git a/lib/OpenLayers/Format/Filter/v1.js b/lib/OpenLayers/Format/Filter/v1.js index 6757456d1e..fcbe0a49a7 100644 --- a/lib/OpenLayers/Format/Filter/v1.js +++ b/lib/OpenLayers/Format/Filter/v1.js @@ -27,7 +27,7 @@ OpenLayers.Format.Filter.v1 = OpenLayers.Class(OpenLayers.Format.XML, { xlink: "http://www.w3.org/1999/xlink", xsi: "http://www.w3.org/2001/XMLSchema-instance" }, - + /** * Property: defaultPrefix */ @@ -180,18 +180,18 @@ OpenLayers.Format.Filter.v1 = OpenLayers.Class(OpenLayers.Format.XML, { }, "Literal": function(node, obj) { obj.value = OpenLayers.String.numericIf( - this.getChildValue(node)); + this.getChildValue(node).replace(this.regExes.trimSpace, "")); }, "PropertyName": function(node, filter) { filter.property = this.getChildValue(node); }, "LowerBoundary": function(node, filter) { filter.lowerBoundary = OpenLayers.String.numericIf( - this.readers.ogc._expression.call(this, node)); + this.readers.ogc._expression.call(this, node).replace(this.regExes.trimSpace, "")); }, "UpperBoundary": function(node, filter) { filter.upperBoundary = OpenLayers.String.numericIf( - this.readers.ogc._expression.call(this, node)); + this.readers.ogc._expression.call(this, node).replace(this.regExes.trimSpace, "")); }, "Intersects": function(node, obj) { this.readSpatial(node, obj, OpenLayers.Filter.Spatial.INTERSECTS); diff --git a/tests/Format/SLD/v1_0_0.html b/tests/Format/SLD/v1_0_0.html index a295a746b8..1f50e4fa14 100644 --- a/tests/Format/SLD/v1_0_0.html +++ b/tests/Format/SLD/v1_0_0.html @@ -523,6 +523,14 @@ } + function test_whitespace(t) { + t.plan(1); + var xml = readXML("propertyisbetweenwhitespace.sld"); + var output = new OpenLayers.Format.SLD().read(xml); + var filter = output.namedLayers['geonode:US_Stat0'].userStyles[0].rules[0].filter; + t.eq(filter.lowerBoundary, 29.7, "whitespace ignored in values and value transformed to number"); + } + function test_label_LinePlacement(t) { t.plan(1); var format = new OpenLayers.Format.SLD.v1_0_0({ @@ -970,5 +978,51 @@ --> +