Skip to content

Commit 1190da9

Browse files
committed
Resolve #187: Make delimiter in concat optional
Makes the `delimiter` attribute in the `concat` collector optional. If no delimiter is set then an empty string is used.
1 parent f12a4da commit 1190da9

File tree

2 files changed

+29
-8
lines changed

2 files changed

+29
-8
lines changed

src/main/resources/schemata/metamorph.xsd

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@
217217
<element name="all">
218218
<annotation>
219219
<documentation>Outputs an unnamed literal with "true" as value if all
220-
contained statements fire. This is essentially a conjunction (logical
220+
contained statements fire. This is essentially a conjunction (logical
221221
and-operation) of all contained statements. The name and value generated
222222
by the all-statement can be customised.</documentation>
223223
</annotation>
@@ -236,7 +236,7 @@
236236
<element name="any">
237237
<annotation>
238238
<documentation>Outputs an unnamed literal with "true" as value if any of
239-
the contained statements fires. This is essentially a disjunction (logical
239+
the contained statements fires. This is essentially a disjunction (logical
240240
or-operation) of all contained statements. The name and value generated
241241
by the all-statement can be customised.</documentation>
242242
</annotation>
@@ -264,7 +264,7 @@
264264
</sequence>
265265
<attribute name="name" type="string" use="optional" />
266266
<attribute name="value" type="string" use="optional" />
267-
<attribute name="flushWith" type="string" use="optional"
267+
<attribute name="flushWith" type="string" use="optional"
268268
default="record" />
269269
<attribute name="reset" type="boolean" use="optional"
270270
default="false" />
@@ -288,7 +288,7 @@
288288
<attribute name="flushWith" type="string" use="optional" />
289289
</complexType>
290290
</element>
291-
291+
292292
<element name="equalsFilter">
293293
<complexType>
294294
<sequence>
@@ -313,12 +313,12 @@
313313
</annotation>
314314
<complexType>
315315
<sequence>
316-
<element ref="tns:if" minOccurs="0" maxOccurs="1" />
316+
<element ref="tns:if" minOccurs="0" maxOccurs="1" />
317317
<group ref="tns:literal-rule" minOccurs="1" maxOccurs="unbounded" />
318318
<element ref="tns:postprocess" minOccurs="0" maxOccurs="1" />
319319
</sequence>
320320
<attribute name="name" type="string" use="required" />
321-
<attribute name="delimiter" type="string" use="required" />
321+
<attribute name="delimiter" type="string" use="optional" default="" />
322322
<attribute name="prefix" type="string" use="optional" />
323323
<attribute name="postfix" type="string" use="optional" />
324324
<attribute name="reverse" type="boolean" use="optional" default="false">
@@ -506,7 +506,7 @@
506506
</sequence>
507507
</complexType>
508508
</element>
509-
509+
510510
<element name="postprocess">
511511
<annotation>
512512
<documentation>The functions contained here are applied to the final
@@ -691,7 +691,7 @@
691691
<!-- <complexType> -->
692692
<!-- <attribute name="name" type="string" use="required" /> -->
693693
<!-- <attribute name="value" type="string" use="required" /> -->
694-
<!-- <attribute name="in" type="string" use="optional" default="record"
694+
<!-- <attribute name="in" type="string" use="optional" default="record"
695695
/> -->
696696
<!-- </complexType> -->
697697
<!-- </element> -->

src/test/java/org/culturegraph/mf/morph/collectors/ConcatTest.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,4 +190,25 @@
190190
</result>
191191
</test-case>
192192

193+
<test-case name="issue187_shouldUseEmptyDelimiterAsDefault">
194+
<input type="text/x-formeta">
195+
{
196+
lit: data1,
197+
lit: data2
198+
}
199+
</input>
200+
<transformation type="text/x-metamorph+xml">
201+
<mm:metamorph version="1">
202+
<mm:rules>
203+
<mm:concat name="concat">
204+
<mm:data source="lit" />
205+
</mm:concat>
206+
</mm:rules>
207+
</mm:metamorph>
208+
</transformation>
209+
<result type="text/x-formeta">
210+
{ concat: data1data2 }
211+
</result>
212+
</test-case>
213+
193214
</metamorph-test>

0 commit comments

Comments
 (0)