<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>XML, XSLT &#38; Java &#187; Apache Ant</title>
	<atom:link href="http://blog.expedimentum.com/kategorien/apache-ant/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.expedimentum.com</link>
	<description>Texte und Metadaten verarbeiten. Fundstücke und Beispiele</description>
	<lastBuildDate>Thu, 17 May 2012 10:13:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Apache Ant: Initialen Mode und Initiales Template für XSLT 2.0 mit Saxon setzen</title>
		<link>http://blog.expedimentum.com/2011/apache_ant_initialer_mode_initiales_template/</link>
		<comments>http://blog.expedimentum.com/2011/apache_ant_initialer_mode_initiales_template/#comments</comments>
		<pubDate>Sat, 02 Apr 2011 21:00:24 +0000</pubDate>
		<dc:creator>Stf</dc:creator>
				<category><![CDATA[Apache Ant]]></category>
		<category><![CDATA[XSLT und XPath]]></category>

		<guid isPermaLink="false">http://blog.expedimentum.com/?p=351</guid>
		<description><![CDATA[Ein schönes Feature von XSLT&#160;2.0 ist, dass man ein Stylesheet in einem initialen Mode oder mit einem initialen Template starten kann (siehe Standard). Ich benutze diese Möglichkeit gern, um Selbsttests direkt im Stylesheet unterzubringen und über einen initialen Mode auszuführen – ohne die eigentliche Logik des Stylesheets zu beeinflussen. In OxygenXML kann man den initialen [...]]]></description>
			<content:encoded><![CDATA[<p>Ein schönes Feature von <a href="http://blog.expedimentum.com/glossar/xslt/" >XSLT</a>&nbsp;2.0 ist, dass man ein Stylesheet in einem initialen Mode oder mit einem initialen Template starten kann (siehe <a href="http://www.w3.org/TR/xslt20/#initiating">Standard</a>). Ich benutze diese Möglichkeit gern, um Selbsttests direkt im Stylesheet unterzubringen und über einen initialen Mode auszuführen – ohne die eigentliche Logik des Stylesheets zu beeinflussen.</p>
<p>In <a href="http://blog.expedimentum.com/oxygen/" >OxygenXML</a> kann man den initialen Mode oder das initiale Template prima im Transformationsszenario einstellen, der kleine Button mit dem rasenden Zahnrädchen neben der Auswahlliste für die Transformations-Engine öffnet den passenden Einstellungs-Dialog (siehe <a href="http://www.oxygenxml.com/doc/ug-oxygen/topics/defining-new-transformation-scenario.html#defining-new-transformation-scenario__advanced-transform-options-dialog">Dokumentation</a>).</p>
<p>Schon vor geraumer Zeit wollte ich diese Feature auch mit <a href="http://blog.expedimentum.com/glossar/apache-ant/" >Apache Ant</a> nutzen, bin aber wegen <a href="http://markmail.org/thread/7hzgqbzdej4vryc4">fehlender Unterstützung durch Saxon</a> und einen zwischenzeitlichen <a href="https://issues.apache.org/bugzilla/show_bug.cgi?id=49271">Ant-Bug in Version 1.8.1</a> nicht weitergekommen. Inzwischen wurden <a href="http://blog.expedimentum.com/glossar/saxon/" >Saxon</a> und <a href="http://blog.expedimentum.com/glossar/apache-ant/" >Ant</a> aktualisiert, so dass es Zeit für einen neuen Anlauf war. Die größte Herausforderung war, die jeweils passende URI für die beiden Features zu finden, letztendlich habe ich in die Saxon-Quelltexte geschaut. So geht’s:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;test&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;xslt</span> <span style="color: #000066;">in</span>=<span style="color: #ff0000;">&quot;input.xml&quot;</span> <span style="color: #000066;">out</span>=<span style="color: #ff0000;">&quot;output.xml&quot;</span> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">&quot;stylesheet.xsl&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #808080; font-style: italic;">&lt;!-- Pfad zu Saxon an lokale Installation anpassen! --&gt;</span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;classpath</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;saxon9he.jar&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;factory</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;net.sf.saxon.TransformerFactoryImpl&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
			<span style="color: #808080; font-style: italic;">&lt;!-- hier ggfs. &quot;http://saxon.sf.net/feature/initialTemplate&quot; einsetzen --&gt;</span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;attribute</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;http://saxon.sf.net/feature/initialMode&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;MyMode&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/factory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/xslt<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Über die Factory-Attribute können auch viele weitere Saxon-Optionen – die oft auch über die Kommandozeile zu erreichen sind – von Ant aus gesteuert werden, etwa der Umgang mit Whitespace (<code>http://saxon.sf.net/feature/strip-whitespace</code>) oder die Zeilennummerierung (<code>http://saxon.sf.net/feature/linenumbering</code>). Das habe ich allerdings nicht getestet.</p>
<p><strong>Quellen:</strong></p>
<ul>
<li><a href="http://ant.apache.org/manual/Tasks/style.html">http://ant.apache.org/manual/Tasks/style.html</a> (unter »factory (&#8216;trax&#8217; processors only)« und »Using factory settings«)</li>
<li><a href="http://saxonica.com/documentation/configuration/config-interfaces/jaxp-configuration.xml">http://saxonica.com/documentation/configuration/config-interfaces/jaxp-configuration.xml</a></li>
<li><a href="http://saxonica.com/documentation/javadoc/constant-values.html#net.sf.saxon.lib.FeatureKeys.XSLT_INITIAL_MODE">http://saxonica.com/documentation/javadoc/constant-values.html</a> in Verbindung mit <a href="http://saxonica.com/documentation/javadoc/net/sf/saxon/TransformerFactoryImpl.html#setAttribute%28java.lang.String,%20java.lang.Object%29">http://saxonica.com/documentation/javadoc/net/sf/saxon/TransformerFactoryImpl.html</a> und <a href="http://saxonica.com/documentation/javadoc/net/sf/saxon/lib/FeatureKeys.html">http://saxonica.com/documentation/javadoc/net/sf/saxon/lib/FeatureKeys.html</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.expedimentum.com/2011/apache_ant_initialer_mode_initiales_template/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache Ant 1.8.2 unter Mac OS X einrichten</title>
		<link>http://blog.expedimentum.com/2011/apache-ant-1-8-2-unter-mac-os-x-einrichten/</link>
		<comments>http://blog.expedimentum.com/2011/apache-ant-1-8-2-unter-mac-os-x-einrichten/#comments</comments>
		<pubDate>Sun, 27 Feb 2011 02:59:33 +0000</pubDate>
		<dc:creator>Stf</dc:creator>
				<category><![CDATA[Apache Ant]]></category>
		<category><![CDATA[Mac OS X]]></category>

		<guid isPermaLink="false">http://blog.expedimentum.com/?p=339</guid>
		<description><![CDATA[Weil Ant 1.8.1 im XSLT-Task vergisst, den Classpath auszulesen, funktionieren mit dieser Version keine XSLT-2.0-Stylesheets (näheres siehe Bugzilla). Und weil Apple auch zwei Monate nach Erscheinen von Version 1.8.2 (mit dem Bugfix) noch kein Update durchgeführt hat, musste ich von Hand für Abhilfe sorgen. So geht’s: Ant 1.8.2 herunterladen und entpacken Ich habe den entpackten [...]]]></description>
			<content:encoded><![CDATA[<p>Weil <a href="http://blog.expedimentum.com/glossar/apache-ant/" >Ant</a> 1.8.1 im <a href="http://blog.expedimentum.com/glossar/xslt/" >XSLT</a>-Task vergisst, den Classpath auszulesen, funktionieren mit dieser Version keine XSLT-2.0-Stylesheets (näheres siehe <a href="https://issues.apache.org/bugzilla/show_bug.cgi?id=49271">Bugzilla</a>). Und weil Apple auch zwei Monate nach Erscheinen von Version 1.8.2 (mit dem Bugfix) noch kein Update durchgeführt hat, musste ich von Hand für Abhilfe sorgen. So geht’s:</p>
<ol>
<li>Ant 1.8.2 herunterladen und entpacken</li>
<li>Ich habe den entpackten Ordner unter <code>~/Applications</code> abgelegt, gleich neben der alten 1.8.0-Version. Bei mir sieht das dann so aus:<br/><br/>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">localhost:Applications stf$ <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-F</span> <span style="color: #660033;">-1</span>
Crane-xslstyle-<span style="color: #000000;">20100817</span>-0240z<span style="color: #000000; font-weight: bold;">/</span>
apache-ant-1.8.0<span style="color: #000000; font-weight: bold;">/</span>
apache-ant-1.8.2<span style="color: #000000; font-weight: bold;">/</span>
calabash-0.9.24<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

</li>
<li>Erzeugen eines SymLinks auf den Ant-Ordner. Dazu ein Terminalfenster öffnen und<br/><br/>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> ~<span style="color: #000000; font-weight: bold;">/</span>Applications<span style="color: #000000; font-weight: bold;">/</span>apache-ant-1.8.2 ~<span style="color: #000000; font-weight: bold;">/</span>Applications<span style="color: #000000; font-weight: bold;">/</span>ant</pre></div></div>

<p>eingeben. Durch Umbiegen des SymLinks auf ein anderes Verzeichnis kann man einfach auf andere Ant-Versionen umschalten: auf eine ältere oder später auch auf eine neuere.</li>
<li>Jetzt muss man <code>bash</code> – dem Programm hinter dem Terminalfenster – noch sagen, dass es die neue Ant-Version benutzen soll. Dazu fügt man der PATH-Variablen dem Pfad zum neuen Ant-Verzeichnis hinzu. Ich habe dazu im Benutzerverzeichnis eine Datei <code>./bash_profile</code> angelegt und folgendes hineingeschrieben:<br/><br/>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> running ~<span style="color: #000000; font-weight: bold;">/</span>.bash_profile
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PATH</span>=~<span style="color: #000000; font-weight: bold;">/</span>Applications<span style="color: #000000; font-weight: bold;">/</span>ant<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #007800;">$PATH</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">ANT_HOME</span>=~<span style="color: #000000; font-weight: bold;">/</span>Applications<span style="color: #000000; font-weight: bold;">/</span>ant</pre></div></div>

<p>Die erste Zeile gibt bei jedem Konsolenstart eine Statusmeldung aus, die zweite Zeile setzt die PATH-Umgebungsvariable, die dritte Zeile sorgt dafür, das Ant seine Dateien findet.<br />
Da verborgene Dateien (mit Punkt am Anfang des Dateinamens) im Finder standardmäßig ausgeblendet werden, habe ich ganz UNIX-like auf der Konsole gearbeitet. Mit<br/><br/></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">pico ~<span style="color: #000000; font-weight: bold;">/</span>.bash_profile</pre></div></div>

<p>wird der Editor geöffnet, Speichern funktioniert über <code>CTRL-o</code>, Verlassen mit <code>CTRL-x</code>.<br/></li>
<li>Eine neues Terminalfenster starten. In der zweiten Zeile sollte jetzt soetwas wie <code>running /Users/stf/.bash_profile</code> stehen. Mit dem Terminal-Kommando<br/>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">set</span></pre></div></div>

<p>lässt sich eine Liste der Umgebunsvariablen ausgeben, hier sollten jetzt für <code>PATH</code> und <code>ANT_HOME</code> die neuen Werte angezeigt werden. Schließlich bringt die Versionsangabe mit</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ant <span style="color: #660033;">-v</span></pre></div></div>

<p>Gewissheit, ob alles geklappt hat.
</li>
</ol>
<p>Meine Helferlein auf diesem Weg waren die beiden unten angegebenen Artikel sowie <code>man ln</code> und <code>man ls</code>.</p>
<p>Hoffen wir, dass Apple bald auf 1.8.2 aktualisiert und zukünftig solche Workarounds nicht mehr notwendig sind …</p>
<p><strong>Quellen:</strong></p>
<ul>
<li><a href="http://stackoverflow.com/questions/4810089/how-to-use-an-alternate-version-of-apache-ant-on-os-x-without-installing-over-exi">Stackoverflow: How to use an alternate version of Apache Ant on OS X without installing over existing version?</a> (englisch)</li>
<li>Cameron Hayne: <a href="http://hayne.net/MacDev/Notes/unixFAQ.html#executionPath">Unix FAQ (for OS X)</a> (englisch) – eine sehr übersichtliche Seite mit dem wichtigsten, was man über UNIX unter Mac OS X wissen muss.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.expedimentum.com/2011/apache-ant-1-8-2-unter-mac-os-x-einrichten/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

