Hello,
I was just wondering if it is planned (or maybe there is a way already) to
filter a List/Sequence for specific elements and get a subset of matching
elements: preferably with a one-liner without a <#list> directive
e.g. in Java 8 pseudo code I can write something like this:
*xmlNode.getChildren().filter(c -> c.attr("xml:lang") ==
"x-default").first();*
E.g. to access the first XML by attribute lang="x-default" sub-node this
this:
[image: unnamed.png]
I am wondering if this is (theoretically) possible with freemarker.
e.g.
*xmlNode?children?filterList(node -> attr(node, "lang") ==
"x-default")?first*
Note: attr() would be a custom TemplateMethodModel function from us.
Thanks in advance for thoughts. Maybe for FM3 something like this is
planned, although we would appreciate such syntactical sugar also in FM2 :)
Thanks
Christoph
--
Christoph Rüger, Geschäftsführer
Synesty <https://synesty.com/> - Anbinden und Automatisieren ohne
Programmieren - Automatisierung, Schnittstellen, Datenfeeds
Xing: https://www.xing.com/profile/Christoph_Rueger2
LinkedIn: http://www.linkedin.com/pub/christoph-rueger/a/685/198
--
Synesty GmbH
Moritz-von-Rohr-Str. 1a
07745 Jena
Tel.: +49 3641 5596493Fax.:
+49 3641 5596499
Internet: https://synesty.com <https://synesty.com>
Geschäftsführer: Christoph Rüger
Unternehmenssitz: Jena
Handelsregister B
beim Amtsgericht: Jena
Handelsregister-Nummer: HRB 508766
Ust-IdNr.:
DE287564982