XSH2 news http://xsh.sourceforge.net XSH2 - XML Editing Shell en Copyright 2006, Petr Pajas Wed, 03 Jan 2007 16:14:38 +0100 New web designhttp://xsh.sourceforge.net/news_7.html#g-Wed-Mar-20-10_50_14-2002g-Wed-Mar-20-10_50_14-2002Wed, 20 Mar 2002 10:50:14 GMTXSH Web page has a new design and background. I use XSH to generate the pages from simple xml/html templates. The XSH code needed has no more than <a href="make.html">these 276 lines</a> :-) XSH 1.3 releasedhttp://xsh.sourceforge.net/news_7.html#g-Wed-Mar-20-19_17_03-2002g-Wed-Mar-20-19_17_03-2002Wed, 20 Mar 2002 19:17:03 GMTBesides many bugfixes, xsh now features <ul> <li>Grammar optimizations, so that the XSH grammar parser is <b>much faster</b></li> <li>Node-list variables</li> <li>Perl conditional and <tt>foreach</tt> statements</li> <li>HTML parsing and saving</li> <li>Correct charset conversions</li> <li>Posibility to identify documents by variables</li> <li><a href="http://xmldb-org.sourceforge.net/xupdate/xupdate-wd.html">XUpdate</a> support</li> </ul> Parse from pipe in CVS versionhttp://xsh.sourceforge.net/news_6.html#g-Thu-Mar-21-16_45_03-2002g-Thu-Mar-21-16_45_03-2002Thu, 21 Mar 2002 16:45:03 GMT New <tt>open_PIPE</tt> command allows parsing XML output of a system command. It's in the CVS. id() XPath handling fixedhttp://xsh.sourceforge.net/news_6.html#g-Wed-Mar-27-17_47_07-2002g-Wed-Mar-27-17_47_07-2002Wed, 27 Mar 2002 17:47:07 GMT Recent versions of XSH failed to evaluate id() XPath-queries from document node. This bug is now fixed in the CVS. Module bundle updatedhttp://xsh.sourceforge.net/news_6.html#g-Wed-Mar-27-18_07_27-2002g-Wed-Mar-27-18_07_27-2002Wed, 27 Mar 2002 18:07:27 GMT LibXML-1.40 dependency problems fixed by adding latest XML::SAX and XML::NamespaceSupport to <a href="xmltools-bundle.tar.gz">xmltools-bundle.tar.gz</a> (see <a href="download.html">Download</a> page). bugfix allowing usage of document() functionhttp://xsh.sourceforge.net/news_6.html#g-Wed-Apr-17-15_16_58-2002g-Wed-Apr-17-15_16_58-2002Wed, 17 Apr 2002 15:16:58 GMT A bug in XSH that was making it impossible to use the document() function at the beginning of an XPath expression is now fixed. Check out the CVS version. Using gzipped fileshttp://xsh.sourceforge.net/news_6.html#g-Wed-Apr-17-15_16_58-2002g-Wed-Apr-17-15_16_58-2002Wed, 17 Apr 2002 15:16:58 GMT XSH now automatically uses <tt>gzip -c</tt> to save files with <tt>.gz</tt> extension. Parsing of gzipped XML/HTML files is supported already in XML::LibXML. Seems like I should make a new release soon. For now, check out the CVS version. XSH 1.4 releasedhttp://xsh.sourceforge.net/news_5.html#g-Fri-Apr-19-20_36_12-2002g-Fri-Apr-19-20_36_12-2002Fri, 19 Apr 2002 20:36:12 GMT New version includes: <ul> <li>support for gzipped files</li> <li>parsing from a pipe</li> <li>several bug-fixes</li> </ul> New features in CVS versionhttp://xsh.sourceforge.net/news_5.html#g-Fri-May-31-16_20_55-2002g-Fri-May-31-16_20_55-2002Fri, 31 May 2002 16:20:55 GMT <ul> <li>allows saving expanded <a href="http://www.w3.org/TR/xinclude/">XInclude</a> sections back to the original files and creating new XInclude sections (see <tt>help save_xinclude</tt>). </li> <li><tt>save</tt> creates backups now, unless <tt>nobackups</tt> is called</li> <li>XML::GDOME may now be used instead of XML::LibXML (run <tt>xsh -g</tt>). XML::GDOME backend is still incomplete and lacks many features. </li> <li>several bug-fixes</li> <li>XML-LibXML version 1.50 or soon available 1.51 highly recommended</li> </ul> Module bundle updatedhttp://xsh.sourceforge.net/news_5.html#g-Fri-Jun-21-10_52_37-2002g-Fri-Jun-21-10_52_37-2002Fri, 21 Jun 2002 10:52:37 GMT XML::LibXML-1.52, XML::LibXSLT-1.50, XML::XUpdate-0.2.1 latest XML::SAX and XML::NamespaceSupport. Get <tt>xmltools-bundle.tar.gz</tt> from the <a href="download.html">Download</a> page. xml.com on XSHhttp://xsh.sourceforge.net/news_5.html#g-Wed-Jul-11-05_46_00-2002g-Wed-Jul-11-05_46_00-2002Wed, 11 Jul 2002 05:46:00 GMT Kip Hampton wrote <a href="http://www.xml.com/pub/a/2002/07/10/kip.html?page=1">an article</a> about XSH on <a href="http://xml.com">xml.com</a>. It is both instructive and flattering. Thank you Kip! New CVS versionhttp://xsh.sourceforge.net/news_5.html#g-Mon-Jul-15-20_14_51-2002g-Mon-Jul-15-20_14_51-2002Mon, 15 Jul 2002 20:14:51 GMT I've just committed a new version to CVS. It features improved grammar (now you may e.g. ommit semicollons after statement blocks). Moreover, I've done some optimizations so that the new grammar is parsed significantly faster by RecDescent than the old one. Please test it and report bugs so that we may have a new release soon. XSH 1.5 releasedhttp://xsh.sourceforge.net/news_4.html#g-Mon-Sep-2-14_50_00-2002g-Mon-Sep-2-14_50_00-2002Mon, 2 Sep 2002 14:50:00 GMT Changes to 1.4: <ul> <li>XInclude support</li> <li>improved grammar</li> <li>some more namespace support fixes</li> <li>XSH and XPath <a href="doc/s_binding.html#binding_perl">evaluation</a> in in-line Perl code</li> <li>new experimental <a href="doc/s_sort_command.html">sort</a> command (feedback welcome)</li> <li>new experimental support for custom <a href="doc/s_fold_command.html">folding</a> (feedback welcome)</li> <li>experimental support for inserting <strong>entity references</strong></li> <li>support for <strong>recovering parsing</strong></li> <li>history is stored in <tt>~/.xsh_history</tt> between sessions</li> <li>got rid of Text::Iconv dependency (LibXML's iconv support used instead)</li> <li>several bug-fixes (thanx all those who reported those nasty little beasts)</li> </ul> There is also have new extensive <a href="documentation.html">XSH Reference</a> available. Please don't hesitate to send me any suggestions to improve its accuracy, completeness, and of course the English. XSH and XML::LibXML 1.53http://xsh.sourceforge.net/news_4.html#g-Tue-Oct-8-17_20_52-2002g-Tue-Oct-8-17_20_52-2002Tue, 8 Oct 2002 17:20:52 GMT XSH 1.5 is <b>known not to work</b> with XML::LibXML 1.53 due to some major changes in the module's structure. Please understand, that XSH 1.5 was released <b>before</b> XML::LibXML 1.53 was out. Release of XSH 1.6 (fixing the problem and bringing new features such as local variables and subroutine) is planned for the next week or two. In the meantime, users of XML::LibXML 1.53 may either downgrade XML::LibXML to 1.52 (shipped with <a href="xmltools-bundle.tar.gz">xmltools-bundle.tar.gz</a>) or experiment with the CVS version of XSH. XSH 1.6 releasedhttp://xsh.sourceforge.net/news_4.html#g-Fri-Nov-7-18_39_27-2002g-Fri-Nov-7-18_39_27-2002Fri, 7 Nov 2002 18:39:27 GMT Ok, finally I found a few spare minutes to release the long promised new version of XSH!<br/> Download from <a href="http://sourceforge.net/project/showfiles.php?group_id=44350&amp;release_id=120974">here</a>.<br/> <b>Changes between 1.6 and 1.5:</b> <ul> <li>First of all, XSH 1.6 requires <a href="http://search.cpan.org/author/PHISH/XML-LibXML-1.54_0/">XML::LibXML 1.54_0</a> or higher (technically, version <a href="http://search.cpan.org/author/PHISH/XML-LibXML-1.53/">1.53</a> works too but since it contains some major bugs, it is not recommended!) </li> </ul> New features: <ul> <li>improved <a href="documentation.html">documentation</a></li> <li><a href="doc/html/index.html#local_command">local</a> (temporary) variables</li> <li><a href="doc/html/index.html#def">subroutine</a> may take parameters</li> <li>forward defs (with no body) allow recursion</li> <li><a href="doc/html/index.html#call_command">call</a> strongly checks argument types</li> <li>new <a href="doc/html/index.html#loc">location</a> keywords: <tt>append</tt>, <tt>prepend</tt></li> <li>new location semantics (mostly clean-up)</li> <li><a href="doc/html/index.html#perl_code">perl-code</a> result substitution in <a href="doc/html/index.html#expression">expressions</a> via <tt>${{{ ... }}}</tt></li> <li>string xpath result substitution in <a href="doc/html/index.html#expression">expressions</a> via <tt>${( ... )}</tt></li> <li>new <a href="doc/html/index.html#perl_shell">Perl functions</a>: <tt>literal(...)</tt>, <tt>xml_list(...)</tt>, and <tt>count(...)</tt></li> <li>new <a href="doc/html/index.html#cdonopen"><tt>switch-to-new-documents</tt></a> flag (allows to disable selecting</li> <li>simplified and more general <a href="doc/html/index.html#open_command">open</a>/<a href="doc/html/index.html#save_command">save</a> commands</li> <li>support document level node insertion</li> <li>improved error reporting from XSH grammar parser</li> <li><a href="doc/html/index.html#open_command">docbook</a> loading support</li> <li>pipeline redirection may follow statements</li> <li>grammar optimizations (some more speed-up achieved)</li> </ul> Other changes: <ul> <li>XSH now starts with <a href="doc/html/index.html#validation">validation</a> 0</li> <li>new xsh option <tt>-v</tt> allows starting with validation on</li> <li>obsolete xsh <tt>-c</tt> flag removed</li> </ul> Bug fixes: <ul> <li>indentation fixes</li> <li>fixed <tt>ReadLine::Gnu</tt> completion support</li> <li><tt>~/.xsh_history</tt> works for <tt>Term::ReadLine::Gnu</tt> now</li> <li>fixed doubled history entries</li> <li>double/single quoting fixed in expressions</li> <li>experimental support for <a href="doc/html/index.html#nodetype">entity reference</a> insertion</li> <li>fixed error catching</li> <li>fixed and improved Ctrl+C handling</li> <li>some more bug-fixes</li> </ul> xsh-users maing listhttp://xsh.sourceforge.net/news_4.html#g-Tue-Nov-12-20_04_07-2002g-Tue-Nov-12-20_04_07-2002Tue, 12 Nov 2002 20:04:07 GMT I've just created a <a href="http://sourceforge.net/mailarchive/forum.php?forum=xsh-users">mailing list</a> for free discussion about XSH. Subscribe <a href="https://lists.sourceforge.net/lists/listinfo/xsh-users">here</a>. Long time no news...http://xsh.sourceforge.net/news_4.html#g-Wed-Mar-12-15_04_10-2003g-Wed-Mar-12-15_04_10-2003Wed, 12 Mar 2003 15:04:10 GMT <p>As it's been too long since you've heard any news from me I'm bringing you some today.</p> <p>While I'm still postponing a stable release until libxml2 and XML::LibXML are in sync again (XML::LibXML &lt;= 1.54 is known not to work with libxml2-2.5.x or vice versa - you choose), you may check out and try the CVS.</p> <b>Features:</b> <ul> <li>bug fixes.</li> <li>new <tt>try {...} catch [[local] $var] {...}</tt> syntactic construction allows to catch and handle parsing and other errors. </li> <li>new <tt>throw</tt> command (aka <tt>perl { die "...\n" }</tt>)</li> <li>new Perl/PHP-like <tt>last, next, redo, return</tt> loop and subroutine interruption commands</li> <li>new <tt>strip</tt> command for stripping whitespace</li> <li>new <tt>normalize</tt> command for puting adjacent text nodes together</li> <li>new <tt>catalog</tt> command makes the XML parser use a given catalog file</li> <li>new experimental <tt>iterate</tt> command</li> <li>changed <tt>sort</tt> command syntax (you've been warned)</li> <li>completion improvements (now little more context sensitive and completes variable, subroutine and help chapter names)</li> <li>new Perl support function <tt>type</tt> to check node types</li> <li>Perl support functions now return lists in array context</li> <li>added -w command-line option to turn all DTD related stuff off</li> <li>added -a command-line option to pass command line arguments to a XSH script via Perl's @ARGV </li> <li>added -l command-line option to pass script name</li> <li>access to all configuration flags/options (such as <tt>validation</tt>) through variables to allow making changes <tt>local</tt> (read <tt>`help <i>flag</i>'</tt> or run <tt>var</tt> to see a list) </li> <li>and some more...</li> </ul> Thinking about XSH 2.0http://xsh.sourceforge.net/news_3.html#g-Fri-Mar-28-13_12_52-2003g-Fri-Mar-28-13_12_52-2003Fri, 28 Mar 2003 13:12:52 GMT <p>1st <a href="http://www.cpan.org/modules/by-category/11_String_Lang_Text_Proc/XML/ILYAM/XML-LibXML-XPathContext-0.01.tar.gz">release</a> of a new Perl module called <a href="http://theoryx5.uwinnipeg.ca/CPAN/data/XML-LibXML-XPathContext/XPathContext.html">XML::LibXML::XPathContext</a> is out and I'm thinking of some backward incompatible changes for XSH 2.0 as described <a href="http://sourceforge.net/mailarchive/forum.php?thread_id=1893604&amp;forum_id=12996">here</a>. I'd like to hear any opinions, comments, suggestions, further feature requests, etc., before I proceed to start implementing on them in a new CVS branch. </p> XSH 1.8 released (at last)http://xsh.sourceforge.net/news_3.html#g-Tue-Aug-12-14_43_39-2003g-Tue-Aug-12-14_43_39-2003Tue, 12 Aug 2003 14:43:39 GMT <p>This release contains major feature enhancements as well as some bug-fixes.</p> <b>NEW FEATURES IN 1.8:</b><br/><b>User Interface:</b> <ul> <li>Major TAB-completion improvements: XPath-completion (can be disabled for large documents), improved filename, command, variable and keyword completion.</li> <li><tt>xsh</tt> without arguments starts in interactive shell mode if run from a terminal</li> <li><tt>xsh -p</tt> for easier pipe-line XML processing.</li> <li><tt>xsh</tt> now defines long variants for command-line options.</li> <li><tt>xsh --man</tt> displays nice manual page.</li> <li>New command-line options mentioned in older news on CVS versions.</li> </ul> <b>Language:</b> <ul> <li><tt>register-namespace</tt> (<tt>regns</tt>) command for registering a namespace prefix to be used in XPath queries.</li> <li><tt>register-function</tt> (<tt>regfunc</tt>) command allowing writing a custom XPath extension functions (in Perl) - EXPERIMENTAL</li> <li>XPath extensions functions <tt>xsh:doc</tt>,<tt>xsh:matches</tt>,<tt>xsh:grep</tt>,<tt>xsh:same</tt> (check <tt>xsh help xpath</tt> or the on-line documentation <a href="doc/">here</a>).</li> <li><tt>undef</tt> command to undefine existing XSH subroutines allowing include-scripts to be reloaded - EXPERIMENTAL</li> <li><tt>stream</tt> command for processing huge documents, that do not fit into memory - EXPERIMENTAL</li> <li><tt>rename</tt> command similar to <tt>map</tt> but working on node's name rather than content.</li> <li>Some document-oriented commands (such as <tt>save</tt>) no longer require arguments (assuming current document's ID by default)</li> <li>Many other new commands, mentioned in older news about CVS version enhancements include: <tt>try/catch, throw, last, prev, next, redo, return, strip, normalize, catalog, iterate, sort, types</tt>. Also mentioned before: <tt>sort</tt> has new simpified syntax. </li> </ul> <b>Support:</b> <ul> <li>Improved documentation: manpages (<tt>xsh(1)</tt> and <tt>XSH(3)</tt>), and command-line help <tt>xsh --help</tt>, <tt>xsh --man</tt>.</li> <li><tt>xsh</tt> now uses long options.</li> <li>Simplified <a href="download.html#windows">Windows installation</a> based on PPM.</li> <li>Disabled GDOME support</li> <li>Bug fixes.</li> <li>Updated <a href="xmltools-bundle.tar.gz">bundle of requred modules</a></li> </ul> <p>XSH 1.8 is supposed to be the last major XSH 1 release (maintenance and bug-fix releases may follow, though). In the future, I plan to concentrate on a next-generation XSH 2. It should be easier to use (and learn) yet even more powerful. As a result, XSH 2.0 will probably introduce incompatible changes both to the language and the command-line interface but hopefully, those changes will be to the better.</p> XSH 1.8.2 releasedhttp://xsh.sourceforge.net/news_3.html#g-Wed-Sep-10-17_08_41-2003g-Wed-Sep-10-17_08_41-2003Wed, 10 Sep 2003 17:08:41 GMT <p>This is a bug-fix release with some enhancements.</p> <b>NEW FEATURES IN 1.8.2:</b><br/> <ul> <li>new <a href="doc/xsh.html"><tt>xsh</tt> command-line option</a> <tt>--format</tt> to start with <tt>indent 1</tt> and <tt>keep_blanks 0</tt></li> <li>new <a href="doc/xsh.html"><tt>xsh</tt> command-line options</a> <tt>--input</tt> (<tt>-I</tt>), <tt>--output</tt> (<tt>-O</tt>), and <tt>--process</tt> (<tt>-P</tt>) to automatically open given file (as a default document called <tt>_</tt> - underscore) and save it after the processing </li> <li>external DTD validation support (<a href="doc/chunks/valid_command.html"><tt>valid</tt></a>, <a href="doc/chunks/validate_command.html"><tt>validate</tt></a>)</li> <li>RelaxNG and XSD validation support for <a href="doc/chunks/valid_command.html"><tt>valid</tt></a> and <a href="doc/chunks/validate_command.html"><tt>validate</tt></a> (requires latest CVS LibXML) - EXPERIMENTAL</li> <li>conditional variant of include (<a href="doc/chunks/ifinclude_command.html"><tt>ifinclude</tt></a>) added</li> <li> new commands <a href="doc/chunks/set_enc_command.html"><tt>set-enc</tt></a> and <a href="doc/chunks/set_standalone_command.html"><tt>set-standalone</tt></a> allow changing the values in document's XML decl</li> <li>new commands affecting serialization: <a href="doc/chunks/set_standalone_command.html"><tt>empty-tags</tt></a> ($EMPTY_TAGS) and <a href="doc/chunks/set_standalone_command.html"><tt>skip-dtd</tt></a> ($SKIP_DTD). </li> </ul> <b>Support:</b> <ul> <li>new Perl module: <tt>Inline::XSH</tt> to simplify inclusion of inline XSH code in Perl programs</li> </ul> <b>Bug fixes:</b> <ul> <li>fixed broken XPath extension functions (xsh:grep, xsh:matches, ...)</li> <li>encoding related fix for Perl 5.8 (now using Encode in Perl 5.8)</li> <li>serialization now doesn't force utf-8 encoding on files with no encoding specified</li> <li>fixed @ARGV passing</li> <li>documentation fixes</li> <li>other general bug fixes</li> </ul> fixed problem with package released on Sourceforgehttp://xsh.sourceforge.net/news_3.html#g-Thu-Sep-11-16_58_29-2003g-Thu-Sep-11-16_58_29-2003Thu, 11 Sep 2003 16:58:29 GMT The XML-XSH-1.8.2.tar.gz package released yesterday on SourceForge was broken (probably due to error in ftp transfer). CPAN upload was ok. All hopefully fixed now, thanks to Oliver Eikemeier for reporting the problem. New features in CVShttp://xsh.sourceforge.net/news_3.html#g-Mon-Dec-15-15_41_56-2003g-Mon-Dec-15-15_41_56-2003Mon, 15 Dec 2003 15:41:56 GMT <p>While new release should appear within the first weeks of January 2004, let's see some highlights already available in CVS version: </p> <ul> <li>Large amount of new predefined XPath extension functions making the tool more powerful than ever: <tt>current, doc, grep, id2, if, join, map, matches, max, min, new-attribute, new-cdata, new-chunk, new-comment, new-element, new-element-ns, new-pi, new-text, node-type, parse, path, reverse, same, serialize, split, sprintf, strmax, strmin, subst, substr, sum, times, var.</tt> </li> <li>All predefined XPath extension functions use XSH namespace associated by default with prefix <tt>xsh</tt>. New command <tt>extension-functions</tt> can be used to allow using these functions without prefix. </li> <li>Documentation improvements. Help on predefined extension functions is available with <tt>help xsh:<i>function</i></tt>. </li> <li> New commands: <tt>wrap, wrap-span, lineno</tt> </li> <li> Nodes created with <tt>copy, move, add</tt>, and <tt>wrap</tt> (and their variants) can be stored in a nodelist using <tt><i>command args</i> <b>result</b> %<i>nodelist</i></tt> syntax. </li> <li>Some internal preparation for XSH2</li> </ul> <p>The January release will most probably be the last XSH 1 release. XSH 2 will bring some backward incompatible changes and would yield to cleaner and simplier XSH syntax, more tightly connected to XPath and Perl (it will be for example possible to use both Perl expressions - enclosed in braces - and XPath expressions at almost any place where expressions can occur). It will also replace string variables of XSH 1 with XPath variables capable of containing any XPath object (accessible equally from XPath and Perl) In a nutshell: XSH2 will rock :-) </p> xmltools-bundle updatedhttp://xsh.sourceforge.net/news_2.html#g-Tue-Mar-30-10_33_48-2004g-Tue-Mar-30-10_33_48-2004Tue, 30 Mar 2004 10:33:48 GMT <p> A <a href="xmltools-bundle.tar.gz">package</a> bundling libxml2 and perl XML modules required to run XSH on GNU/Linux or Unix platforms was updated to ship the latest versions: libxml2-2.6.8, XML::LibXSLT 1.57 and a pre-release snapshot of XML::LibXML 1.58. </p> CVS brancheshttp://xsh.sourceforge.net/news_2.html#g-Wed-Dec-1-19_42_37-2004g-Wed-Dec-1-19_42_37-2004Wed, 1 Dec 2004 19:42:37 GMT <p>While preparing a XSH2 pre-release, I'm working on some CVS refactoring. Soon, I'm going to merge <tt>xsh2</tt> branch with the main branch. </p> <p>As a first step, I created a new branch, called prosaically <tt>xsh1</tt>, intended for possible future XSH1 bug-fixes. </p> <p>Use <pre>cvs -d:pserver:anonymous@cvs.xsh.sourceforge.net:/cvsroot/xsh login cvs -z3 co -r xsh1 xsh</pre> to get the XSH1 CVS head. </p> <p>Before I merge XSH2 with the main branch, use: <pre>cvs -d:pserver:anonymous@cvs.xsh.sourceforge.net:/cvsroot/xsh login cvs -z3 co -r xsh2 xsh</pre> to get the XSH2 CVS head. </p> <p> During the merging, the main branch may be quite unstable. </p> XSH2 2.0.1 pre-releasehttp://xsh.sourceforge.net/news_2.html#g-Sat-Dec-4-22_46_52-2004g-Sat-Dec-4-22_46_52-2004Sat, 4 Dec 2004 22:46:52 GMT <p> Finally, the first pre-release of XSH2 is out. This next-generation version of XSH is backward incompatible with 1.x releases, since the language evolved (for the better, I presume) in many aspects. I may still do some minor polishing before I call the language final, but most things are already there. The interpreter should be fairly stable. </p> <p>Currently, only source packages are available. PPM distribution for Windows/ActivState will follow.</p> <p> Of course, it is still possible to use both XSH and XSH2 installations simultaneously as they use different namespaces. You only have to rename one of the interpreters (e.g. <tt>xsh</tt> 1.x to <tt>xsh1</tt> - recommended - or <tt>xsh</tt> 2.x to <tt>xsh2</tt>). </p> <p>Besides being based on the XSH2 language, this release also introduces some new commands such as <tt>edit</tt> which allows opening a part of an XML document in an external editor and put the results back into the document. </p> <p>List of most fundamental differences between XSH2 and XSH1 languages can be found <a href="doc2/chunks/xsh2delta.html">here</a>. Complete documentation can be found in the <a href="documentation.html">documentation section</a>. </p> <p>Beside syntax changes, the most remarkable changes in XSH2 could be summarized as follows: <ul> <li>unified XPath and Perl data model</li> <li>only one kind of variables</li> <li>better integration with Perl: any argument can be specified either as an XPath or Perl expression</li> <li>commands and user-defined subroutines can return arbitrary objects</li> <li>commands have flags and named-parameters (instead of many optional positional arguments as in XSH1): <tt>--flag</tt> or <tt>:f</tt> and <tt>--param <i>val</i></tt> or <tt>:p <i>val</i></tt> </li> <li>various commands provide better functionality based on new options and flags introduced in XSH2</li> <li>true lexical variables (a.k.a. my)</li> <li>several new commands introduced: <a href="doc2/chunks/edit_command.html"><tt>edit</tt></a>, <a href="doc2/chunks/edit_string_command.html"><tt>edit-string</tt></a> <a href="doc2/chunks/c14n_command.html"><tt>canonical</tt></a>, <a href="doc2/chunks/index_command.html"><tt>index</tt></a>, <a href="doc2/chunks/my_command.html"><tt>my</tt></a>, <a href="doc2/chunks/set_dtd_command.html"><tt>set-dtd</tt></a> <a href="doc2/chunks/expression_command.html"><tt>expr</tt></a>, <a href="doc2/chunks/do_command.html"><tt>do</tt></a> </li> <li> several new XPath extension functions added: <a href="doc2/chunks/id2_function.html"><tt>xsh:id2</tt></a>, <a href="doc2/chunks/lcfirst_function.html"><tt>xsh:lcfirst</tt></a>, <a href="doc2/chunks/lc_function.html"><tt>xsh:lc</tt></a>, <a href="doc2/chunks/ucfirst_function.html"><tt>xsh:ucfirst</tt></a>, <a href="doc2/chunks/uc_function.html"><tt>xsh:uc</tt></a>. </li> <li>new <a href="doc2/chunks/eval_command.html"><tt>eval</tt></a> command evaluates given string as XSH2 (previously, in XSH1, 'eval' was an alias for 'perl')</li> <li>faster XSH-parser, faster evaluation engine</li> </ul> </p> XSH2 2.0.2http://xsh.sourceforge.net/news_2.html#g-Mon-Jan-10-00_04_03-2005g-Mon-Jan-10-00_04_03-2005Mon, 10 Jan 2005 00:04:03 GMT <p> This is a second pre-release of XSH2. Besides Windows packages it brings some bug-fixes as well as some new features </p> <ul> <li>history file can be specified via $HISTORY variable</li> <li>history file now defaults to ~/.xsh2_history</li> <li><a href="doc2/chunks/print_command.html">print</a> (aka <tt>echo</tt>) has a new flag: <tt>--stderr</tt> (<tt>:e</tt>)</li> <li><a href="doc2/chunks/wrap_command.html">wrap</a> has a new flag <tt>--inner</tt> (<tt>:i</tt>):<br/> <tt>wrap --inner a //b</tt> produces <tt>&lt;b&gt;&lt;a&gt;...&lt;/a&gt;&lt;/b&gt;</tt> from <tt>&lt;b&gt;...&lt;/b&gt;</tt></li> <li>new <a href="doc2/chunks/apropos_command.html">apropos</a> command for searching the help</li> <li><a href="doc2/chunks/save_command.html">save</a> has a new flag: <tt>--subtree</tt> (<tt>:S</tt>)</li> <li>various scattered fixes in the documentation</li> <li>fixed a nasty bug that prevented <tt>&amp;{...}</tt> constructs to work in perl&gt;=5.8.5 (thanks to CPAN testers)</li> </ul> xmltools-bundle updatedhttp://xsh.sourceforge.net/news_2.html#g-Wed-Sep-13-20_05_34-2006g-Wed-Sep-13-20_05_34-2006Wed, 13 Sep 2006 20:05:34 GMT <p> A <a href="xmltools-bundle.tar.gz">package</a> containing latest libxml2, libxslt, and Perl modules required to run XSH2 on GNU/Linux or Unix platforms was updated to ship the latest versions: libxml2-2.6.26, XML::LibXML 1.60, libxslt-1.1.17, and XML::LibXML 1.60. </p> CVS versionhttp://xsh.sourceforge.net/news_1.html#g-Wed-Sep-13-20_05_34-2006g-Wed-Sep-13-20_05_34-2006Wed, 13 Sep 2006 20:05:34 GMT <p> Please note that <a href="download.html#cvs">CVS version</a> contains various bug-fixes and improvements over XSH2 2.0.2 release. Here are some highlights. <ul> <li>many bugfixes</li> <li>added new XSH command 'set' for easy creating and modifying nodes</li> <li>improved namespace handling</li> <li>function xsh:match added</li> <li>completion for default, xsh, and user-defined XPath functions</li> <li>print --no-space</li> <li>xsh:filename() added</li> <li>save --encoding flag added</li> <li>rename syntax allows bare-words as names</li> </ul> </p> <p> A XSH2 2.0.3 release will follow later. </p> Compile XSH2 scripts into Perlhttp://xsh.sourceforge.net/news_1.html#g-Sun-Sep-17-18_57_58-2006g-Sun-Sep-17-18_57_58-2006Sun, 17 Sep 2006 18:57:58 GMT <p> As of today, <a href="download.html#cvs">CVS version</a> contains another nice feature. With <pre> $ xsh -c -D out.pl source.xsh</pre> one can compile XSH2 source into a stand-alone Perl script which can be run with <pre> $ perl out.pl arguments...</pre> The resulting Perl script still depends on <tt>XML::XSH2</tt> modules for run-time but starts significantly faster. </p> <p> A similar feature is available for Perl modules containing XSH2 code. With <a href="http://search.cpan.org/~ingy/Module-Compile/"><tt>Module::Compile</tt></a> installed, one can embed XSH2 into a module like: <pre> package Foo; ... use XML::XSH2::Compile; ls /; # any XSH2 code no XML::XSH2::Compile;</pre> First time the module is run, a <tt>.pmc</tt> file with pre-compiled XSH2 blocks is created. Perl automatically loads <tt>.pmc</tt> files instead of <tt>.pm</tt> when available. </p> The commands 'map' and 'rename' are going to changehttp://xsh.sourceforge.net/news_1.html#g-Mon-Sep-25-20_40_38-2006g-Mon-Sep-25-20_40_38-2006Mon, 25 Sep 2006 20:40:38 GMT <p>While working on a new release, some syntax polishing took place in the <a href="download.html#cvs">CVS version</a>. There were two commands with which I was so unsatisfied that I decided to change them in a way that may break some of the existing scripts. Let me summarize the changes: </p> <ul> <li>the mapping expression can also be XPath, or any other XSH2 argument expression, not just Perl </li> <li>if Perl is used, it must be enclosed in braces, as customary in XSH2. </li> <li><tt>$_</tt> is read-only and the result is collected from the expression value just like in Perl <tt>map</tt>. </li> <li>However, <tt>--in-place</tt> (<tt>:i</tt>) flag was introduced to preserve the old behavior, when the result is taken from <tt>$_</tt>. This is useful for <tt>s///</tt>-like substitutions with Perl code. </li> <li> <tt>map</tt> does not rename elements anymore, <tt>rename</tt> is used for that. Instead, <tt>map</tt> operates on element's content and the mapping expression may produce arbitrary nodes, not just text. </li> </ul> <p> Here is how the old syntax translates to the new one: </p> <table> <tr><th>Old syntax</th><th>New syntax</th></tr> <tr><td><tt>map { $_=uc } //text();</tt></td><td><tt>map { uc } //text();</tt></td></tr> <tr><td><tt>map $_=uc //text();</tt></td><td><tt>map { uc } //text();</tt></td></tr> <tr><td><tt>map s/foo/bar/ //text();</tt></td><td><tt>map :i { s/foo/bar/ } //text();</tt></td></tr> <tr><td><tt>map { $_='link' } //ref</tt></td><td><tt>rename link //ref;</tt></td></tr> </table> <p> And here are some funny examples from the documentation demonstrating the gained features: </p> <p><i>Recompute column sums in the last row of row-oriented table:</i> <pre>map sum(/table/row[position()&lt;last()]/ cell[count(xsh:current()/preceding-sibling::cell)+1]) /table/row[last()]/cell;</pre> </p> <p><i>The following commands do all about the same:</i> <pre>wrap --inner Z //*; map --reverse xsh:parse(concat("&lt;Z&gt;",xsh:serialize(node()),"&lt;/Z&gt;")) //*; map xsh:parse(concat("&lt;Z&gt;",xsh:serialize(node()),"&lt;/Z&gt;")) { reverse xpath('//*') };</pre> </p> <p>Feel free to protest, but I'm quite happy about the result.</p> XSH2 for PSGML Emacs modehttp://xsh.sourceforge.net/news_1.html#g-Sat-Sep-30-18_32_35-2006g-Sat-Sep-30-18_32_35-2006Sat, 30 Sep 2006 18:32:35 GMT <p>If you, like me, use Emacs <a href="http://sourceforge.net/projects/psgml/">PSGML</a> mode for editing XML documents and you are familiar with XSH2, you might find useful this tip: </p> <p> The following lisp code allows you to apply an arbitrary XSH2 one-liner to any element of an XML document. Just add the code to your <tt>~/.emacs</tt> file, open an XML file in Emacs (in <tt>psgml-mode</tt>), move the cursor inside some element, run <tt>M-x xsh-edit-element</tt> and type in a XSH2 command. </p> <pre> (defun xsh-edit-element (xsh-command) "Edit current XML element with XSH" (interactive "Mxsh2-command: ") (progn (sgml-backward-up-element) (let ((beg (point)) (coding-system-for-read 'utf-8) (coding-system-for-write 'utf-8)) (sgml-forward-element) (shell-command-on-region beg (point) (concat "xsh2 -qP- " (shell-quote-argument xsh-command) " | sed 1d") t )))) </pre> <p>I found it indispensable e.g. for refactoring.</p> XSH2 2.1.0 Releasedhttp://xsh.sourceforge.net/news_1.html#g-Wed-Jan-3-13_57_36-2007g-Wed-Jan-3-13_57_36-2007Wed, 3 Jan 2007 13:57:36 GMT <p> This release contains several feature enhancements and many bug fixes. </p> <p><b>Incompatible Changes:</b></p> <ul> <li> commands <a href="doc2/chunks/rename_command.html">rename</a> and <a href="doc2/chunks/map_command.html">map</a> have new syntax and semantics: <div class="smalltable"> <table> <tr> <th>OLD (XSH 2.0.2)</th><th> </th><th>NEW (XSH 2.1.0)</th> </tr> <tr> <td><tt>map { $_=uc } //text();</tt></td> <th> </th> <td><tt>map { uc } //text();</tt></td> </tr> <tr> <td><tt>map { s/foo/bar/ } //text();</tt></td> <th> </th> <td><tt>map :i { s/foo/bar/ } //text();</tt></td> </tr> <tr> <td><tt>map { $_='link' } //ref;</tt></td> <th> </th> <td><tt>rename link //ref;</tt></td> </tr> </table> </div> </li> </ul> <p><b>New Features:</b></p> <ul> <li>XSH scripts can be "compiled" (xsh -D) into Perl scripts which start faster (see <a href="doc2/xsh.html">xsh --help</a> for details) </li> <li>XML::XSH2::Compile module provides means for efficient embedding of XSH2 scripts into Perl modules (see the module's <a href="http://search.cpan.org/~pajas/XML-XSH2/lib/XML/XSH2/Compile.pm">manpage</a>)</li> <li>new command <a href="doc2/chunks/set_command.html">set</a> simplifies creating and modifying nodes</li> <li>new command <a href="doc2/chunks/hash_command.html">hash</a> simplifies hashing/grouping nodes by arbitrary keys</li> <li>new commands <a href="doc2/chunks/change_namespace_prefix_command.html">change-ns-prefix</a> and <a href="doc2/chunks/change_namespace_prefix_command.html">change-ns-uri</a> add full control over namespace declarations</li> <li>XPath functions <a href="doc2/chunks/match_function.html">xsh:match()</a> (regexp matching), <a href="doc2/chunks/filename_function.html">xsh:filename()</a> (introspection), <a href="doc2/chunks/lookup_function.html">xsh:lookup()</a> (hash retrieval), <a href="doc2/chunks/document_function.html">xsh:document()</a> (get open document by filename), and <a href="doc2/chunks/documents_function.html">xsh:documents()</a> (get all open documents)</li> <li>the interactive shell has a <a href="doc2/chunks/Prompt.html">customizable prompt</a></li> </ul> <p><b>Enhancements:</b></p> <ul><li>the mapping expression of <a href="doc2/chunks/rename_command.html">rename</a> and <a href="doc2/chunks/map_command.html">map</a> can be XPath</li> <li>added <a href="doc2/chunks/save_command.html">save</a> --encoding flag</li> <li>added <a href="doc2/chunks/print_command.html">print</a> --no-space (:n) flag</li> <li><a href="doc2/chunks/pwd_command.html">pwd</a> and <a href="doc2/chunks/locate_command.html">locate</a> can return paths starting from a nearest ancestor-or-self with an ID</li> <li>TAB-completion for default, xsh, and user-defined XPath functions</li> <li>improved <a href="doc2/chunks/Namespaces.html">namespace</a> handling</li> <li>filenames of documents parsed from a file are absolute</li> <li>many bugfixes</li> </ul>