<?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>Inasmuch as... &#187; XML</title>
	<atom:link href="http://inasmuch.as/category/xml/feed/" rel="self" type="application/rss+xml" />
	<link>http://inasmuch.as</link>
	<description>...Life&#039;s but a walking shadow</description>
	<lastBuildDate>Sun, 13 May 2012 18:35:07 +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>&#8220;that error-handling be completely deterministic&#8221;</title>
		<link>http://inasmuch.as/2012/04/16/error-handling/</link>
		<comments>http://inasmuch.as/2012/04/16/error-handling/#comments</comments>
		<pubDate>Sun, 15 Apr 2012 23:22:39 +0000</pubDate>
		<dc:creator>tkg</dc:creator>
				<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://inasmuch.as/?p=1263</guid>
		<description><![CDATA[Inasmuch as, back in January, I was teaching another XML course, I reviewed the basis for draconian error handling in XML in light of the sea change in recent years towards HTML5-style completely-defined error recovery. At the time of the &#8230; <a href="http://inasmuch.as/2012/04/16/error-handling/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><span style="font-variant: small-caps;">Inasmuch as</span>, back in January, I was teaching another XML course, I reviewed the basis for draconian error handling in XML in light of the sea change in recent years towards HTML5-style completely-defined error recovery.</p>
<p>At the time of the draconian error handling decision, I was on the larger &#8220;W3C SGML Working Group&#8221; mailing list that provided input, clamour, and distraction to the core &#8220;W3C SGML Editorial Review Board&#8221; that did the work and made the decisions on the road to XML.  I followed the discussions on the mailing list at the time (as much as humanly possible), and the message about this that stuck in my mind is the &#8220;<a title="ERB votes on error handling" href="http://lists.w3.org/Archives/Public/w3c-sgml-wg/1997May/0079.html">ERB votes on error handling</a>&#8221; message from Tim Bray on behalf of the ERB, particularly this section:</p>
<blockquote><p>2. We have a strong political reality to deal with here in that for the first time, the big browser manufacturers have noticed XML and have together made a strong request: that error-handling be completely deterministic, and that browsers not compete on the basis of excellence in handling mangled documents.  It was observed that if they wanted to do this, they could just do it; but then pointed out that this is exactly why standards exist &#8211; to codify the desired practices shared between competitors.  In any case, if we want XML to succeed on the Web, it will be difficult to throw the first serious request from M &amp; N back in their face.</p></blockquote>
<p><span id="more-1263"></span></p>
<p>The connection that I, and possibly many others, at the time saw between this summary, at twice remove, of browser vendors asking &#8220;that error-handling be completely deterministic&#8221; and XML using draconian error handling may not have been much of a connection at all.  Okay, if you apply hindsight as of now, there never was any connection, but if you were/are of the mindset that:</p>
<ul>
<li>Well-formed XML doesn&#8217;t come with rules about what elements, etc., are allowed and not-allowed in different places so in the general case you can&#8217;t &#8220;just fix&#8221; a broken document so it now makes sense;</li>
<li>There are (or, in 1997, were to be) XML applications where &#8220;keep calm and carry on&#8221; after receiving a document with an error isn&#8217;t an option; and</li>
<li>The <a title="XML design goals" href="http://www.w3.org/TR/xml/#sec-origin-goals">design goal</a> of XML that &#8220;The number of optional features in XML is to be kept to the absolute minimum, ideally zero.&#8221; rules out including optional error recovery in the XML spec</li>
</ul>
<p>then draconian error handling looks like the best/only alternative for XML.  And binary yes/no error handling certainly is completely deterministic even if it may not have been exactly what the browser vendors had in mind at the time.</p>
<p>The question whether draconian error handling is a good idea still comes up today.  (In XML circles, anyway; in HTML circles, they&#8217;ve voted with their feet/keyboards and gone for the <a title="&quot;Parsing algorithm should not preclude Complex Ruby&quot; bug report" href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=13113">almost too completely defined</a> error handling of HTML 5.)  It came up again at <a title="XML Prague 2012" href="http://www.xmlprague.cz/2012/index.html">XML Prague 2012</a>, where the circles overlapped briefly when Anne van Kesteren presented &#8220;<a title="&quot;What XML can learn from HTML; also known as XML5&quot; @ XML Prague 2012" href="http://www.xmlprague.cz/2012/sessions.html#What-XML-can-learn-from-HTML-also-known-as-XML5">What XML can learn from HTML; also known as XML5</a>&#8221; and, as Eric van der Vlist notes in his <a title="&quot;XML Prague 2012: The web would be so cool without the web developers&quot; by Eric van der Vlist" href="http://eric.van-der-vlist.com/blog/2012/02/15/xml-prague-2012-the-web-would-be-so-cool-without-the-web-developers/">blog</a>, in the panel discussion that followed.  The question still has no universally accepted answer: for instance, Eric in his post describes as irrational that others wouldn&#8217;t even discuss changing well-formedness requirements, and these two successive posts to the XML-ER list, by <a title="Message by David Carlisle" href="http://lists.w3.org/Archives/Public/public-xml-er/2012Feb/0120.html">David Carlisle</a> and <a title="Message by David Lee" href="http://lists.w3.org/Archives/Public/public-xml-er/2012Feb/0123.html">David Lee</a>, take diametrically opposite views about error recovery.</p>
<p>IMO, it&#8217;s too late to change the definition of well-formedness for XML 1.0, and the inroads that XML 1.1 hasn&#8217;t made illustrates the likely success of anything labelled XML 1.2 or even XML 2.0.  Enter the <a title="XML Error Recovery Community Group page" href="http://www.w3.org/community/xml-er/">XML Error Recovery Community Group</a> (XML-ER).  Set up in record time mid-conference at XML Prague 2012, its goal is to define a deterministic error-recovery mechanism for XML such that parsing well-formed XML 1.0 with a XML-ER processor (if that&#8217;s what it&#8217;s eventually called) produces the same result as parsing with a XML 1.0 processor and parsing non-well-formed XML (which, strictly speaking, by not being well-formed isn&#8217;t XML at all) produces what looks like the result of parsing well-formed XML with a XML 1.0 processor, where the fix-ups from non-well-formed to well-formed will be the same in every XML-ER processor.</p>
<p>Where XML-ER finds it&#8217;s place in the XML stack is a bit up in the air at present – since few people would want to parse with a XML 1.0 processor then fall back to a XML-ER processor only if it failed yet there are aspects of XML 1.0 parsing, such as reading and using any DTD, that won&#8217;t be handled by a XML-ER processor – but it is the current best effort for moving to deterministic error-handling that is more than a binary yes/no.</p>
]]></content:encoded>
			<wfw:commentRss>http://inasmuch.as/2012/04/16/error-handling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flymake for RELAX NG compact syntax</title>
		<link>http://inasmuch.as/2012/02/22/flymake-for-relax-ng-compact-syntax/</link>
		<comments>http://inasmuch.as/2012/02/22/flymake-for-relax-ng-compact-syntax/#comments</comments>
		<pubDate>Wed, 22 Feb 2012 13:11:27 +0000</pubDate>
		<dc:creator>tkg</dc:creator>
				<category><![CDATA[Emacs]]></category>
		<category><![CDATA[RELAX NG]]></category>

		<guid isPermaLink="false">http://inasmuch.as/?p=1285</guid>
		<description><![CDATA[Inasmuch as the Wisent parsing and other CEDET/Speedbar/Semantic goodness for RELAX NG compact syntax files that I&#8217;m currently working on may not be ready for prime time for a while, here&#8217;s something to add to your .emacs so `flymake' runs &#8230; <a href="http://inasmuch.as/2012/02/22/flymake-for-relax-ng-compact-syntax/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><span style="font-variant: small-caps;">Inasmuch as</span> the Wisent parsing and other CEDET/Speedbar/Semantic goodness for RELAX NG compact syntax files that I&#8217;m currently working on may not be ready for prime time for a while, here&#8217;s something to add to your <code>.emacs</code> so <code>`flymake'</code> runs Jing in the background to find syntax errors in your RELAX NG compact syntax files:</p>
<pre>(require 'flymake)
(defun flymake-rnc-init ()
  (let* ((temp-file (flymake-init-create-temp-buffer-copy
		     'flymake-create-temp-inplace))
     	 (local-file (file-relative-name
		      temp-file
		      (file-name-directory buffer-file-name))))
    (list "jing" (list "-c" local-file))))
(add-to-list 'flymake-allowed-file-name-masks
      '(".+\\.rnc$"
	flymake-rnc-init
	flymake-simple-cleanup
	flymake-get-real-file-name))
(add-hook 'rnc-mode-hook
	  'flymake-mode)</pre>
]]></content:encoded>
			<wfw:commentRss>http://inasmuch.as/2012/02/22/flymake-for-relax-ng-compact-syntax/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Schematron Testing Framework poster</title>
		<link>http://inasmuch.as/2012/02/20/schematron-testing-framework-poster/</link>
		<comments>http://inasmuch.as/2012/02/20/schematron-testing-framework-poster/#comments</comments>
		<pubDate>Mon, 20 Feb 2012 11:42:10 +0000</pubDate>
		<dc:creator>tkg</dc:creator>
				<category><![CDATA[Schematron]]></category>

		<guid isPermaLink="false">http://inasmuch.as/?p=1265</guid>
		<description><![CDATA[Inasmuch as it exists as a PDF file, you, too, can have your own copy of my &#8220;Schematron Testing Framework&#8221; (stf) poster from XML Prague 2012.  I&#8217;m happy to say that I received constructive comments about stf from people at &#8230; <a href="http://inasmuch.as/2012/02/20/schematron-testing-framework-poster/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><span style="font-variant: small-caps;">Inasmuch as</span> it exists as a PDF file, you, too, can have your own copy of my &#8220;<a title="stf on GitHub" href="https://github.com/MenteaXML/stf">Schematron Testing Framework</a>&#8221; (<code>stf</code>) <a title="&quot;Schematron Testing Framework&quot; poster from XML Prague 2012" href="http://www.mentea.net/resources.html#XMLPrague2012">poster</a> from <a title="XML Prague 2012 website" href="http://www.xmlprague.cz/2012/index.html">XML Prague 2012</a>.  I&#8217;m happy to say that I received constructive comments about <code>stf</code> from people at XML Prague 2012 who read the poster, and I&#8217;ll be looking at incorporating the feedback in the near future.</p>
<p>One suggestion, from George Bina, was to make a single &#8220;framework&#8221; file for running the tests – and including the test files in the framework file either directly or by using XInclude to refer to external test files – rather than the current decentralised approach.  A single framework file would make it easier to make a report of the results, unlike the the current approach where the idea is that the only report you really want to see is &#8220;<code>&lt;errors/&gt;</code>&#8221; when there are no more errors.  A single framework file could also become very large and hard to navigate when there&#8217;s lots of very similar tests in it.  What do you think?</p>
]]></content:encoded>
			<wfw:commentRss>http://inasmuch.as/2012/02/20/schematron-testing-framework-poster/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>imenu-generic-expression</title>
		<link>http://inasmuch.as/2012/01/13/imenu-generic-expression/</link>
		<comments>http://inasmuch.as/2012/01/13/imenu-generic-expression/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 11:27:30 +0000</pubDate>
		<dc:creator>tkg</dc:creator>
				<category><![CDATA[Emacs]]></category>
		<category><![CDATA[RELAX NG]]></category>

		<guid isPermaLink="false">http://inasmuch.as/?p=1207</guid>
		<description><![CDATA[Inasmuch as `imenu-generic-expression` makes using Emacs&#8217; &#8220;Imenu&#8221; simpler, it&#8217;s this triennial&#8217;s &#8220;Obscure Emacs variable of the week&#8220;. Emacs&#8217; &#8220;Imenu&#8221; feature puts in the menu-bar a menu whose each menu item (or sub-menu item) jumps you to a location in the &#8230; <a href="http://inasmuch.as/2012/01/13/imenu-generic-expression/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><span style="font-variant: small-caps;">Inasmuch as</span> <code>`imenu-generic-expression`</code> makes using Emacs&#8217; &#8220;Imenu&#8221; simpler, it&#8217;s this triennial&#8217;s &#8220;<a title="Obscure Emacs variable of the week" href="http://inasmuch.as/2009/02/06/obscure-emacs-variable-of-the-week/">Obscure Emacs variable of the week</a>&#8220;.<br />
<span id="more-1207"></span></p>
<p>Emacs&#8217; &#8220;Imenu&#8221; feature puts in the menu-bar a menu whose each menu item (or sub-menu item) jumps you to a location in the current buffer.  Emacs being Emacs, Imenu is highly configurable, and quite often an Emacs mode will set up the Imenu menu to point to locations in the buffer that are significant for that mode/file-type.  For example, my <a href="https://sourceforge.net/apps/trac/xslide/wiki/WikiStart" title="'xslide' XSL mode for Emacs at SourceForge">xslide</a> and <a href="http://www.menteith.com/wiki/tdtd" title="'tdtd' Emacs mode for DTDs">tdtd</a> modes each set up very different Imenu menus.</p>
<p><code>`imenu-generic-expression`</code> is a variable that, at its simplest, contains a list of three-item lists that each specify a menu title, a regular expression, and the number corresponding to the subexpression of the regular expression to use as the resulting menu item&#8217;s name.  When <code>`imenu-generic-expression`</code> is set and the Imenu menu bar item is enabled (using <code>`imenu-add-to-menubar`</code>, naturally), Emacs constructs a buffer index by searching the buffer using each of the regular expressions in turn and then builds up the menu based on the matches found.</p>
<p>For example, here&#8217;s the <code>`rnc-mode-hook'</code> that I use to add a &#8220;RNC&#8221; menu when using <code>`rnc-mode'</code> to edit RELAX NG compact syntax (RNC) files.  The hook sets <code>`imenu-generic-expression`</code> with patterns that match significant declarations in a RNC file (with separate sub-menus for <code>include</code>, <code>namespace</code>, and <code>datatypes</code> declaration types) then enables Imenu with <code>`imenu-add-to-menubar`</code>.  A screenshot of the resulting menu is action is shown after the code.</p>
<pre>(require 'rnc-mode)
(add-hook 'rnc-mode-hook
 (lambda ()
   (set-variable
    'imenu-generic-expression
    (list
     (list
      nil
      "^\\([a-zA-Z][-a-zA-Z0-9._]*\\)\\s-*[&amp;|]?=" 1)
     (list
      "include"
      "^include\\s-+['\"]\\([a-zA-Z][-a-zA-Z0-9._]*\\)['\"]" 1)
     (list
      "namespace"
      "^\\(default\\s-+\\)?namespace\\s-+\\([a-zA-Z][-a-zA-Z0-9._]*\\)\\s-*=" 2)
     (list
      "dataypes"
      "^datatypes\\s-+\\([a-zA-Z][-a-zA-Z0-9._]*\\)\\s-*=" 1)))
   (imenu-add-to-menubar "RNC")))
</pre>
<p><a href="http://inasmuch.as/wp-content/uploads/2012/01/imenu-generic-expression.png"><img src="http://inasmuch.as/wp-content/uploads/2012/01/imenu-generic-expression.png" alt="" title="&#039;RNC&#039; Imenu menu" width="765" height="705" class="aligncenter size-full wp-image-1217" /></a></p>
<p>The only downside to using <code>`imenu-add-to-menubar`</code> compared to doing more of it yourself is that <code>`imenu-add-to-menubar`</code> doesn&#8217;t provide a way to sort the menu items, so the order of the matches in the file is the order of the items in the menu or sub-menu.  I wrote both xslide and tdtd before I knew of <code>`imenu-add-to-menubar`</code>, but the recently revived <a href="http://inasmuch.as/2011/10/21/xslide-alive/" title="xslide alive!">xslide for XSLT 2.0</a> still uses a custom function to make the Imenu index because I also like to sort the index entries alphabetically within each menu or sub-menu.</p>
]]></content:encoded>
			<wfw:commentRss>http://inasmuch.as/2012/01/13/imenu-generic-expression/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Schematron Testing Framework</title>
		<link>http://inasmuch.as/2011/12/21/schematron-testing-framework/</link>
		<comments>http://inasmuch.as/2011/12/21/schematron-testing-framework/#comments</comments>
		<pubDate>Wed, 21 Dec 2011 09:07:49 +0000</pubDate>
		<dc:creator>tkg</dc:creator>
				<category><![CDATA[Schematron]]></category>
		<category><![CDATA[XProc]]></category>

		<guid isPermaLink="false">http://inasmuch.as/?p=1170</guid>
		<description><![CDATA[Inasmuch as a suite of Schematron tests contains many contexts where a bug in a document will make a Schematron assert fail or a report succeed, it follows that for any new test suite and any reasonably sized but buggy &#8230; <a href="http://inasmuch.as/2011/12/21/schematron-testing-framework/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><span style="font-variant: small-caps;">Inasmuch as</span> a suite of Schematron tests contains many contexts where a bug in a document will make a Schematron <code>assert</code> fail or a <code>report</code> succeed, it follows that for any new test suite and any reasonably sized but buggy document set, there will straight away be many <code>assert</code> and <code>report</code> messages produced by the tests.  When that happens, how can you be sure your Schematron tests all worked as expected?  How can you separate the expected results from the unexpected?  What&#8217;s needed is a way to characterise the Schematron tests before you start as reporting only what they should, no more, and no less.</p>
<p>stf (<a title="stf on GitHub." href="https://github.com/MenteaXML/stf">https://github.com/MenteaXML/stf</a>) is a XProc pipeline that runs a Schematron test suite on test documents (that you create) and winnows out the expected results and report just the unexpected.  stf uses a processing instruction (PI) in each of a set of (typically, small) test documents to indicate the test&#8217;s expected <code>assert</code>s and <code>report</code>s: the expected results are ignored, and all you see is what&#8217;s extra or missing.  And when you have no more unexpected results from your test documents, you&#8217;re ready to use the Schematron on your real documents.<span id="more-1170"></span></p>
<h1>&lt;?stf?&gt; Processing Instruction</h1>
<p>The format of the PI is:</p>
<pre><code>&lt;?stf \s+ ( '#NONE' | ROLE ':' COUNT ( \s+ ROLE ':' COUNT )* ) ?&gt; </code></pre>
<p>where:</p>
<ul>
<li><code>stf</code>: PI target</li>
<li><code>#NONE</code>: No faild <code>assert</code> or successful <code>report</code> expected. Use with &#8216;go&#8217; tests that should not produce any <code>assert</code> or <code>report</code> messages. If running Schematron on the test produces any <code>assert</code>s or <code>report</code>s, they are reported as an error.</li>
<li><em>ROLE</em>: Token corresponding to <code>@role</code> value of an <code>assert</code> or a <code>report</code> in the Schematron. Schematron allows <code>@role</code> to be an arbitrary string, but restricting it to a single token makes it easier to deal with the PI using regular expressions rather than having to parse roles that may contain spaces.</li>
<li><em>COUNT</em>: Integer number of expected occurrences of failed <code>assert</code>s or successful <code>report</code>s with <code>@role</code> value matching <em>ROLE</em>. A mismatch between the expected and actual count is reported as an error. A <em>ROLE</em> starting with <code>#</code> does not have its count checked.</li>
<li><code>\s</code>: Whitespace character</li>
</ul>
<h1>Examples</h1>
<pre><code>&lt;?stf ERROR_FOO:2 ERROR_BAR:1 ?&gt; </code></pre>
<p>A failed <code>assert</code> or successful <code>report</code> with <code>role="ERROR_FOO"</code> is expected twice in the SVRL from the test document, and either with <code>role="ERROR_BAR"</code> is expected once.</p>
<pre><code>&lt;?stf ERROR_FOO:2 #ERROR_BAR:1 ?&gt; </code></pre>
<p>A failed <code>assert</code> or successful <code>report</code> with <code>role="ERROR_FOO"</code> is expected twice in the SVRL, and no <code>assert</code> or <code>report</code> with <code>role="ERROR_BAR"</code> is expected since <code>#</code> precedes <code>ERROR_BAR</code>.</p>
<pre><code>&lt;?stf #NONE ?&gt; </code></pre>
<p>No <code>assert</code> or <code>report</code> are expected for the current document.</p>
<h1>Usage</h1>
<p>stf requires Ant and Calabash. Calabash (as used here) requires Saxon. All three require Java.</p>
<ol>
<li>Set the properties in <code>properties.xml</code> to match your local setup.</li>
<li>Write the tests, including a <code>&lt;?stf?&gt;</code> processing instruction in each.<br />
One practice is to use a <code>tests</code> directory containing a <code>go</code> subdirectory for tests that are expected to produce no Schematron <code>assert</code> or <code>report</code> messages and a <code>nogo</code> subdirectory for tests that are expected to have errors, but you can organise them any way you like.</li>
<li>Run Ant<br />
You can run the <code>test.schematron</code> from <code>build.xml </code>directly:</p>
<pre>ant -f /path/to/stf/build.xml test.schematron</pre>
<p>or you can import the stf <code>build.xml</code> into your local <code>build.xml</code>:</p>
<pre>&lt;property name="stf.dir" location="/path/to/stf" /&gt;
&lt;import file="${stf.dir}/build.xml" /&gt;</pre>
<p>and run the <code>test.schematron</code> target, or you can import the stf <code>build.xml</code> and use the <code>&lt;test.schematron/&gt;</code> macro in a target in your local <code>build.xml</code>:</p>
<pre>&lt;target name="test"&gt;
  &lt;test.schematron /&gt;
  &lt;xspec xspec.xml="tests.xspec" /&gt;
&lt;/target&gt;</pre>
</li>
</ol>
<h1>Ant Properties</h1>
<ul>
<li><code>${schematron}</code>: Schematron file to test.</li>
<li><code>${tests.dir}</code>: Directory containing test files.</li>
<li><code>${calabash.jar}</code>: Location of Calabash jar.</li>
<li><code>${saxon.jar}</code>: Location of Saxon 9.2 (or later) jar.</li>
<li><code>${resolver.jar}</code>: Location of XML catalog resolver library.</li>
<li><code>${resolver.class}</code>: Class name of XML catalog resolver. Default is <code>org.apache.xml.resolver.tools.CatalogResolver</code>.</li>
</ul>
<h1>XProc Processor</h1>
<p>The pipeline currently depends on Calabash extensions.</p>
<p>The version of Calabash used in testing depended on Saxon 9.2 or later.</p>
<h2>Running (Not Testing) Schematron</h2>
<p>Ant build file also includes <code>schematron</code> macro and <code>run.schematron</code> target to make it easy to run Schematron on real files once you&#8217;re sure it works on your tests.</p>
<h2>License</h2>
<p>Licensed under the terms of a BSD license.</p>
]]></content:encoded>
			<wfw:commentRss>http://inasmuch.as/2011/12/21/schematron-testing-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS for the hierarchically minded</title>
		<link>http://inasmuch.as/2011/09/27/css-for-the-hierarchically-minded/</link>
		<comments>http://inasmuch.as/2011/09/27/css-for-the-hierarchically-minded/#comments</comments>
		<pubDate>Tue, 27 Sep 2011 09:38:06 +0000</pubDate>
		<dc:creator>tkg</dc:creator>
				<category><![CDATA[XML]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://inasmuch.as/?p=827</guid>
		<description><![CDATA[Inasmuch as both HTML and XML markup – being descended from SGML – support a nested, hierarchical structure and as CSS allows, even promotes, a stream-of-consciousness style of coding, there can be a tension between the two approaches. To put &#8230; <a href="http://inasmuch.as/2011/09/27/css-for-the-hierarchically-minded/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><span style="font-variant: small-caps;">Inasmuch as</span> both HTML and XML markup – being descended from SGML – support a nested, hierarchical structure and as CSS allows, even promotes, a stream-of-consciousness style of coding, there can be a tension between the two approaches.</p>
<p>To put it another way:</p>
<ul>
<li>If you want different styles in a couple of contexts that depend on the type of several levels of ancestor, then you get to put all those ancestors in the CSS selectors for each of those styles;</li>
<li>If you want to use the same colour in multiple different styles, then, by golly, you get to enter the same <code>color</code> value in each of them (and if you want to change it later, you get to find them all again to do it); and</li>
<li>If you want to use the same set of styles in multiple contexts – say, use rounded corners multiple places and with bigger radii on the outermost corners – then you get to repeat the same set of styles while jiggering their values every place that you want them.</li>
</ul>
<p>The CSS soon gets to the point that only a machine can reliably work out the cascading and so we require tools such as <a title="Firebug: Web Development Evolved." href="http://getfirebug.com/">Firebug</a> to make sense of it and present it to us in ways that we can understand.</p>
<p>I have previously implemented a system for a client where the template CSS file is wrapped in an XML element and contains empty elements for each of the values of <code>color</code> properties so the all-XML processing system can &#8216;skin&#8217; the stylesheet by substituting the preferred <code>color</code> values and outputting proper CSS on the way to making the HTML, but that was adding complexity, not taking it away.</p>
<p>Enter LESS (<a title="LESS website" href="http://www.lesscss.org/">http://www.lesscss.org/</a>), the &#8220;dynamic stylesheet language&#8221;. LESS is pretty much CSS as it should have been, since it elegantly solves the gripes listed above, and more besides.<span id="more-827"></span></p>
<p>LESS is available as a JavaScript library for <a title="LESS client-side usage" href="http://www.lesscss.org/#-client-side-usage">client-side</a> translation of <code>.less</code> stylesheets â€“ linked from your HTML with the link&#8217;s <code>rel</code> attribute set to &#8220;<code>stylesheet/less</code>&#8221; â€“ into CSS on the fly and <a title="LESS server-side usage" href="http://www.lesscss.org/#-server-side-usage">server-side</a> for use with <a title="Node (a.k.a. 'node.js') website" href="http://nodejs.org/">Node</a>. It&#8217;s also available as a command-line program that simply converts LESS to CSS that you can save and serve statically.</p>
<p>There are good and succinct examples on the LESS website. Just to be different, here&#8217;s an example from my <a title="XML Summer School skin for S5" href="https://github.com/tkg/xmlss-s5">GitHub project</a> for an <a title="XML Summer School website" href="http://www.xmlsummerschool.com">XML Summer School</a> skin for <a title="'S5: A Simple Standards-Based Slide Show System' website" href="http://meyerweb.com/eric/tools/s5/">S5</a>.</p>
<p>Here&#8217;s a subset of an <a title="Old version of XML Summer School CSS" href="https://github.com/tkg/xmlss-s5/blob/d480044e71ea0b61ecfd82bf27e6f4ae7552013b/css/slides.css">old version</a> borrowing what was originally Norman Walsh&#8217;s CSS for his <a title="Norman Walsh's 'XML Summer School 2011 Slide Template' project on GitHub" href="https://github.com/ndw/xmlss-templates">project</a> for producing XHTML slides for XML Summer School:</p>
<pre>.footer {
    background-color: #fffc84;
    position: relative;
    background-image: url(../images/cc-1024.png);
    background-repeat: no-repeat;
    background-position: 3 3;
    margin-top: -48px; /* negative value of footer height */
    height: 48px;
    bottom: 0px;
    padding-left: 100px;
    clear: both;
}

.footer .content {
    padding-left: 400px;
    height: 0px;
}

.footer .license {
    padding-top: 8px;
    padding-left: 30px;
    font-size: 10pt;
    height: 0px;
}

.footer .foilnumber {
    text-align: right;
    padding-right: 30px;
    padding-top: 14px;
    font-size: 10pt;
    height: 0px;
}

pre {
    font-family: Courier New, Courier, monospaced;
    font-weight: bold;
    border: 1px solid black;
    padding: 10px;
}

.xml {
    background-color: #E6E6E6;
}

.xslt {
    background-color: #FFFDCE;
}

.schema {
    background-color: #E5E7FE;
}

.other {
    background-color: #C7FFFF;
    color: #9E0000;
}

.xml .pi {
    color: #8C35C7;
}

.xml .el {
    color: #001A94;
}

.xml .att {
    color: #FC7F4C;
}

.xml .attval {
    color: #9E2E00;
}

.xml .ent {
    color: #979315;
}

.xml .xslt {
    color: #006AC6;
}

pre .p {
    color: #9E0000;
}

pre .kw {
    color: #001A94;
}

pre .str {
    color: #595837;
}

pre .re {
    color: #FC7F4C;
}</pre>
<p>And here&#8217;s a <a title="Old, LESSified version of XML Summer School CSS" href="https://github.com/tkg/xmlss-s5/blob/73353ed454af621f28210e21c560e3cd7cc98b26/css/slides.css">old but LESSified version</a> of the same excerpt:</p>
<pre>@yellow: #fffc84;

.footer {
    background-color: @yellow;
    position: relative;
    background-image: url(../images/cc-1024.png);
    background-repeat: no-repeat;
    background-position: 3 3;
    margin-top: -48px; /* negative value of footer height */
    height: 48px;
    bottom: 0px;
    padding-left: 100px;
    clear: both;

    .content {
	padding-left: 400px;
	height: 0px;
    }

    .license {
	padding-top: 8px;
	padding-left: 30px;
	font-size: 10pt;
	height: 0px;
    }

    .foilnumber {
	text-align: right;
	padding-right: 30px;
	padding-top: 14px;
	font-size: 10pt;
	height: 0px;
    }
}

pre {
    font-family: Courier New, Courier, monospaced;
    font-weight: bold;
    border: 1px solid black;
    padding: 10px;

    &amp;.xml {
	background-color: #E6E6E6;

	.pi {
	    color: #8C35C7;
	}

	.el {
	    color: #001A94;
	}

	.att {
	    color: #FC7F4C;
	}

	.attval {
	    color: #9E2E00;
	}

	.ent {
	    color: #979315;
	}

	&amp;.xslt {
	    color: #006AC6;
	}
    }

    &amp;.xslt {
	background-color: #FFFDCE;
    }

    &amp;.schema {
	background-color: #E5E7FE;
    }

    &amp;.other {
	background-color: #C7FFFF;
    }

    .p {
	color: #9E0000;
    }

    .kw {
	color: #001A94;
    }

    .str {
	color: #595837;
    }

    .re {
	color: #FC7F4C;
    }
}</pre>
<p>Note that:</p>
<ul>
<li>The colour <code>@yellow</code> is also used elsewhere in the stylesheet, but I didn&#8217;t want to repeat the whole stylesheet here.</li>
<li>The <code>&amp;</code> combinator concatenates a nested selector to its parent selector instead of the selector acting as a descendent. As the LESS website <a title="'Nested rules' definition on LESS website" href="http://www.lesscss.org/#-nested-rules">notes</a>, this is especially important for pseudo-classes like <code>:hover</code> and <code>:focus</code>.</li>
<li>Code samples in the slides are represented with the <code>&lt;pre&gt;</code> element with a different background colour depending on the code type..</li>
<li>The class names for styling parts of XML markup in samples are common to both XML and XSLT samples. Since my project includes a stylesheet for translating Norm&#8217;s XHTML slide markup to S5-style XHTML, the class names are unchanged from the original and thus there&#8217;s a necessity for markup such as <code>&lt;pre class="xml xslt"&gt;</code> for getting the right colour for elements and attributes, etc., in XSLT code samples. If it weren&#8217;t for that, it would have been more sensible to use a LESS <a title="LESS mixins" href="http://www.lesscss.org/#-mixins">mixin</a> to handle the repetition between the XML and XSLT code sample styles.</li>
</ul>
<p>My only gripe with LESS so far is that I&#8217;ve yet to get it and the JavaScript from S5 to play nicely together, so I had to back out the use of LESS for the S5 project, which to date was my only publicly visible project to use LESS.</p>
<p>Arguably CSS1 could have introduced something more LESS (you just knew I&#8217;d been wanting to write that, didn&#8217;t you?) since <code>&lt;div&gt;</code> – the definitive expression of hierarchy in HTML content – was introduced in the HTML 3.0 drafts and CSS 1 <a title="CSS1 'References' section." href="http://www.w3.org/TR/REC-CSS1/#references">refers</a> to HTML 4.0. Hindsight, being the only perfect science, would indicate that is should have been possible, but I really don&#8217;t know whether it was technically or politically feasible once there was an installed base of CSS1 engines and web pages that used CSS1 as we knew it. If LESS does now catch on enough that it gets baked into browsers, this &#8216;native&#8217; LESS would probably require a different, <a title="Registered link relations at IANA" href="http://www.iana.org/assignments/link-relations/link-relations.xml">registered</a> <code>rel</code> value or a well-known MIME-type so there&#8217;s no conflict on the web pages that currently use LESS stylesheets with the LESS JavaScript library.</p>
]]></content:encoded>
			<wfw:commentRss>http://inasmuch.as/2011/09/27/css-for-the-hierarchically-minded/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XML Summer School 2011 ends on high note</title>
		<link>http://inasmuch.as/2011/09/26/xml-summer-school-2011-high-not/</link>
		<comments>http://inasmuch.as/2011/09/26/xml-summer-school-2011-high-not/#comments</comments>
		<pubDate>Mon, 26 Sep 2011 08:46:59 +0000</pubDate>
		<dc:creator>tkg</dc:creator>
				<category><![CDATA[XML]]></category>
		<category><![CDATA[xmlroff]]></category>

		<guid isPermaLink="false">http://inasmuch.as/?p=888</guid>
		<description><![CDATA[Inasmuch as my final &#8220;XSLT and XSL-FO toolbox of tips and tricks&#8221; session was well received, XML Summer School 2011 finished on a high note. My other sessions, &#8220;Developing and Testing in XSLT&#8221; with Jeni Tennison in the &#8220;XSLT/XQuery&#8221; track &#8230; <a href="http://inasmuch.as/2011/09/26/xml-summer-school-2011-high-not/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><span style="font-variant: small-caps;">Inasmuch as</span> my final &#8220;XSLT and XSL-FO toolbox of tips and tricks&#8221; session was well received, <a title="XML Summer School website" href="http://xmlsummerschool.com/">XML Summer School 2011</a> finished on a high note. My other sessions, &#8220;Developing and Testing in XSLT&#8221; with <a title="Jeni Tennison bio for XML Summer School 2011" href="http://xmlsummerschool.com/faculty-2011/#tennison">Jeni Tennison</a> in the &#8220;<a title="XML Summer School 2001 'XSLT/XQuery' track" href="http://xmlsummerschool.com/curriculum-2011/xslt-and-xquery-2011/">XSLT/XQuery</a>&#8221; track and a five-minute Ignite-format talk on EPUB, also went well, but it was that final talk in the &#8220;<a title="XML Summer School 2011 'Publishing' track" href="http://xmlsummerschool.com/curriculum-2011/publishing-2011/">Publishing</a>&#8221; track that got the most visible reactions.<span id="more-888"></span></p>
<p>Strangely, it was the existence of the <a title="xmlroff XSL formatter website" href="http://xmlroff.org">xmlroff</a> <a title="xmlroff testing module" href="http://xmlroff.org/wiki/TestingModule">testing module</a> that got several people most excited. I say &#8216;strangely&#8217; because I&#8217;ve been mentioning it in presentations for years (including three days earlier in the &#8220;XSLT/XQuery&#8221; track) without it seeming the stand-out feature of any of those talks, yet this time I had someone finding its URL and downloading it before I&#8217;d barely finished the slide about it. But I am in no way complaining.  It was good to see such a level of interest, and I hope it works out for him and the others. I&#8217;m also hoping to get some new feedback on how well it works, since although I&#8217;ve been using it (and tweaking it) for years, it doesn&#8217;t garner much feedback from other users.</p>
<p>My other reason for being pleased with the success of the XSLT and XSL-FO talk was that it meant that I&#8217;d kept to the high standard of the other talks in the track by <a title="Henry Thompson bio for XML Summer School 2011" href="http://xmlsummerschool.com/faculty-2011/#thompson">Henry Thompson</a>, <a title="Norman Walsh bio for XML Summer School 2011" href="http://xmlsummerschool.com/faculty-2011/#walsh">Norman Walsh</a>, and <a title="Sebastian Rahtz bio for XML Summer School 2011" href="http://xmlsummerschool.com/faculty-2011/#rahtz">Sebastian Rahtz</a>. The talks in the &#8220;XSLT/XQuery&#8221; track by <a title="Priscilla Walmsley bio for XML Summer School 2011" href="http://xmlsummerschool.com/faculty-board-2011/#walmsley">Priscilla Walmsley</a> (track chair) and <a title="Michael Kay bio for XML Summer School 2011" href="http://xmlsummerschool.com/faculty-2011/#kay">Michael Kay</a> (and, as always, Jeni&#8217;s delivery) and the other Ignite talks were very good, too, but I thought the other &#8220;Publishing&#8221; track talks were particularly good. Quite an achievement considering that this was the first year that the XML Summer School had a separate &#8220;Publishing&#8221; track, so credit also goes to <a title="Peter Flynn bio for XML Summer School 2011" href="http://xmlsummerschool.com/faculty-board-2011/#flynn">Peter Flynn</a>, as track chair, for putting the track together in the first place.</p>
<p>I know the above reads like I&#8217;m in a <a title="'Mutual admiration society' at Wiktionary" href="https://secure.wikimedia.org/wiktionary/en/wiki/mutual_admiration_society">mutual admiration society</a>, but it really was a week of very good talks.</p>
]]></content:encoded>
			<wfw:commentRss>http://inasmuch.as/2011/09/26/xml-summer-school-2011-high-not/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XML Summer School 2011</title>
		<link>http://inasmuch.as/2011/06/27/xml-summer-school-2011/</link>
		<comments>http://inasmuch.as/2011/06/27/xml-summer-school-2011/#comments</comments>
		<pubDate>Mon, 27 Jun 2011 09:16:30 +0000</pubDate>
		<dc:creator>tkg</dc:creator>
				<category><![CDATA[XML]]></category>
		<category><![CDATA[XMLSS]]></category>

		<guid isPermaLink="false">http://inasmuch.as/?p=764</guid>
		<description><![CDATA[Inasmuch as I was already asked to be on the Publishing track at XML Summer School 2011, I was then invited to co-teach &#8220;Developing and Testing in XSLT&#8221; with Jeni Tennison in the XSLT and XQuery track, so I&#8217;m pleased &#8230; <a href="http://inasmuch.as/2011/06/27/xml-summer-school-2011/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><span style="font-variant: small-caps;">Inasmuch as</span> I was already asked to be on the <a title="Publishing track at XML Summer School 2011" href="http://xmlsummerschool.com/curriculum-2011/publishing-2011/">Publishing</a> track at <a title="XML Summer School website" href="http://xmlsummerschool.com/">XML Summer School 2011</a>, I was then invited to co-teach &#8220;Developing and Testing in XSLT&#8221; with Jeni Tennison in the <a title="'XSLT and XQuery' track at XML Summer School 2011" href="http://xmlsummerschool.com/curriculum-2011/xslt-and-xquery-2011/">XSLT and XQuery</a> track, so I&#8217;m pleased that I&#8217;ll be teaching two sessions at the XML Summer School in St Edmund Hall, Oxford University, on 18-23 September 2011. (Early bird discount ends 30 June 2011.)</p>
<p>My sessions are but 1/4 of their respective tracks, but I&#8217;ll be in the room for the entirety of each track and, indeed, like all Faculty at the XML Summer School, I&#8217;ll be around all week.<span id="more-764"></span></p>
<p>For the record, the Publishing session is:</p>
<blockquote><p><strong>XSLT and XSL FO toolbox of tips and tricks</strong></p>
<p>XSLT was designed to transform XML into other formats, and its original purpose was to transform XML into the XSL FO vocabulary for formatting as pages.</p>
<p>Producing pages is still close to the heart of many publishers, but we also use XSLT to transform XML into other XML vocabularies, into HTML, and into other non-XML formats.</p>
<p>This session provides sample techniques for using XSLT and XSL FO in publishing. We encourage attendees to put forward their pain points with using XSLT and/or XSL FO, either in the session or beforehand on the LinkedIn group discussion, and we&#8217;ll add them to the mix as we look at solving the XSLT and XSL FO problems that matter most to people.</p></blockquote>
<p>and the XSLT and XQuery session with Jeni Tennison is:</p>
<blockquote><p><strong>Developing and Testing in XSLT</strong></p>
<p>Unit tests, profiling, debugging and, increasingly, test-driven development are part of the bread and butter of working with other programming languages but are not always so with XSLT or XQuery.</p>
<p>In test-driven development, which is a fundamental part of agile approaches to software development, the developers write tests that describe the desired behaviour of their application, then write code that meets the tests. This style of development keeps code focused, avoids breaking existing code and facilitates refactoring.</p>
<p>In this session, Jeni Tennison and Tony Graham will describe both the state of the art in testing and debugging XSLT and XQuery and how test-driven development applies to XSLT and XQuery development. In particular, they will focus on the use of the XSpec testing framework.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://inasmuch.as/2011/06/27/xml-summer-school-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Converting RNG to RNC</title>
		<link>http://inasmuch.as/2011/06/24/converting-rng-to-rnc/</link>
		<comments>http://inasmuch.as/2011/06/24/converting-rng-to-rnc/#comments</comments>
		<pubDate>Fri, 24 Jun 2011 22:51:54 +0000</pubDate>
		<dc:creator>tkg</dc:creator>
				<category><![CDATA[Emacs]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://inasmuch.as/?p=739</guid>
		<description><![CDATA[Inasmuch as the customised version of the &#8220;xmlspec&#8221; schema being used for the next version of the XSL spec is maintained in RELAX NG XML syntax (RNG) and Emacs&#8217;s nXML-mode only uses RELAX NG compact syntax (RNC), I yet again &#8230; <a href="http://inasmuch.as/2011/06/24/converting-rng-to-rnc/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><span style="font-variant: small-caps;">Inasmuch as</span> the customised version of the &#8220;xmlspec&#8221; schema being used for the next version of the XSL spec is maintained in <a title="MURATA Makoto's RELAX NG page." href="http://relaxng.org/">RELAX NG</a> XML syntax (RNG) and Emacs&#8217;s <a title="'nxml-mode' at emacswiki.org." href="http://www.emacswiki.org/emacs/NxmlMode">nXML-mode</a> only uses RELAX NG compact syntax (RNC), I yet again wanted to convert a schema from RNG to RNC.Â  As you would expect, there&#8217;s more than one way to do it.<span id="more-739"></span></p>
<p>The classic way is using James Clark&#8217;s utility.Â  This involves: (a) working out if you need <a title="Jing and Trang at Google Project Hosting." href="http://code.google.com/p/jing-trang/">&#8220;Jing&#8221; or &#8220;Trang&#8221;</a> (you need Trang); (b) getting the .jar or the executable; and (c) running it.Â  Fairly simple, though it&#8217;s a pain that although it&#8217;s bundled with Ubuntu, etc., it&#8217;s not installed by default.Â  I backup my data between OS re-installs (who doesn&#8217;t?) but not the OS-installed programs, so when I need it on a new machine or after a re-install, I, at least, have to go through the Jing/Trang confusion and then fire up the package manager to install it.</p>
<p>I wanted an alternative, but writing a RNG schema loader function for nxml-mode isn&#8217;t the work of an afternoon (interesting as it would be to bootstrap it using nxml-mode&#8217;s tokenizing of the RNG XML), so I found David Rosenborg&#8217;s &#8220;RNG to RNC Converter&#8221; (<a title="RNG to RNC converter download page." href="http://www.pantor.com/download.html">http://www.pantor.com/download.html</a>).Â  The current version works with XSLT 1.0 but not XSLT 2.0 (because it expects the XSLT processor to have a <code>node-set()</code> furnction), but you can add the following to <code>RngToRncProcessorConfig.xsl</code> so the XSLT works with both XSLT 1.0 and XSLT 2.0:</p>
<pre>&lt;!-- XSLT 2.0 or later. --&gt;
&lt;xsl:when test="system-property('xsl:version') &gt;= 2"&gt;
  &lt;xsl:variable name="body"&gt;
    &lt;xsl:for-each select="$schema"&gt;
      &lt;xsl:call-template name="make-body"/&gt;
    &lt;/xsl:for-each&gt;
  &lt;/xsl:variable&gt;
  &lt;xsl:sequence select="$body"/&gt;
&lt;/xsl:when&gt;
</pre>
<p>My only other quibble with the stylesheet is that it doesn&#8217;t preserve comments that are in the RNG (more straightforward to do in XSLT 2.0 than XSLT 1.0, I admit).</p>
<p>I don&#8217;t yet know if I&#8217;ll stick to using RNG to RNC Converter in preference to Trang.Â  The XSLT is easier to keep with the other stuff that I backup between installs or keep in the Subversion repository for machine configurations, but Trang is easier to use once it is installed and on your path.Â  The best thing is that now I have the choice of more than one way to do it.</p>
<p>For a more complete list of ways to do it that is maintained by MURATA Makoto, see <a title="Converters list at relaxng.org." href="http://relaxng.org/#conversion">http://relaxng.org/#conversion</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://inasmuch.as/2011/06/24/converting-rng-to-rnc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>xml-model processing instruction with nXML mode</title>
		<link>http://inasmuch.as/2011/05/25/xml-model-with-nxml-mode/</link>
		<comments>http://inasmuch.as/2011/05/25/xml-model-with-nxml-mode/#comments</comments>
		<pubDate>Wed, 25 May 2011 19:07:21 +0000</pubDate>
		<dc:creator>tkg</dc:creator>
				<category><![CDATA[Emacs]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://inasmuch.as/?p=720</guid>
		<description><![CDATA[Inasmuch as the &#60;?xml-model?&#62; processing instruction (jointly developed by W3C and ISO/IEC JTC1/SC34) is the new, standard way to associate schemas with XML documents and I already had code for using a similar, oXygen-specific PI, it was easy to make &#8230; <a href="http://inasmuch.as/2011/05/25/xml-model-with-nxml-mode/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><span style="font-variant: small-caps;">Inasmuch as</span> the <a title="xml-model Working Group Note" href="http://www.w3.org/TR/xml-model/"><code>&lt;?xml-model?&gt;</code></a> processing instruction (jointly developed by W3C and ISO/IEC JTC1/SC34) is the new, standard way to associate schemas with XML documents and I already had code for using a similar, oXygen-specific PI, it was easy to make a hook function to put in your .emacs file so nXML mode will use <code>&lt;?xml-model?&gt;</code> to find a RNC schema:<span id="more-720"></span></p>
<pre>(defun use-xml-model ()
  "Hook function for `nxml-mode' to use  PI for locating a
RNC schema."
  (interactive)
  (save-excursion
    (goto-char (point-min))
    (if (search-forward "" nil t)
                           (match-beginning 0)))
                 (filename (save-excursion
                             (re-search-forward "href=\"\\([^\"]+\.rnc\\)\""
                                                pi-end t)
                             (match-string 1))))
;;            (message "pi-end: %d; filename: %s
;;                     pi-end filename)
            (if (and filename (file-readable-p filename))
                (rng-set-schema-file filename)))))))

(add-hook 'nxml-mode-hook
          'use-xml-model)</pre>
]]></content:encoded>
			<wfw:commentRss>http://inasmuch.as/2011/05/25/xml-model-with-nxml-mode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

