<?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>bojan.blog &#187; Programming</title>
	<atom:link href="http://bojand.org/blog/category/programming/feed" rel="self" type="application/rss+xml" />
	<link>http://bojand.org/blog</link>
	<description></description>
	<lastBuildDate>Sun, 11 Apr 2010 04:03:46 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>XML parsing with Perl using XPath</title>
		<link>http://bojand.org/blog/68.html</link>
		<comments>http://bojand.org/blog/68.html#comments</comments>
		<pubDate>Mon, 21 Aug 2006 22:01:43 +0000</pubDate>
		<dc:creator>Bojan</dc:creator>
				<category><![CDATA[Data Processing]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[xpath]]></category>

		<guid isPermaLink="false">http://bojan.info/blog/?p=68</guid>
		<description><![CDATA[
use strict;
use XML::LibXML;

# data source
my $xml_filename = &#34;xml/data.xml&#34;;

my $parser = XML::LibXML-&#62;new;
my $doc = $parser-&#62;parse_file($xml_filename);

my $xpath = &#34;//word/entry[\@src=\&#34;pr\&#34;]/..&#34;;
my @words = $doc-&#62;findnodes($xpath);

foreach my $word (@words) {
	print $word-&#62;findvalue(&#34;\@id&#34;);
	print &#34;\n&#34;;
}

]]></description>
			<content:encoded><![CDATA[<pre class="brush: perl;">
use strict;
use XML::LibXML;

# data source
my $xml_filename = &quot;xml/data.xml&quot;;

my $parser = XML::LibXML-&gt;new;
my $doc = $parser-&gt;parse_file($xml_filename);

my $xpath = &quot;//word/entry[\@src=\&quot;pr\&quot;]/..&quot;;
my @words = $doc-&gt;findnodes($xpath);

foreach my $word (@words) {
	print $word-&gt;findvalue(&quot;\@id&quot;);
	print &quot;\n&quot;;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://bojand.org/blog/68.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>File modified timestamp with Perl</title>
		<link>http://bojand.org/blog/63.html</link>
		<comments>http://bojand.org/blog/63.html#comments</comments>
		<pubDate>Mon, 21 Aug 2006 21:43:29 +0000</pubDate>
		<dc:creator>Bojan</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[timestamp]]></category>

		<guid isPermaLink="false">http://bojan.info/blog/63.html</guid>
		<description><![CDATA[This is how to quickly get the timestamp of when the file was last modified in Perl:

$lastmod = (stat($filename))[9];

]]></description>
			<content:encoded><![CDATA[<p>This is how to quickly get the timestamp of when the file was last modified in Perl:</p>
<pre class="brush: perl; gutter: false;">
$lastmod = (stat($filename))[9];
</pre>
]]></content:encoded>
			<wfw:commentRss>http://bojand.org/blog/63.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XSLT transform with Perl</title>
		<link>http://bojand.org/blog/53.html</link>
		<comments>http://bojand.org/blog/53.html#comments</comments>
		<pubDate>Mon, 21 Aug 2006 21:27:11 +0000</pubDate>
		<dc:creator>Bojan</dc:creator>
				<category><![CDATA[Data Processing]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[xslt]]></category>

		<guid isPermaLink="false">http://bojan.info/blog/?p=53</guid>
		<description><![CDATA[Here is a Perl snippet that transforms an XML file with XSLT:

use strict;
use XML::XSLT::Wrapper;

my $xml_input_filename = &#34;xml/data.xml&#34;;
my $xml_output_filename = &#34;xml/out.xml&#34;;
my $xsl_filename = &#34;xml/transform.xslt&#34;;

my $xslt = XML::XSLT::Wrapper-&#62;new(
		ProcessorList =&#62; [
			'libxslt',
			'sablotron',
			'xslt'
		],
	);
my $result = $xslt-&#62;transform(
		OutFile =&#62; $xml_output_filename,
		xml =&#62; $xml_input_filename,
		xsl =&#62; $xsl_filename,
	);
$xslt-&#62;dispose();


Values given to [code]]czo2OlwieG1sID0+XCI7e1smKiZdfQ==[[/code] and [code]]czo2OlwieHNsID0+XCI7e1smKiZdfQ==[[/code] can be either file names, or xml/xslt code passed as a string.
If [code]]czo3OlwiT3V0RmlsZVwiO3tbJiomXX0=[[/code] [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a Perl snippet that transforms an XML file with XSLT:</p>
<pre class="brush: perl;">
use strict;
use XML::XSLT::Wrapper;

my $xml_input_filename = &quot;xml/data.xml&quot;;
my $xml_output_filename = &quot;xml/out.xml&quot;;
my $xsl_filename = &quot;xml/transform.xslt&quot;;

my $xslt = XML::XSLT::Wrapper-&gt;new(
		ProcessorList =&gt; [
			'libxslt',
			'sablotron',
			'xslt'
		],
	);
my $result = $xslt-&gt;transform(
		OutFile =&gt; $xml_output_filename,
		xml =&gt; $xml_input_filename,
		xsl =&gt; $xsl_filename,
	);
$xslt-&gt;dispose();
</pre>
<p><span id="more-53"></span></p>
<p>Values given to [code]]czo2OlwieG1sID0+XCI7e1smKiZdfQ==[[/code] and [code]]czo2OlwieHNsID0+XCI7e1smKiZdfQ==[[/code] can be either file names, or xml/xslt code passed as a string.</p>
<p>If [code]]czo3OlwiT3V0RmlsZVwiO3tbJiomXX0=[[/code] is ommited, then the result of the transformation is returned to the variable [code]]czo3OlwiJHJlc3VsdFwiO3tbJiomXX0=[[/code].</p>
]]></content:encoded>
			<wfw:commentRss>http://bojand.org/blog/53.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
