DEV-NOTES|Gradle: Reading Eclipses codeformatter xml file

This little code snippet transforms the code formatter XML description file into a properties structure which could be applied to the JDT properties later on.

<br />
def initializeFormatter() {<br />
  def formatterDefinitions = new XmlSlurper.parse(&quot;$rootDir/misc/codeformatter.xml&quot;)<br />
  assert formatterDefinitions instanceof GPathResult</p>
<p>  def Properties props = new Properties()</p>
<p>  formatterDefinitions.&#039;**&#039;.findAll{ node -&gt;<br />
    node.name() == &#039;setting&#039;<br />
  }*.each { n -&gt;<br />
    props.put(n.@id.text(), n.@value.text()<br />
  }</p>
<p>  return props<br />
}<br />

Pure XSL localization

Transforming XML data to a human readable presentation of content could be easily done using XSL stylesheet transformations. Even various task could be performed by a standard XSL processor without demanding additional programming language integration. The following example sets up a project structure, needed resource files and transformations to localise the output of an XML transformation by purely using XSLT and XPath.
„Pure XSL localization“ weiterlesen