<?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; XSLT</title>
	<atom:link href="http://inasmuch.as/category/xslt/feed/" rel="self" type="application/rss+xml" />
	<link>http://inasmuch.as</link>
	<description>...Life&#039;s but a walking shadow</description>
	<lastBuildDate>Sat, 04 Feb 2012 13:21:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>xslide alive!</title>
		<link>http://inasmuch.as/2011/10/21/xslide-alive/</link>
		<comments>http://inasmuch.as/2011/10/21/xslide-alive/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 10:08:07 +0000</pubDate>
		<dc:creator>tkg</dc:creator>
				<category><![CDATA[Emacs]]></category>
		<category><![CDATA[XSL]]></category>
		<category><![CDATA[XSLT]]></category>

		<guid isPermaLink="false">http://inasmuch.as/?p=1035</guid>
		<description><![CDATA[Inasmuch as you, like me, may have missed xslide&#8217;s &#8220;Template&#8221; menu when editing XSLT using Emacs&#8217; nXML-mode, I&#8217;ve made available my &#8220;xslide2&#8243; XSLT mode for Emacs that I&#8217;ve been using for a while.  This new xslide is a derived mode &#8230; <a href="http://inasmuch.as/2011/10/21/xslide-alive/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><span style="font-variant: small-caps;">Inasmuch as</span> you, like me, may have missed xslide&#8217;s &#8220;Template&#8221; menu when editing XSLT using Emacs&#8217; nXML-mode, I&#8217;ve made available my &#8220;xslide2&#8243; XSLT mode for Emacs that I&#8217;ve been using for a while.  This new xslide is a derived mode that uses nXML-mode for nearly everything and adds back some of the XSLT-specific parts of xslide.</p>
<p>Future development is happening on the Trac and Subversion for the xslide SourceForge project.  See <a title="xslide Trac at SourceForge" href="https://sourceforge.net/apps/trac/xslide/wiki/WikiStart">https://sourceforge.net/apps/trac/xslide/wiki/WikiStart</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://inasmuch.as/2011/10/21/xslide-alive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Saxon feature keys for initial template and mode</title>
		<link>http://inasmuch.as/2011/08/18/saxon-feature-keys/</link>
		<comments>http://inasmuch.as/2011/08/18/saxon-feature-keys/#comments</comments>
		<pubDate>Thu, 18 Aug 2011 07:45:05 +0000</pubDate>
		<dc:creator>tkg</dc:creator>
				<category><![CDATA[XSLT]]></category>
		<category><![CDATA[Ant]]></category>

		<guid isPermaLink="false">http://inasmuch.as/?p=615</guid>
		<description><![CDATA[Inasmuch as a &#8220;feature key&#8221; is how you configure a Java JAXP XSLT processor, it&#8217;s good to see that Saxon 9.3 has added feature keys for setting the initial template and initial mode. In fact, Saxon has gone from 30 &#8230; <a href="http://inasmuch.as/2011/08/18/saxon-feature-keys/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><span style="font-variant: small-caps;">Inasmuch as</span> a &#8220;feature key&#8221; is how you <a title="'setFeature()' Javadoc" href="http://download.oracle.com/javase/6/docs/api/javax/xml/transform/TransformerFactory.html#setFeature%28java.lang.String,%20boolean%29">configure a Java JAXP XSLT processor</a>, it&#8217;s good to see that Saxon 9.3 has added <a title="Saxon feature keys Javadoc" href="http://www.saxonica.com/documentation/javadoc/net/sf/saxon/lib/FeatureKeys.html">feature keys</a> for setting the <a title="Feature key for initial template" href="http://www.saxonica.com/documentation/javadoc/net/sf/saxon/lib/FeatureKeys.html#XSLT_INITIAL_TEMPLATE">initial template</a> and <a title="Initial mode feature key" href="http://www.saxonica.com/documentation/javadoc/net/sf/saxon/lib/FeatureKeys.html#XSLT_INITIAL_MODE">initial mode</a>. In fact, Saxon has gone from <a title="Saxon 9.0 feature keys" href="http://www.saxonica.com/documentation9.0/javadoc/net/sf/saxon/FeatureKeys.html#field_summary">30 feature keys in Saxon 9.0</a> to <a title="Saxon 9.2 feature keys" href="http://www.saxonica.com/documentation9.2/javadoc/net/sf/saxon/FeatureKeys.html#field_summary">70 in 9.2</a> and now <a title="Current Saxon feature keys" href="http://www.saxonica.com/documentation/javadoc/net/sf/saxon/lib/FeatureKeys.html#field_summary">79 in 9.3</a>.</p>
<p>Where this becomes useful (outside of your own Java programs) is being able to specify the initial template and/or mode in the <code>&lt;xslt&gt;</code> task in Ant build files.<span id="more-615"></span> Previously, if you needed to specify either, you could only run the <code>net.sf.saxon.Transform</code> class with the <code>&lt;java&gt;</code> task and provide command line arguments or, when processing multiple files at once, both run Java as an external program using the <code>&lt;apply&gt;</code> task and handle the dependencies yourself.</p>
<p>So the good, and more readable, news is that this:</p>
<pre>&lt;target name="new.build"
Â Â Â Â Â Â Â  description="Make a build file for a translation."&gt;
Â  &lt;exec executable="java"
Â Â Â Â Â Â Â  dir="${basedir}"
Â Â Â Â Â Â Â  output="build.xml"&gt;
Â Â Â  &lt;arg value="-cp" /&gt;
Â Â Â  &lt;arg file="${saxon.jar}" /&gt;
Â Â Â  &lt;arg value="net.sf.saxon.Transform" /&gt;
Â Â Â  &lt;arg value="-xsl:${xsl.dir}/build.xsl" /&gt;
Â Â Â  &lt;arg value="-it:build" /&gt;
Â Â Â  &lt;arg value="build.properties=${basedir.converted}/build.properties"/&gt;
Â  &lt;/exec&gt;
&lt;/target&gt;</pre>
<p>can, with extra dependency checking added, become:</p>
<pre>&lt;target name="new.build"
Â Â Â Â Â Â Â  description="Make a build file for a translation."&gt;
Â  &lt;dependset&gt;
Â Â Â  &lt;srcfileset file="${xsl.dir}/build.xsl" /&gt;
Â Â Â  &lt;srcfileset file="${basedir.converted}/build.properties" /&gt;
Â Â Â  &lt;targetfileset file="${basedir}/build.xml" /&gt;
Â  &lt;/dependset&gt;
Â  &lt;xslt in="${xsl.dir}/build.xsl"
Â Â Â Â Â Â Â  out="${basedir}/build.xml"
Â Â Â Â Â Â Â  style="${xsl.dir}/build.xsl"
Â Â Â Â Â Â Â  classpath="${saxon.jar}"&gt;
Â Â Â  &lt;factory name="net.sf.saxon.TransformerFactoryImpl"&gt;
Â Â Â Â Â  &lt;attribute
Â Â Â Â Â Â Â Â Â  name="http://saxon.sf.net/feature/initialTemplate"
Â Â Â Â Â Â Â Â Â  value="build"/&gt;
Â Â Â  &lt;/factory&gt;
Â Â Â  &lt;param name="build.properties"
Â Â Â Â Â Â Â Â Â Â  expression="${basedir.converted}/build.properties"/&gt;
Â  &lt;/xslt&gt;
&lt;/target&gt;</pre>
<p>But I&#8217;m still stumped over whether it&#8217;s possible (without resorting to either scripting or using <code>&lt;apply&gt;</code> to run another Ant) to use <code>&lt;xslt&gt;</code> with an initial template over a range of non-XML files where, for each in turn, the filename is passed to the transform as a parameter, i.e., to rework this to use <code>&lt;xslt&gt;</code>:</p>
<pre>&lt;target name="lines"&gt;
  &lt;dependset&gt;
    &lt;srcfileset file="${books}" /&gt;
    &lt;srcfileset file="${xsl.dir}/lines.xsl" /&gt;
    &lt;targetfileset dir="${stages.dir}/${stage.lines}"
                   includes="*.tstamp" /&gt;
  &lt;/dependset&gt;

  &lt;echo&gt;Stage 0: lines&lt;/echo&gt;
  &lt;mkdir dir="${stages.dir}/${stage.lines}" /&gt;
  &lt;apply executable="java"
         dir="${stages.dir}/${stage.lines}"
         logerror="true"&gt;
    &lt;arg value="-cp" /&gt;
    &lt;arg file="${saxon.jar}" /&gt;
    &lt;arg value="net.sf.saxon.Transform" /&gt;
    &lt;arg value="-ext:on" /&gt;
    &lt;arg value="-xsl:${xsl.dir}/lines.xsl" /&gt;
    &lt;arg value="-it:doc" /&gt;
    &lt;arg value="books=file://${books}"/&gt;
    &lt;arg value="encoding=${encoding}"/&gt;
    &lt;srcfile prefix="doc="/&gt;
    &lt;fileset dir="${basedir.converted}/sources"
             includes="*${suffix}"/&gt;
    &lt;mapper type="glob"
            from="*${suffix}"
            to="${stages.dir}/${stage.lines}/*.tstamp"/&gt;
    &lt;redirector&gt;
      &lt;!-- redirect STDOUT to make timestamp file in dest-dir --&gt;
      &lt;outputmapper type="glob"
                    from="*${suffix}"
                    to="${stages.dir}/${stage.lines}/*.tstamp"/&gt;
    &lt;/redirector&gt;
  &lt;/apply&gt;
&lt;/target&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://inasmuch.as/2011/08/18/saxon-feature-keys/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XSpec, Ant, and &lt;oXygen/&gt;</title>
		<link>http://inasmuch.as/2010/02/02/xspec-ant-oxygen/</link>
		<comments>http://inasmuch.as/2010/02/02/xspec-ant-oxygen/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 10:34:22 +0000</pubDate>
		<dc:creator>tkg</dc:creator>
				<category><![CDATA[XML]]></category>
		<category><![CDATA[XSLT]]></category>
		<category><![CDATA[Ant]]></category>

		<guid isPermaLink="false">http://inasmuch.as/?p=422</guid>
		<description><![CDATA[Inasmuch as software has moved on since 2008 when I wrote about When Ant is subsidiary to &#60;oXygen/&#62;, I now run XSpec from &#60;oXygen/&#62; using the Ant bundled with recent &#60;oXygen/&#62;. Bundled Ant means (almost) no extra downloads, and the &#8230; <a href="http://inasmuch.as/2010/02/02/xspec-ant-oxygen/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><span style="font-variant: small-caps;">Inasmuch as</span> software has moved on since 2008 when I wrote about <a title="When Ant is subsidiary to &lt;oXygen/&gt;" href="/2008/05/16/when-ant-is-subsidiary-to-oxygen/">When Ant is subsidiary to &lt;oXygen/&gt;</a>, I now run XSpec from &lt;oXygen/&gt; using the Ant bundled with recent &lt;oXygen/&gt;.<span id="more-422"></span></p>
<p>Bundled Ant means (almost) no extra downloads, and the recently added <code>${ps}</code> editor variable for the path separator for the current platform means that a single &#8220;External Tool&#8221; definition works for both Linux and Windows (where <a title="When Ant is subsidiary to &lt;oXygen/&gt;" href="/2008/05/16/when-ant-is-subsidiary-to-oxygen/">previously</a> I needed two definitions that differed only in using &#8220;:&#8221; or &#8220;;&#8221;). Continuing with the trick of using &lt;oXygen/&gt; editor variable names in the Ant build file, the command lineÂ  that I use (with line breaks added for clarity) is:</p>
<pre>java -Dant.home="${oxygenInstallDir}/tools/ant"
-cp "${oxygenInstallDir}/tools/ant/lib/ant-launcher.jar"${ps}
"${oxygenInstallDir}/tools/ant/lib/ant.jar"${ps}
"${oxygenInstallDir}/tools/ant/lib/ant-trax.jar"${ps}
"${oxygenInstallDir}/lib/saxon9ee.jar"${ps}
"${oxygenInstallDir}/lib/saxon9-ant.jar"
org.apache.tools.ant.launch.Launcher
-f ${pd}/tests/build-xspec.xml -Dpd=${pd} -Din=${cfne} run</pre>
<p>The only extra download is <code>saxon9-ant.jar</code>, which I added to my &lt;oXygen/&gt; installation so I could use a Saxon-specific Ant task. You can still run Ant, but not the Saxon Ant task, from &lt;oXygen/&gt; if you don&#8217;t have it, and it <a title="saxon9-ant.jar question on oxygen-user mailing list." href="http://www.oxygenxml.com/pipermail/oxygen-user/2010-January/003012.html">may</a> yet come with a future release.</p>
]]></content:encoded>
			<wfw:commentRss>http://inasmuch.as/2010/02/02/xspec-ant-oxygen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Presentations page updated</title>
		<link>http://inasmuch.as/2009/10/05/presentations-page-updated/</link>
		<comments>http://inasmuch.as/2009/10/05/presentations-page-updated/#comments</comments>
		<pubDate>Mon, 05 Oct 2009 14:03:42 +0000</pubDate>
		<dc:creator>tkg</dc:creator>
				<category><![CDATA[XSL]]></category>
		<category><![CDATA[XSLT]]></category>

		<guid isPermaLink="false">http://inasmuch.as/?p=381</guid>
		<description><![CDATA[Inasmuch as I added both my XML-in-Practice 2009 talk on XSL FO 2.0 and my XML Prague 2009 talks and posters to the &#8220;Presentations&#8221; page at http://www.menteithconsulting.com/wiki/Presentations, it is now up to date. The XSL FO 2.0 talk covers: a &#8230; <a href="http://inasmuch.as/2009/10/05/presentations-page-updated/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><span style="font-variant: small-caps;">Inasmuch as</span> I added both my <a title="XML-in-Practice 2009 Conference &amp; Exposition" href="http://www.idealliance.org/conferences_and_events/xmlinpractice_2009_conference__exposition">XML-in-Practice 2009</a> talk on XSL FO 2.0 and my <a title="XML Prague" href="http://www.xmlprague.cz/">XML Prague 2009</a> talks and posters to the &#8220;Presentations&#8221; page at <a title="Menteith Consulting &quot;Presentations&quot; page." href="http://www.menteithconsulting.com/wiki/Presentations">http://www.menteithconsulting.com/wiki/Presentations</a>, it is now up to date.<span id="more-381"></span></p>
<p>The <a title="'XSL FO 2.0' talk." href="http://www.menteithconsulting.com/wiki/XMLInPractice2009/XSLFO20">XSL FO 2.0 talk</a> covers: a quick overview of XSL 1.1 (by building up a formatted page in the manner of Genesis 1); the current uses for XSL; the W3C XSL FO subgroup; the XSL 2.0 <a title="XSL-FO 2.0 Workshop 2006: Report" href="http://www.w3.org/Style/XSL/2006-Workshop/Report.html">requirements workshop</a> and <a title="Extensible Stylesheet Language (XSL) Requirements Version 2.0" href="http://www.w3.org/TR/xslfo20-req/">requirements document</a>; and some examples of what will be possible with XSL 2.0.</p>
<p>The &#8220;<a title="'Testing XSLT' talk" href="http://www.menteithconsulting.com/wiki/XMLPrague2009/TestingXSLT">Testing XSLT</a>&#8221; talk from XML Prague 2009 covers more of the &#8220;what&#8221; and &#8220;why&#8221; of testing XSLT that previous renditions of the talk or tutorial. It consequently has fewer details about individual tools, but for that there&#8217;s now resource pages for <a title="'Testing XSLT' resource page." href="http://www.menteithconsulting.com/wiki/TestingXSLT">XSLT</a> and <a title="'Testing XSL FO' resource page." href="http://www.menteithconsulting.com/wiki/TestingXSLFO">XSL FO</a> tools on the <a title="Menteith Consulting Ltd" href="http://www.menteithconsulting.com/">Menteith Consulting</a> website.</p>
<p>The other XML Prague 2009 talk is about <a title="Xcruciate all-XML server" href="http://www.xcruciate.co.uk">Xcruciate</a>, where I was the second speaker with Mark Howe of Cyberporte, and the posters were about <a title="'XSL-FO 2.0' poster." href="http://www.menteithconsulting.com/wiki/XMLPrague2009/XSLFO20">XSL FO 2.0 requirements</a> and <a title="'Using XSLT for C code generation and testing' poster" href="http://www.menteithconsulting.com/wiki/XMLPrague2009/UsingXSLTforCcodegenerationandtesting">using XSLT</a> with <a title="xmlroff XSL formatter" href="http://xmlroff.org">xmlroff</a> to generate C source code and other things.</p>
]]></content:encoded>
			<wfw:commentRss>http://inasmuch.as/2009/10/05/presentations-page-updated/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XSpec</title>
		<link>http://inasmuch.as/2009/07/20/xspec/</link>
		<comments>http://inasmuch.as/2009/07/20/xspec/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 11:33:31 +0000</pubDate>
		<dc:creator>tkg</dc:creator>
				<category><![CDATA[XSLT]]></category>

		<guid isPermaLink="false">http://tkg.menteith.com/?p=220</guid>
		<description><![CDATA[I forgot to mention that I&#8217;m also a member of the project for Jeni Tennison&#8217;s XSpec project at http://xspec.googlecode.com/, which is a Behavior Driven Development (BDD) framework for XSLT.Â  Mind you, the few changes that I have made would only &#8230; <a href="http://inasmuch.as/2009/07/20/xspec/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I forgot to mention that I&#8217;m also a member of the project for Jeni Tennison&#8217;s XSpec project at <a title="XSpec project page" href="http://xspec.googlecode.com">http://xspec.googlecode.com/</a>, which is a Behavior Driven Development (BDD) framework for XSLT.Â  Mind you, the few changes that I have made would only count as gilding the lily.</p>
]]></content:encoded>
			<wfw:commentRss>http://inasmuch.as/2009/07/20/xspec/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Break your own tests</title>
		<link>http://inasmuch.as/2009/06/11/break-your-own-tests/</link>
		<comments>http://inasmuch.as/2009/06/11/break-your-own-tests/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 20:55:17 +0000</pubDate>
		<dc:creator>tkg</dc:creator>
				<category><![CDATA[XSLT]]></category>

		<guid isPermaLink="false">http://tkg.menteith.com/?p=183</guid>
		<description><![CDATA[Some days you may be the best XSLT exponent on the planet; other days you may make a simple mistake and not realise it. Particularly when you are writing tests after someone else wrote the stylesheet, if you find yourself &#8230; <a href="http://inasmuch.as/2009/06/11/break-your-own-tests/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Some days you may be the best XSLT exponent on the planet; other days you may make a simple mistake and not realise it.</p>
<p>Particularly when you are writing tests after someone else wrote the stylesheet, if you find yourself on a roll with all your new tests coming up green first time, it can be useful to occasionally break a working test a little so that it&#8217;s bound to fail.<span id="more-183"></span> If the test fails, then you&#8217;ve confirmed what you already knew, and you can fix the test and move on.Â  If the test doesn&#8217;t fail, that&#8217;s useful information, too, since you&#8217;ve shown there&#8217;s a mistake in the tests or the stylesheet.</p>
<p>It doesn&#8217;t really matter how you break the test, provided that it really is broken and that you can change it back easily.Â  Little ways of breaking a test include: adding a character to element or attribute names, either in XPaths in assertions or in expected results; deleting an element or attribute in expected results; or adding a character or two to expected text or attribute values.</p>
<p>I recently added tests to a stylesheet and tests written by a client.Â  I did purposely break a working test from time-to-time to check that things were as I expected (and from time-to-time accidentally break a test on the way to getting a working test).Â  However, a few of the tests that I&#8217;d received were written with assertions that would never fail, and these had to be rewritten.Â  Happily, the section of the stylesheet that they covered was correct, which goes to show that some days you may be the best XSLT exponent on the planet and other days you may make a simple mistake and not realise it.</p>
]]></content:encoded>
			<wfw:commentRss>http://inasmuch.as/2009/06/11/break-your-own-tests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Juxy</title>
		<link>http://inasmuch.as/2009/02/16/juxy/</link>
		<comments>http://inasmuch.as/2009/02/16/juxy/#comments</comments>
		<pubDate>Mon, 16 Feb 2009 15:20:20 +0000</pubDate>
		<dc:creator>tkg</dc:creator>
				<category><![CDATA[XSLT]]></category>

		<guid isPermaLink="false">http://tkg.menteith.com/2009/02/16/juxy/</guid>
		<description><![CDATA[Juxy (http://juxy.tigris.org/), by Pavel Sher, is a library for unit testing XSLT stylesheets from Java. After a long time spent threatening to do so, I finally contributed an XML format for Juxy tests. I&#8217;ve been riding my hobby horse for &#8230; <a href="http://inasmuch.as/2009/02/16/juxy/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Juxy (<a title="Juxy project page" href="http://juxy.tigris.org/"><span class="icon">http://juxy.tigris.org/</span></a>), by Pavel Sher, is a library for unit testing XSLT stylesheets from Java.  After a long time spent threatening to do so, I finally contributed an XML format for Juxy tests.</p>
<p>I&#8217;ve been riding my hobby horse for a while about the usefulness, nay necessity, of <a title="Why use more that XSLT for testing XSLT?" href="2008/06/09/why-use-more-that-xslt-for-testing-xslt/">using more than XSLT when testing XSLT</a> (and I&#8217;ll be back in that saddle again at <a title="1.5 @ Prague" href="2009/02/04/15-prague/">XML Prague</a>).  Juxy fits that bill, since it&#8217;s in Java, but it always seems to me that writing tests in Java is more than many XSLT practitioners would want to do.  So I wrote a stylesheet to generate Java from XML descriptions of the tests.<span id="more-146"></span></p>
<p>Here&#8217;s a Java test case from the Juxy project page:</p>
<pre>public class SampleTestCase extends JuxyTestCase {
  public void testListTransformation() {
      newContext("stylesheet.xsl");
      context().setDocument("" +
          "&lt;list&gt;" +
          "	&lt;item&gt;item 1&lt;/item&gt;" +
          "	&lt;item&gt;item 2&lt;/item&gt;" +
          "	&lt;item&gt;item 3&lt;/item&gt;" +
          "&lt;/list&gt;");
      Node result = applyTemplates();
      xpathAssert("text()", "item 1, item 2, item 3").eval(result);
  }
}</pre>
<p>and here&#8217;s a near-equivalent XML test case:</p>
<pre>&lt;test name="MoreThanOneElementInTheList_ApplyTemplates"&gt;
  &lt;document select="/list"&gt;&lt;list&gt;&lt;item&gt;first item&lt;/item&gt;&lt;item&gt;second item&lt;/item&gt;
&lt;item&gt;third item&lt;/item&gt;&lt;/list&gt;&lt;/document&gt;
  &lt;apply-templates select="/list"/&gt;
  &lt;assert-equals&gt;
    &lt;expected&gt;first item, second item, third item&lt;/expected&gt;
  &lt;/assert-equals&gt;
&lt;/test&gt;</pre>
<p>Testing for the correct result is the easy part.  All the XSLT-only testing frameworks do the job when you&#8217;re just testing the happy scenario (my new phrase for the week, picked up from <a title="'happy scenario' in use." href="http://blog.benhall.me.uk/labels/WatiN.html">here</a>).  One reason for going outside XSLT is testing for <code>&lt;xsl:message terminate="yes"&gt;</code>, which would make an XSLT-only test framework crash and burn along with the stylesheet under test.</p>
<p>The following Juxy test causes the stylesheet processing to terminate, but Juxy just records that the <code>assert-error</code> assertion was true, rather than Juxy terminating as well:</p>
<pre>&lt;test name="Stylesheet"&gt;
  &lt;stylesheet href="xmlTest/x2j.xsl"/&gt;
  &lt;document&gt;&lt;stylesheet href="href"&gt;&lt;root/&gt;&lt;/stylesheet&gt;&lt;/document&gt;
  &lt;assert-error&gt;
    &lt;apply-templates/&gt;
  &lt;/assert-error&gt;
&lt;/test&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://inasmuch.as/2009/02/16/juxy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>xs3p is not the secret sauce</title>
		<link>http://inasmuch.as/2009/01/26/xs3p-is-not-the-secret-sauce/</link>
		<comments>http://inasmuch.as/2009/01/26/xs3p-is-not-the-secret-sauce/#comments</comments>
		<pubDate>Mon, 26 Jan 2009 19:56:22 +0000</pubDate>
		<dc:creator>tkg</dc:creator>
				<category><![CDATA[XML]]></category>
		<category><![CDATA[XSLT]]></category>

		<guid isPermaLink="false">http://tkg.menteith.com/2009/01/26/xs3p-is-not-the-secret-sauce/</guid>
		<description><![CDATA[I used to think that the open source xs3p schema documentation generator stylesheet from the now-defunct http://titanium.dstc.edu.au/ was the secret sauce behind the remarkably similar graphical XML schema representations of both &#60;oXygen/&#62; and XML Spy.Â  I was wrong: a modified &#8230; <a href="http://inasmuch.as/2009/01/26/xs3p-is-not-the-secret-sauce/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I used to think that the open source <a title="xs3p at fiforms.org" href="http://xml.fiforms.org/xs3p/">xs3p</a> schema documentation generator stylesheet from the now-defunct  http://titanium.dstc.edu.au/ was the secret sauce behind the remarkably similar graphical XML schema representations of both <a title="Diagram in &lt;oXygen/&gt;" href="http://www.oxygenxml.com/doc/ug-oxygen/xml-schema-diagram-full-model-view.html#figure-XML-Schema-editor-diagram">&lt;oXygen/&gt;</a> and <a title="Diagram in XML Spy" href="http://www.altova.com/products/xmlspy/graphical_xml_schema_editor.html">XML Spy</a>.Â  I was wrong: a modified version of xs3p is bundled with &lt;oXygen/&gt; and is used when generating printed documentation, and xs3p may still be included in XML Spy (though it&#8217;s unlikely since its currently not listed on their <a title="Altova third-party license/notices page" href="http://www.altova.com/legal_3rdparty.html">third-party licenses</a> page), but even in its <a title="xs3p page on the wayback machine" href="http://web.archive.org/web/20051230193154/titanium.dstc.edu.au/xml/xs3p/index.shtml">titanium days</a>, it didn&#8217;t do any graphical representations of a schema.</p>
<p>Does anybody know of an open source toolkit that can produce that sort of graphical representation?</p>
]]></content:encoded>
			<wfw:commentRss>http://inasmuch.as/2009/01/26/xs3p-is-not-the-secret-sauce/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why use more that XSLT for testing XSLT?</title>
		<link>http://inasmuch.as/2008/06/09/why-use-more-that-xslt-for-testing-xslt/</link>
		<comments>http://inasmuch.as/2008/06/09/why-use-more-that-xslt-for-testing-xslt/#comments</comments>
		<pubDate>Mon, 09 Jun 2008 12:58:00 +0000</pubDate>
		<dc:creator>tkg</dc:creator>
				<category><![CDATA[XSLT]]></category>

		<guid isPermaLink="false">http://tkg.menteith.com/2008/06/09/why-use-more-that-xslt-for-testing-xslt/</guid>
		<description><![CDATA[Why should you prefer an XSLT unit testing framework that uses more that just XSLT? Two reasons: xsl:message and multiple output documents. Most XSLT unit testing frameworks are written purely in XSLT; that is, the framework uses an XSLT processor &#8230; <a href="http://inasmuch.as/2008/06/09/why-use-more-that-xslt-for-testing-xslt/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Why should you prefer an XSLT unit testing framework that uses more that just XSLT? Two reasons: <code>xsl:message</code> and multiple output documents.<span id="more-124"></span></p>
<p>Most XSLT unit testing frameworks are  written purely in XSLT; that is, the framework uses an XSLT processor and XSLT stylesheet to run the tests (or a massaged form of the tests) on the stylesheet under test.  The test result output is typically XML that is processed by another stylesheet to produce HTML for viewing.</p>
<p>Using XSLT to test XSLT may be partly explained by XSLT being an XSLT practitioner&#8217;s favourite tool and partly by Eric van der Vlist&#8217;s XSLT-based <a href="http://xsltunit.org/" title="XSLTunit web site">XSLTunit</a> being the first known framework.  Jeni Tennison&#8217;s possibly unnamed <a href="http://www.jenitennison.com/xslt/utilities/unit-testing/" title="Unit Testing XSLT">framework</a> is also purely XSLT (though XSLT 2.0 instead of the XSLT 1.0 in XSLTunit), and it inspired the <a href="http://tennison-tests.sourceforge.net/" title="Tennison Tests">Tennison Tests</a> framework, which automates running the multiple tests but hasn&#8217;t tinkered with the XSLT nature of the tests, and also <a href="http://www.fgeorges.org/xslt/xslt-unit/" title="XTC - XSLT &amp; XQuery Unit Testing">XTC</a>.</p>
<p>By comparison, the frameworks that rely on compiling code to run tests are, it seems, much less well known.  They include <a href="http://juxy.tigris.org/" title="Juxy">Juxy</a>, which compiles Java code for JUnit tests, and <a href="http://xmlunit.sourceforge.net/" title="XMLUnit">XMLUnit</a>, which has versions in Java for use with JUnit and C# for use with NUnit.</p>
<p>IMO, the extra-XSLT frameworks have the advantage that you can (or should be able to) make assertions about aspects of the stylesheet to which a pure XSLT framework is either blind or oblivious.</p>
<p>Inasmuch as you typically use <code>xsl:message</code> to output messages when there&#8217;s an error in the source document or there&#8217;s something that the stylesheet can&#8217;t handle, you should want to make assertions about whether or not a message has been emitted.  This is particularly true when you are writing &#8220;dirty&#8221; tests that you expect will trigger error handling (as opposed to &#8220;clean&#8221; tests that you expect to work), and even more true when you expect to execute a <code>xsl:message</code> that has &#8216;<code>terminate="yes"</code>&#8216;.</p>
<p>Pure XSLT frameworks don&#8217;t provide a way to tell when a message is emitted, and any <code>&lt;xsl:message terminate="yes"&gt;</code> will terminate the testing framework along with the stylesheet under test, leaving you with nothing.  A good extra-XSLT framework will let you make assertions about <code>xsl:message</code> and will not evaporate when the stylesheet terminates itself.</p>
<p>When a stylesheet may create multiple result documents, you probably want to make assertions about the existence and content of those result documents.  That could be left to a post-process, but if the file names and the content relate to the content of the source document, it is simpler and more self-contained when you could make your assertions in the same unit tests as you use to make assertions about the rest of the operation of the stylesheet.  A pure XSLT framework can&#8217;t provide any indication that a result document was or was not created, though it may be possible to access a secondary result document as part of the unit tests (provided the XSLT processor finishes writing the secondary result document while the transformation-that-is-the-running-of-the-unit-tests is still in progress).  An extra-XSLT framework typically lets you make assertions after the stylesheet-under-test has finished.</p>
<p>So while there are some aspects of XSLT processing, such as what happens on a <code>xsl:message</code>, that you as a stylesheet writer don&#8217;t need to concern yourself about, you as a stylesheet tester do want to know about them, so you need more that just an XSLT processor in the framework for your unit tests.</p>
]]></content:encoded>
			<wfw:commentRss>http://inasmuch.as/2008/06/09/why-use-more-that-xslt-for-testing-xslt/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Testing XSLT at XTech 2008</title>
		<link>http://inasmuch.as/2008/03/18/testing-xslt-at-xtech-2008/</link>
		<comments>http://inasmuch.as/2008/03/18/testing-xslt-at-xtech-2008/#comments</comments>
		<pubDate>Tue, 18 Mar 2008 20:02:23 +0000</pubDate>
		<dc:creator>tkg</dc:creator>
				<category><![CDATA[XSLT]]></category>

		<guid isPermaLink="false">http://tkg.menteith.com/2008/03/18/testing-xslt-at-xtech-2008/</guid>
		<description><![CDATA[I have been selected to present my &#8220;Testing XSLT&#8221; tutorial at XTech 2008 in Dublin in May.]]></description>
			<content:encoded><![CDATA[<p>I have been selected to present my &#8220;Testing XSLT&#8221; tutorial at XTech 2008 in Dublin in May.</p>
]]></content:encoded>
			<wfw:commentRss>http://inasmuch.as/2008/03/18/testing-xslt-at-xtech-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

