<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    <title>Pure XML Blog</title>
    <link>http://pure-xml.com/cblog/</link>
    <description>pure-xml.com</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.4.1 - http://www.s9y.org/</generator>
    <pubDate>Tue, 02 Aug 2011 16:59:09 GMT</pubDate>

    <image>
        <url>http://pure-xml.com/cblog/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: Pure XML Blog - pure-xml.com</title>
        <link>http://pure-xml.com/cblog/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Transform XML using PHP DOMDocument and XslProcessor</title>
    <link>http://pure-xml.com/cblog/index.php?/archives/13-Transform-XML-using-PHP-DOMDocument-and-XslProcessor.html</link>
    
    <comments>http://pure-xml.com/cblog/index.php?/archives/13-Transform-XML-using-PHP-DOMDocument-and-XslProcessor.html#comments</comments>
    <wfw:comment>http://pure-xml.com/cblog/wfwcomment.php?cid=13</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://pure-xml.com/cblog/rss.php?version=2.0&amp;type=comments&amp;cid=13</wfw:commentRss>
    

    <author>nospam@example.com (gcd5137)</author>
    <content:encoded>
    &lt;p&gt;The sample code below can to transform XML using XSL using PHP. &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;First, set up the XSL processor and stylesheet.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;#160; $xp = new XsltProcessor();&lt;br /&gt;&amp;#160; $xsl = new DOMDocument();&lt;br /&gt;&amp;#160; $xsl-&amp;gt;load(&amp;quot;my-xsl-file.xsl&amp;quot;);&lt;br /&gt;&amp;#160; $xp-&amp;gt;importStylesheet($xsl);&lt;/font&gt;&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Next, load the XML file to be transformed.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;br /&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;#160; $xml = new DOMDocument();&lt;br /&gt;&amp;#160; $xml-&amp;gt;load(&amp;quot;xml-to-transform.xml&amp;quot;);&lt;/font&gt;&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Lastly, transform the XML and display the result.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;br /&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;#160; $html = $xp-&amp;gt;transformToXML($xml);&lt;br /&gt;&amp;#160; echo $html;&lt;/font&gt;&lt;br /&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Tue, 02 Aug 2011 12:59:09 -0400</pubDate>
    <guid isPermaLink="false">http://pure-xml.com/cblog/index.php?/archives/13-guid.html</guid>
    
</item>
<item>
    <title>Transform RSS XML into plist for iOS</title>
    <link>http://pure-xml.com/cblog/index.php?/archives/12-Transform-RSS-XML-into-plist-for-iOS.html</link>
    
    <comments>http://pure-xml.com/cblog/index.php?/archives/12-Transform-RSS-XML-into-plist-for-iOS.html#comments</comments>
    <wfw:comment>http://pure-xml.com/cblog/wfwcomment.php?cid=12</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://pure-xml.com/cblog/rss.php?version=2.0&amp;type=comments&amp;cid=12</wfw:commentRss>
    

    <author>nospam@example.com (gcd5137)</author>
    <content:encoded>
    &lt;p&gt;I was working on an iPhone app project and found it to be much easier to load a .plist file than to go through the trouble of downloading and parsing an RSS feed. Luckily RSS is XML and so is a .plist file so XSLT to the rescue. Let&#039;s walk through the XSL.&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;As usual, check the namespaces in the input and add them to your XSL. In this case, I was pulling from the New York Times which was full of them.&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #3e38f5; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #4d9191; &quot;&gt;xsl:stylesheet &lt;/span&gt;&lt;span style=&quot;color: #94218c; &quot;&gt;version&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&amp;quot;1.0&amp;quot; &lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #3e38f5; &quot;&gt;&lt;span style=&quot;color: #94218c; &quot;&gt;&amp;#160;&amp;#160;exclude-result-prefixes&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&amp;quot;pheedo nyt media atom dc&amp;quot;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #3e38f5; &quot;&gt;&lt;span style=&quot;color: #94218c; &quot;&gt;&amp;#160;&amp;#160;xmlns:xsl&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&amp;quot;http://www.w3.org/1999/XSL/Transform&amp;quot;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #3e38f5; &quot;&gt;&lt;span style=&quot;color: #94218c; &quot;&gt;&amp;#160;&amp;#160;xmlns:dc&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&amp;quot;http://purl.org/dc/elements/1.1/&amp;quot;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #3e38f5; &quot;&gt;&lt;span style=&quot;color: #94218c; &quot;&gt;&amp;#160;&amp;#160;xmlns:media&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&amp;quot;http://search.yahoo.com/mrss/&amp;quot;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #3e38f5; &quot;&gt;&lt;span style=&quot;color: #94218c; &quot;&gt;&amp;#160;&amp;#160;xmlns:atom&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&amp;quot;http://www.w3.org/2005/Atom&amp;quot;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #3e38f5; &quot;&gt;&lt;span style=&quot;color: #333333; font-family: verdana, arial, geneva, helvetica, sans-serif; font-size: 13px; &quot;&gt;&lt;span style=&quot;color: #3e38f5; font-family: Monaco; font-size: 11px; &quot;&gt;&lt;span style=&quot;color: #94218c; &quot;&gt;&amp;#160;&amp;#160;xmlns:nyt&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&amp;quot;http://www.nytimes.com/namespaces/rss/2.0&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #3e38f5; &quot;&gt;&lt;span style=&quot;color: #333333; font-family: verdana, arial, geneva, helvetica, sans-serif; font-size: 13px; &quot;&gt;&lt;span style=&quot;color: #3e38f5; font-family: Monaco; font-size: 11px; &quot;&gt;&lt;span style=&quot;color: #94218c; &quot;&gt;&amp;#160;&amp;#160;xmlns:pheedo&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&amp;quot;http://www.pheedo.com/namespace/pheedo&amp;quot;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt; &lt;/p&gt; &lt;br /&gt;
&lt;p&gt; &lt;/p&gt; &lt;br /&gt;
&lt;p&gt;Next, set some of the important output options.&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #94218c; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #4d9191; &quot;&gt;xsl:output &lt;/span&gt;method&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #3e38f5; &quot;&gt;&amp;quot;xml&amp;quot; &lt;/span&gt;indent&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #3e38f5; &quot;&gt;&amp;quot;yes&amp;quot;&amp;#160;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #94218c; &quot;&gt;&lt;span style=&quot;color: #3e38f5; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #3e38f5; &quot;&gt;&lt;span style=&quot;color: #94218c; &quot;&gt;&amp;#160;&amp;#160;doctype-public&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&amp;quot;-//Apple//DTD PLIST 1.0//EN&amp;quot; &lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #94218c; &quot;&gt;&lt;span style=&quot;color: #3e38f5; &quot;&gt;&lt;span style=&quot;color: #94218c; &quot;&gt;&amp;#160;&amp;#160;doctype-system&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&amp;quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&amp;quot;&amp;#160;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #94218c; &quot;&gt;&lt;span style=&quot;color: #3e38f5; &quot;&gt;&lt;span style=&quot;color: #333333; font-family: verdana, arial, geneva, helvetica, sans-serif; font-size: 13px; &quot;&gt;&lt;span style=&quot;color: #3e38f5; font-family: Monaco; font-size: 11px; &quot;&gt;&lt;span style=&quot;color: #94218c; &quot;&gt;&amp;#160;&amp;#160;encoding&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&amp;quot;ISO-8859-1&amp;quot; &lt;span style=&quot;color: #009192; &quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;The encoding attribute prevents some unwanted character conversions which will prevent XCode from loading it. I&#039;m still not sure the best way to handle the character encoding.&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;The root template will output the plist wrapper. I mocked up the plist first in XCode to get an idea for what the resulting XML should look like.&amp;#160;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #4d9191; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;lt;&lt;/span&gt;xsl:template &lt;span style=&quot;color: #94218c; &quot;&gt;match&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #3e38f5; &quot;&gt;&amp;quot;/&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt; &lt;span style=&quot;color: #009192; &quot;&gt;&amp;#160;&amp;#160;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #4d9191; &quot;&gt;plist&lt;/span&gt; &lt;span style=&quot;color: #94218c; &quot;&gt;version&lt;/span&gt;=&amp;quot;1.0&amp;quot;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #4d9191; &quot;&gt;&lt;font color=&quot;#000000&quot;&gt;&lt;/font&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;#160;&amp;#160; &amp;#160;&amp;lt;&lt;/span&gt;array&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #4d9191; &quot;&gt;&lt;font color=&quot;#000000&quot;&gt;&lt;/font&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160;&amp;lt;&lt;/span&gt;xsl:apply-templates &lt;span style=&quot;color: #94218c; &quot;&gt;select&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #3e38f5; &quot;&gt;&amp;quot;/rss/channel/item&amp;quot; &lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #4d9191; &quot;&gt;&lt;font color=&quot;#000000&quot;&gt;&lt;/font&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;#160;&amp;#160; &amp;#160;&amp;lt;/&lt;/span&gt;array&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #4d9191; &quot;&gt;&lt;font color=&quot;#000000&quot;&gt;&lt;/font&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;#160;&amp;#160;&amp;lt;/&lt;/span&gt;plist&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #4d9191; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: verdana, arial, geneva, helvetica, sans-serif; font-size: 13px; &quot;&gt;&lt;span style=&quot;color: #4d9191; font-family: Monaco; font-size: 11px; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;lt;/&lt;/span&gt;xsl:template&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt; &lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;Now create the item template. This is not the most robust XSL but it works for the purposes of demonstrating the concept.&amp;#160;I also deleted some additional output elements for the sake of brevity.&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #4d9191; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;lt;&lt;/span&gt;xsl:template &lt;span style=&quot;color: #94218c; &quot;&gt;match&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #3e38f5; &quot;&gt;&amp;quot;item&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #4d9191; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;#160;&amp;#160;&amp;lt;&lt;/span&gt;dict&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #4d9191; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #333333; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;#160;&amp;#160; &amp;#160;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #4d9191; &quot;&gt;key&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;title&lt;span style=&quot;color: #009192; &quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #4d9191; &quot;&gt;key&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #4d9191; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;#160;&amp;#160; &amp;#160;&amp;lt;&lt;/span&gt;string&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #4d9191; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160;&amp;lt;&lt;/span&gt;xsl:value-of &lt;span style=&quot;color: #94218c; &quot;&gt;select&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #3e38f5; &quot;&gt;&amp;quot;title&amp;quot; &lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #4d9191; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;#160;&amp;#160; &amp;#160;&amp;lt;/&lt;/span&gt;string&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;#160;&amp;#160; &amp;#160;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #4d9191; &quot;&gt;key&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;link&lt;span style=&quot;color: #009192; &quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #4d9191; &quot;&gt;key&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #4d9191; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;#160;&amp;#160; &amp;#160;&amp;lt;&lt;/span&gt;string&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #4d9191; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160;&amp;lt;&lt;/span&gt;xsl:value-of &lt;span style=&quot;color: #94218c; &quot;&gt;select&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #3e38f5; &quot;&gt;&amp;quot;link&amp;quot; &lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #4d9191; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;#160;&amp;#160; &amp;#160;&amp;lt;/&lt;/span&gt;string&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;#160;&amp;#160; &amp;#160;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #4d9191; &quot;&gt;key&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;image&lt;span style=&quot;color: #009192; &quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #4d9191; &quot;&gt;key&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #4d9191; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;#160;&amp;#160; &amp;#160;&amp;lt;&lt;/span&gt;string&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #4d9191; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160;&amp;lt;&lt;/span&gt;xsl:value-of &lt;span style=&quot;color: #94218c; &quot;&gt;select&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #3e38f5; &quot;&gt;&amp;quot;image&amp;quot; &lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #4d9191; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;#160;&amp;#160; &amp;#160;&amp;lt;/&lt;/span&gt;string&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #4d9191; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;#160;&amp;#160;&amp;lt;/&lt;/span&gt;dict&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #4d9191; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: verdana, arial, geneva, helvetica, sans-serif; font-size: 13px; &quot;&gt;&lt;span style=&quot;color: #4d9191; font-family: Monaco; font-size: 11px; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;lt;/&lt;/span&gt;xsl:template&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;Run that through your xsl processor and you should see output similar to below.&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #3e38f5; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;lt;?&lt;/span&gt;&lt;span style=&quot;color: #4d9191; &quot;&gt;xml&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #94218c; &quot;&gt;version&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&amp;quot;1.0&amp;quot;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #94218c; &quot;&gt;encoding&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&amp;quot;ISO-8859-1&amp;quot;&lt;span style=&quot;color: #009192; &quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #4d9075; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;lt;!&lt;/span&gt;&lt;span style=&quot;color: #4d9191; &quot;&gt;DOCTYPE&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;plist&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #929292; &quot;&gt;PUBLIC&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;quot;-//Apple//DTD PLIST 1.0//EN&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&amp;quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&amp;quot;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #94218c; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #4d9191; &quot;&gt;plist&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;version&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #3e38f5; &quot;&gt;&amp;quot;1.0&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #4d9191; &quot;&gt;&lt;font color=&quot;#000000&quot;&gt;&lt;/font&gt;&lt;span style=&quot;color: #009192; &quot;&gt; &amp;lt;&lt;/span&gt;array&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #4d9191; &quot;&gt;&lt;font color=&quot;#000000&quot;&gt;&lt;/font&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt; &amp;lt;&lt;/span&gt;dict&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt; &lt;span style=&quot;color: #009192; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #4d9191; &quot;&gt;key&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;title&lt;span style=&quot;color: #009192; &quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #4d9191; &quot;&gt;key&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&lt;span style=&quot;color: #333333; &quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #4d9191; &quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;Seattle Journal: Long After Microsoft, Allen and Gates Cast&amp;#160;Shadows Over City&lt;span style=&quot;color: #009192; &quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #4d9191; &quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;font color=&quot;#009192&quot;&gt;&lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #4d9191; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt; &amp;lt;&lt;/span&gt;key&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;link&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;lt;/&lt;/span&gt;key&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #333333; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt; &amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #333333; &quot;&gt;&lt;span style=&quot;color: #4d9191; &quot;&gt;string&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #333333; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #333333; &quot;&gt;http://feeds.nytimes.com/click.phdo?i=5b4fa1b8abefd39cd4eaa299314d0a29&lt;/span&gt;&lt;span style=&quot;color: #333333; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;lt;/&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #333333; &quot;&gt;&lt;span style=&quot;color: #4d9191; &quot;&gt;string&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #333333; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/font&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&lt;span style=&quot;color: #333333; &quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #4d9191; &quot;&gt;key&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;image&lt;span style=&quot;color: #009192; &quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #4d9191; &quot;&gt;key&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #4d9191; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&lt;span style=&quot;color: #333333; &quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;lt;&lt;/span&gt;string&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #4d9191; &quot;&gt;&lt;span style=&quot;color: #333333; font-family: verdana, arial, geneva, helvetica, sans-serif; font-size: 13px; &quot;&gt;&lt;span style=&quot;color: #4d9191; font-family: Monaco; font-size: 11px; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&lt;span style=&quot;color: #333333; &quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #009192; &quot;&gt; &amp;lt;/&lt;/span&gt;dict&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&lt;span style=&quot;font-family: Monaco; font-size: 11px; &quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160;...more content here&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #4d9191; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;#160;&amp;#160;&amp;lt;/&lt;/span&gt;array&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: #4d9191; &quot;&gt;&lt;span style=&quot;color: #009192; &quot;&gt;&amp;lt;/&lt;/span&gt;plist&lt;span style=&quot;color: #009192; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt; &lt;/p&gt; &lt;br /&gt;
&lt;p&gt; &lt;/p&gt; &lt;br /&gt;
&lt;p&gt; &lt;/p&gt; &lt;br /&gt;
&lt;p&gt; &lt;/p&gt; 
    </content:encoded>

    <pubDate>Thu, 28 Apr 2011 12:25:42 -0400</pubDate>
    <guid isPermaLink="false">http://pure-xml.com/cblog/index.php?/archives/12-guid.html</guid>
    
</item>
<item>
    <title>Getting antlib to work - looping through files in a directory</title>
    <link>http://pure-xml.com/cblog/index.php?/archives/10-Getting-antlib-to-work-looping-through-files-in-a-directory.html</link>
    
    <comments>http://pure-xml.com/cblog/index.php?/archives/10-Getting-antlib-to-work-looping-through-files-in-a-directory.html#comments</comments>
    <wfw:comment>http://pure-xml.com/cblog/wfwcomment.php?cid=10</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://pure-xml.com/cblog/rss.php?version=2.0&amp;type=comments&amp;cid=10</wfw:commentRss>
    

    <author>nospam@example.com (gcd5137)</author>
    <content:encoded>
    &lt;p&gt;I was working with Apache Ant and came across antlib, which offers some cool extensions and seemed to be the right tool for what I needed to do. Here&#039;s how I got it to work. First, I had to update my version of Ant to 1.8 (or later). Next, I added the namespace to my ant build XML file &amp;lt;project&amp;gt; element.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;xmlns:antcontrib=&amp;quot;antlib:net.sf.antcontrib&amp;quot;&amp;gt;&lt;/font&gt;&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Then, I declared the extension using typedef.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt; &lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;typedef resource=&amp;quot;net/sf/antcontrib/antlib.xml&amp;quot;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; uri=&amp;quot;antlib:net.sf.antcontrib&amp;quot;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; classpath=&amp;quot;${antlib.home}/ant-contrib/lib/ant-contrib-0.3.jar&amp;quot;/&amp;gt;&lt;/font&gt;&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;I ended up using the namespaced approach because it worked on the first try. In this case, I was looping through a directory and getting information about the files.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;lt;antcontrib:foreach param=&amp;quot;file&amp;quot; target=&amp;quot;file-info&amp;quot;&amp;gt;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;path&amp;gt;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;fileset dir=&amp;quot;${src.dir}&amp;quot;&amp;gt;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;filename name=&amp;quot;${file.type}&amp;quot;/&amp;gt;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/fileset&amp;gt;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/path&amp;gt;&lt;br /&gt;&amp;lt;/antcontrib:foreach&amp;gt;&lt;/font&gt;&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The target &amp;quot;file-info&amp;quot; gets called for each file specified in the path. See ant and antlib docs for more info.&lt;br /&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Tue, 06 Apr 2010 16:08:04 -0400</pubDate>
    <guid isPermaLink="false">http://pure-xml.com/cblog/index.php?/archives/10-guid.html</guid>
    
</item>
<item>
    <title>Configuring PHP Proxy with JSON web service</title>
    <link>http://pure-xml.com/cblog/index.php?/archives/9-Configuring-PHP-Proxy-with-JSON-web-service.html</link>
            <category>PHP</category>
    
    <comments>http://pure-xml.com/cblog/index.php?/archives/9-Configuring-PHP-Proxy-with-JSON-web-service.html#comments</comments>
    <wfw:comment>http://pure-xml.com/cblog/wfwcomment.php?cid=9</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://pure-xml.com/cblog/rss.php?version=2.0&amp;type=comments&amp;cid=9</wfw:commentRss>
    

    <author>nospam@example.com (gcd5137)</author>
    <content:encoded>
    &lt;p&gt;I was working on an AJAX web application and got stuck on a problem trying to get my php proxy to use the &lt;a href=&quot;http://services.digg.com/&quot; target=&quot;_blank&quot; title=&quot;Digg web services&quot;&gt;Digg web service&lt;/a&gt; to provide results in &lt;a href=&quot;http://www.json.org/%20&quot; target=&quot;_blank&quot; title=&quot;JSON&quot;&gt;json&lt;/a&gt; format. After reading the Digg API docs, I ended up solving the problem using &lt;a href=&quot;http://php.net/manual/en/book.curl.php&quot; target=&quot;_blank&quot; title=&quot;PHP cURL&quot;&gt;curl &lt;/a&gt;instead of file_get_contents, as you might with HTML or XML. See curl &lt;a href=&quot;http://php.net/manual/en/function.curl-setopt.php&quot; target=&quot;_blank&quot; title=&quot;curl setopt&quot;&gt;setopt&lt;/a&gt; below, more specifically CURLOPT_HTTPHEADER and CURLOPT_USERAGENT.&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; $curl_handle = curl_init();&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true);&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; curl_setopt($curl_handle, CURLOPT_URL, $_GET[&#039;url&#039;]);&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; curl_setopt($curl_handle , CURLOPT_HTTPHEADER, array(&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;quot;Accept: application/json&amp;quot;,&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;quot;Content-Type: application/json&amp;quot;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ));&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; curl_setopt($curl_handle, CURLOPT_USERAGENT, &amp;quot;My-Application/2.5&amp;quot;);&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; $content = curl_exec($curl_handle);&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; curl_close($curl_handle);&lt;/font&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt; &lt;/p&gt; &lt;br /&gt;
&lt;p&gt;This solved the problem and now works as expected with Firefox, Chrome, and IE.&lt;br /&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Mon, 29 Mar 2010 10:04:46 -0400</pubDate>
    <guid isPermaLink="false">http://pure-xml.com/cblog/index.php?/archives/9-guid.html</guid>
    
</item>
<item>
    <title>Generating UUIDs with XSL and Java</title>
    <link>http://pure-xml.com/cblog/index.php?/archives/8-Generating-UUIDs-with-XSL-and-Java.html</link>
            <category>Java</category>
            <category>XSLT</category>
    
    <comments>http://pure-xml.com/cblog/index.php?/archives/8-Generating-UUIDs-with-XSL-and-Java.html#comments</comments>
    <wfw:comment>http://pure-xml.com/cblog/wfwcomment.php?cid=8</wfw:comment>

    <slash:comments>3</slash:comments>
    <wfw:commentRss>http://pure-xml.com/cblog/rss.php?version=2.0&amp;type=comments&amp;cid=8</wfw:commentRss>
    

    <author>nospam@example.com (gcd5137)</author>
    <content:encoded>
    &lt;p&gt;Sample code showing how to generate unique IDs using XSL and Java. I am running Saxon 9 and Java 1.6.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;First, set up the &lt;font face=&quot;courier new,courier,monospace&quot;&gt;xmlns:uuid &lt;/font&gt;extension at the stylesheet level.&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;lt;xsl:stylesheet version=&amp;quot;2.0&amp;quot;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; xmlns:xsl=&amp;quot;http://www.w3.org/1999/XSL/Transform&amp;quot;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; xmlns:uuid=&amp;quot;java:java.util.UUID&amp;quot;&amp;gt;&lt;/font&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;Later on, create a random unique ID using the uuid extension.&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;lt;xsl:variable name=&amp;quot;uid&amp;quot; select=&amp;quot;uuid:randomUUID()&amp;quot;/&amp;gt;&lt;/font&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;Output the value of the unique ID.&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;lt;xsl:value-of select=&amp;quot;$uid&amp;quot;/&amp;gt;&lt;/font&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;I like to set up an attribute set to reuse.&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;xsl:attribute-set name=&amp;quot;uid&amp;quot;&amp;gt;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;xsl:attribute name=&amp;quot;id&amp;quot;&amp;gt;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;xsl:variable name=&amp;quot;uid&amp;quot; select=&amp;quot;util:randomUUID()&amp;quot;/&amp;gt;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;xsl:value-of select=&amp;quot;$uid&amp;quot;/&amp;gt;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/xsl:attribute&amp;gt;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/xsl:attribute-set&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;And then reference it when creating the result.&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;lt;some-element xsl:use-attribute-sets=&amp;quot;uid&amp;quot;/&amp;gt;&lt;/font&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Fri, 05 Mar 2010 15:19:03 -0500</pubDate>
    <guid isPermaLink="false">http://pure-xml.com/cblog/index.php?/archives/8-guid.html</guid>
    
</item>
<item>
    <title>Exporting XML from Oracle using Java ResultSet</title>
    <link>http://pure-xml.com/cblog/index.php?/archives/7-Exporting-XML-from-Oracle-using-Java-ResultSet.html</link>
            <category>Java</category>
    
    <comments>http://pure-xml.com/cblog/index.php?/archives/7-Exporting-XML-from-Oracle-using-Java-ResultSet.html#comments</comments>
    <wfw:comment>http://pure-xml.com/cblog/wfwcomment.php?cid=7</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://pure-xml.com/cblog/rss.php?version=2.0&amp;type=comments&amp;cid=7</wfw:commentRss>
    

    <author>nospam@example.com (gcd5137)</author>
    <content:encoded>
    &lt;p&gt;I have done this with PHP before, but needed to do it again using similar logic with Java and XSL. The purpose was to extract information from an Oracle database. This is the meat of the Java function body, which loops through a SQL query ResultSet object and returns an XML document (minus the exception handling). I then write that XML Doc to an output file. The &#039;cols&#039; attribute was just for debugging.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt; &lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; DocumentBuilder docBuilder = builderFactory.newDocumentBuilder();&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; Document doc = docBuilder.newDocument();&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; Element results = doc.createElement(&amp;quot;Results&amp;quot;);&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; doc.appendChild(results);&lt;br /&gt;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; ResultSetMetaData rsmd = rs.getMetaData();&lt;br /&gt;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; int colCount = rsmd.getColumnCount();&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; results.setAttribute(&amp;quot;cols&amp;quot;, Integer.toString(colCount));&lt;br /&gt;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; // loop through the result set&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; while (rs.next()) {&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; // create a row element for each item&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; Element row = doc.createElement(&amp;quot;Row&amp;quot;);&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; results.appendChild(row);&lt;br /&gt;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; // loop through the columns&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; for (int i = 1; i &amp;lt;= colCount; i++) {&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; String columnName = rsmd.getColumnName(i);&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; Object value = rs.getObject(i);&lt;br /&gt;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; // watch out for wrong index or null values&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; Element node = doc.createElement(columnName);&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; if (value != null) {&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; node.appendChild(doc.createTextNode(value.toString()));&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; row.appendChild(node);&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; }&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; else{&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; node.appendChild(doc.createTextNode(&amp;quot;null&amp;quot;));&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; row.appendChild(node);&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; }&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; }&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; }&lt;/font&gt;&lt;br /&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Tue, 14 Jul 2009 14:10:34 -0400</pubDate>
    <guid isPermaLink="false">http://pure-xml.com/cblog/index.php?/archives/7-guid.html</guid>
    
</item>
<item>
    <title>Transforming XML to SQL using XSL</title>
    <link>http://pure-xml.com/cblog/index.php?/archives/6-Transforming-XML-to-SQL-using-XSL.html</link>
    
    <comments>http://pure-xml.com/cblog/index.php?/archives/6-Transforming-XML-to-SQL-using-XSL.html#comments</comments>
    <wfw:comment>http://pure-xml.com/cblog/wfwcomment.php?cid=6</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://pure-xml.com/cblog/rss.php?version=2.0&amp;type=comments&amp;cid=6</wfw:commentRss>
    

    <author>nospam@example.com (gcd5137)</author>
    <content:encoded>
    &lt;p&gt;I recently came across a project that required me to take a bunch of XML and put it into MySQL, a relational database system. I thought about the easiest way to migrate the data without too much manual effort. I launched jEdit, my current XSL development tool of choice, and started writing some templates. &lt;/p&gt; &lt;br /&gt;
&lt;p&gt;First, I had to set the output to text and handle whitespace. &lt;/p&gt; &lt;br /&gt;
&lt;blockquote&gt; &lt;br /&gt;
&lt;p&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;lt;xsl:output method=&amp;quot;text&amp;quot; indent=&amp;quot;no&amp;quot;/&amp;gt;&lt;/font&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;lt;xsl:strip-space elements=&amp;quot;*&amp;quot;/&amp;gt;&lt;/font&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;lt;xsl:template name=&amp;quot;NewLine&amp;quot;&amp;gt;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;xsl:text&amp;gt;&lt;br /&gt;&amp;lt;/xsl:text&amp;gt;&lt;br /&gt;&amp;lt;/xsl:template&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;
&lt;/blockquote&gt; &lt;br /&gt;
&lt;p&gt;I set up some templates to match my input XML elements and spit out the appropriate SQL statements.&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;
&lt;blockquote&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;lt;xsl:template match=&amp;quot;topics/record&amp;quot;&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;#160;&amp;#160; &amp;#160;&amp;lt;xsl:call-template name=&amp;quot;NewLine&amp;quot;/&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;#160;&amp;#160; &amp;#160;&amp;lt;xsl:call-template name=&amp;quot;NewLine&amp;quot;/&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;#160;&amp;#160; &amp;#160;&amp;lt;xsl:call-template name=&amp;quot;NewLine&amp;quot;/&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;#160;&amp;#160; &amp;#160;&amp;lt;xsl:text&amp;gt;insert into quiz_topics values(&amp;lt;/xsl:text&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;#160;&amp;#160; &amp;#160;&amp;lt;xsl:text&amp;gt;null, &amp;lt;/xsl:text&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;#160;&amp;#160; &amp;#160;&amp;lt;xsl:apply-templates select=&amp;quot;@topic&amp;quot;/&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;#160;&amp;#160; &amp;#160;&amp;lt;xsl:text&amp;gt;, &amp;lt;/xsl:text&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;#160;&amp;#160; &amp;#160;&amp;lt;xsl:apply-templates select=&amp;quot;@status&amp;quot;/&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;#160;&amp;#160; &amp;#160;&amp;lt;xsl:text&amp;gt;);&amp;lt;/xsl:text&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;lt;/xsl:template&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;lt;xsl:template match=&amp;quot;@*&amp;quot;&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;#160;&amp;#160; &amp;#160;&amp;lt;xsl:text&amp;gt;&amp;quot;&amp;lt;/xsl:text&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;#160;&amp;#160; &amp;#160;&amp;lt;xsl:value-of select=&amp;quot;.&amp;quot;/&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;#160;&amp;#160; &amp;#160;&amp;lt;xsl:text&amp;gt;&amp;quot;&amp;lt;/xsl:text&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;lt;/xsl:template&amp;gt;&lt;/font&gt;&lt;/blockquote&gt; &lt;br /&gt;
&lt;p&gt;The resulting output is a SQL script I can use to automatically load the data into MySQL. I used phpMyAdmin to manage the database tables and import the SQL output from my XSL transform. This worked like a charm and saved me hours of time!&lt;br /&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Fri, 01 May 2009 16:53:10 -0400</pubDate>
    <guid isPermaLink="false">http://pure-xml.com/cblog/index.php?/archives/6-guid.html</guid>
    
</item>
<item>
    <title>Using DOMXPath with PHP</title>
    <link>http://pure-xml.com/cblog/index.php?/archives/5-Using-DOMXPath-with-PHP.html</link>
            <category>PHP</category>
    
    <comments>http://pure-xml.com/cblog/index.php?/archives/5-Using-DOMXPath-with-PHP.html#comments</comments>
    <wfw:comment>http://pure-xml.com/cblog/wfwcomment.php?cid=5</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://pure-xml.com/cblog/rss.php?version=2.0&amp;type=comments&amp;cid=5</wfw:commentRss>
    

    <author>nospam@example.com (gcd5137)</author>
    <content:encoded>
    &lt;p&gt;I stumbled upon some very helpful information on php.net yesterday while working with PHP, XML, and DOM. The &lt;a title=&quot;DOMXPath&quot; target=&quot;_blank&quot; href=&quot;http://us3.php.net/manual/en/class.domxpath.php&quot;&gt;DOMXpath&lt;/a&gt; class makes working with XML way easier, especially when you need more complex features than SimpleXml. The function below accepts a DOMDocument and XPath string as input parameters and returns a DOMNodeList, which you can easily iterate over almost as if it were an array. &lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;#160;&amp;#160;&amp;#160; public static function getNodes($dom, $xpathString){&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160; &amp;#160;$xpath = new DOMXpath($dom);&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160; &amp;#160;$nodes = array();&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160; &amp;#160;$nodes = $xpath-&amp;gt;evaluate($xpathString);&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160; &amp;#160;return $nodes;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/font&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;Here&#039;s a simple example. You need to make up some XML and adjust the XPath as necessary.&lt;/p&gt; &lt;br /&gt;
&lt;blockquote&gt; &lt;/blockquote&gt; &lt;br /&gt;
&lt;p&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;$file = &amp;quot;data.xml&amp;quot;;&lt;br /&gt;$dom = new DomDocument();&lt;br /&gt;$dom-&amp;gt;load($file);&lt;br /&gt;&lt;br /&gt;$xpath = new DOMXpath($dom);&lt;br /&gt;&lt;br /&gt;$nodes = $xpath-&amp;gt;evaluate(&amp;quot;//title&amp;quot;);&lt;br /&gt;&lt;br /&gt;foreach($nodes as $node){&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; $nodeValue = $node-&amp;gt;nodeValue;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; echo &amp;quot;&amp;lt;p&amp;gt;$nodeValue&amp;lt;/p&amp;gt;&amp;quot;;&lt;br /&gt;}&lt;/font&gt;&lt;/p&gt; &lt;br /&gt;
&lt;blockquote&gt; &lt;/blockquote&gt; &lt;br /&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Tue, 07 Apr 2009 09:09:44 -0400</pubDate>
    <guid isPermaLink="false">http://pure-xml.com/cblog/index.php?/archives/5-guid.html</guid>
    
</item>
<item>
    <title>Using Catalogs with Saxon</title>
    <link>http://pure-xml.com/cblog/index.php?/archives/4-Using-Catalogs-with-Saxon.html</link>
            <category>XSLT</category>
    
    <comments>http://pure-xml.com/cblog/index.php?/archives/4-Using-Catalogs-with-Saxon.html#comments</comments>
    <wfw:comment>http://pure-xml.com/cblog/wfwcomment.php?cid=4</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://pure-xml.com/cblog/rss.php?version=2.0&amp;type=comments&amp;cid=4</wfw:commentRss>
    

    <author>nospam@example.com (gcd5137)</author>
    <content:encoded>
    &lt;p&gt;Here&#039;s an XSL tip that I use quite a bit and is very handy. If you are working with XML that uses DTDs or Schemas, you most likely need to resolve the SYSTEM or PUBLIC identifiers that are used for any required resources. Most Java XSL processors, like &lt;a target=&quot;_blank&quot; href=&quot;http://saxon.sourceforge.net/&quot;&gt;Saxon&lt;/a&gt;, allow you to use the apache commons resolver to &lt;a target=&quot;_blank&quot; href=&quot;http://www.sagehill.net/docbookxsl/Catalogs.html&quot;&gt;add support for Catalogs&lt;/a&gt; and resolve those identifiers.&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;java&amp;#160; -cp &amp;quot;saxon.jar;resolver.jar;&amp;quot; net.sf.saxon.Transform -x org.apache.xml.resolver.tools.ResolvingXMLReader -y org.apache.xml.resolver.tools.ResolvingXMLReader -r org.apache.xml.resolver.tools.CatalogResolver -o result.out input.xml style.xsl&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;Your &lt;a target=&quot;_blank&quot; href=&quot;http://www.sagehill.net/docbookxsl/UseCatalog.html&quot;&gt;CatalogManager.properties&lt;/a&gt; should also be on the classpath and might look something like this.&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;catalogs=catalog.xml;C:/somepath/catalog&lt;br /&gt;relative-catalogs=true&lt;br /&gt;catalog-class-name=org.apache.xml.resolver.Resolver&lt;br /&gt;verbosity=2 &lt;br /&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;And your &lt;a target=&quot;_blank&quot; href=&quot;http://www.oasis-open.org/committees/entity/spec-2001-08-06.html&quot;&gt;XML catalog&lt;/a&gt; might look like this.&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;&amp;lt;catalog&amp;gt;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;public&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; publicId=&amp;quot;-//My Company//DTD My DTD Name and Version//EN&amp;quot;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; uri=&amp;quot;C:/path-to-dtd/my.dtd&amp;quot;/&amp;gt;&lt;br /&gt;&amp;lt;/catalog&amp;gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt; &lt;br /&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Tue, 10 Mar 2009 23:10:32 -0400</pubDate>
    <guid isPermaLink="false">http://pure-xml.com/cblog/index.php?/archives/4-guid.html</guid>
    
</item>
<item>
    <title>Keep your content out of attributes</title>
    <link>http://pure-xml.com/cblog/index.php?/archives/3-Keep-your-content-out-of-attributes.html</link>
    
    <comments>http://pure-xml.com/cblog/index.php?/archives/3-Keep-your-content-out-of-attributes.html#comments</comments>
    <wfw:comment>http://pure-xml.com/cblog/wfwcomment.php?cid=3</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://pure-xml.com/cblog/rss.php?version=2.0&amp;type=comments&amp;cid=3</wfw:commentRss>
    

    <author>nospam@example.com (gcd5137)</author>
    <content:encoded>
    &lt;p&gt;When creating an XML DTD or Schema, a developer often needs to decide when to use an element or attribute. These types of decisions can impact the project success. Here are a few questions that might help you make the decision.&lt;/p&gt; &lt;br /&gt;
&lt;ul&gt; &lt;br /&gt;
&lt;li&gt;Does the tag or attribute contain data or content that be presented to the customer? If so, use an element.&lt;/li&gt; &lt;br /&gt;
&lt;li&gt;Is the markup used for metadata, or information about the content? If so, use an attribute.&lt;br /&gt;&lt;/li&gt; &lt;br /&gt;
&lt;li&gt;Are there datatype restictions that need to be used? You have a lot more options when using schemas. DTDs may tempt you to use attributes for data type validation.&lt;br /&gt;&lt;/li&gt; &lt;br /&gt;
&lt;li&gt;Will the text ever need to be translated? If so, use an element.&lt;/li&gt; &lt;br /&gt;
&lt;/ul&gt; &lt;br /&gt;
&lt;p&gt;An example of why such decisions are important is shown when trying to work with XML that contains translated text in attribute values. The XML spec does not allow reserved characters (i.e. &amp;amp;) or entities (i.e. &amp;amp;eacute;) in attribute values, so prepare for all kinds of problems. Parsers will complain, stylesheet processors will fail, publishing engines will throw exceptions, and lots of time will be spent trying to resolve the problem.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;There are many more questions to ask, but these should help make the decision easier.&lt;br /&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Sun, 08 Mar 2009 21:00:18 -0400</pubDate>
    <guid isPermaLink="false">http://pure-xml.com/cblog/index.php?/archives/3-guid.html</guid>
    
</item>
<item>
    <title>Backing up data using Ant</title>
    <link>http://pure-xml.com/cblog/index.php?/archives/2-Backing-up-data-using-Ant.html</link>
    
    <comments>http://pure-xml.com/cblog/index.php?/archives/2-Backing-up-data-using-Ant.html#comments</comments>
    <wfw:comment>http://pure-xml.com/cblog/wfwcomment.php?cid=2</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://pure-xml.com/cblog/rss.php?version=2.0&amp;type=comments&amp;cid=2</wfw:commentRss>
    

    <author>nospam@example.com (gcd5137)</author>
    <content:encoded>
    &lt;p&gt;Today I realized my 70GB hard drive was almost completely full (yikes!) and I quickly decided to back up old files and do some maintenance. As I started mindlessly copying files, I realized I had a lot of &lt;a href=&quot;subversion.tigris.org&quot; target=&quot;_blank&quot; title=&quot;Subversion&quot;&gt;.svn folders&lt;/a&gt; scattered everywhere. As much as I love subversion, I don&#039;t want to save all those extra files. Just the source please. Realizing it could become tedious to weed out those .svn folders and files, I decided to use my &#039;Swiss army knife&#039;. &lt;a href=&quot;http://ant.apache.org&quot; target=&quot;_blank&quot; title=&quot;Apache Ant&quot;&gt;Apache Ant&lt;/a&gt; is one of my favorite tools for a lot of reasons, including its ease of use and integration with Eclipse. The ant task below will copy files from an input directory to an output directory except for those unwanted svn folders.&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;copy todir=&amp;quot;${output.dir}&amp;quot;&amp;gt;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;fileset dir=&amp;quot;${input.dir}&amp;quot;&amp;gt;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;exclude name=&amp;quot;**/.svn&amp;quot;/&amp;gt;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/fileset&amp;gt;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/copy&amp;gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt; &lt;/p&gt; &lt;br /&gt;
&lt;p&gt;I also decided to do some clean up and after backing up files, delete ones on my hard drive that are old. The ant task below will delete any files within the given input folder that were modified before the date time provided.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;delete&amp;gt;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;fileset dir=&amp;quot;${input.dir}&amp;quot;&amp;gt;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;date datetime=&amp;quot;${date.time}&amp;quot; when=&amp;quot;before&amp;quot;/&amp;gt;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/fileset&amp;gt;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/delete&amp;gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;&amp;#160;My Seagate external hard drive comes with some nice configuration options, but I love the granular level of control ant provides. Just be careful when using the delete task!!&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt; &lt;/p&gt; 
    </content:encoded>

    <pubDate>Sat, 07 Mar 2009 00:14:40 -0500</pubDate>
    <guid isPermaLink="false">http://pure-xml.com/cblog/index.php?/archives/2-guid.html</guid>
    
</item>
<item>
    <title>My First Entry</title>
    <link>http://pure-xml.com/cblog/index.php?/archives/1-My-First-Entry.html</link>
    
    <comments>http://pure-xml.com/cblog/index.php?/archives/1-My-First-Entry.html#comments</comments>
    <wfw:comment>http://pure-xml.com/cblog/wfwcomment.php?cid=1</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://pure-xml.com/cblog/rss.php?version=2.0&amp;type=comments&amp;cid=1</wfw:commentRss>
    

    <author>nospam@example.com (gcd5137)</author>
    <content:encoded>
    &lt;b&gt;Welcome to my &lt;i&gt;web blog&lt;/i&gt;&lt;/b&gt; 
    </content:encoded>

    <pubDate>Sat, 07 Mar 2009 00:06:58 -0500</pubDate>
    <guid isPermaLink="false">http://pure-xml.com/cblog/index.php?/archives/1-guid.html</guid>
    
</item>

</channel>
</rss>
