[x3d-public] XSLT tools

Don Brutzman brutzman at nps.edu
Sat Jun 10 16:38:11 PDT 2017


On 6/8/2017 8:37 AM, John Carlson wrote:
> Don, what tools are there for writing xslt, or do you just get in there and code?  Thanks!  We have oxygen XML
> 
> John

I typically just pound away with stone tools on the source... though Netbeans/X3D-Edit features certainly facilitate tag-matching and launching/testing/improving.  Validating the content you use as input to the stylesheet is important too - GIGO.

XMLSpy has sophisticated debugging support.  They have free-trial and commercial versions.  Most capable tool that I have found.

	https://www.altova.com

Search reveals a number of other tools, but none that I am familiar with.  YMMV.

XSLT is a curious programming language because it is XML based, and so ill-formed programs simply don't validate.  Further it is relatively verbose, but actually has an intentionally short set of constructs.  As a result there is usually only one way to do something - a refreshing change from some languages.  It is completely tuned to walking XML trees.  In my experience it is difficult to write an XSLT program with hidden flaws - the XSLT stylesheet might not do exactly what you want, but it certainly executes exactly what you program.  Usually easy to maintain/adapt once written.

The programming is declarative.  Templates match elements or attributes to handle flow of control.  Once you get the hang of it, all you need are if, choose/when/otherwise, or for-each blocks.  More sophisticated processing is rarely needed on XML inputs, but can be accomplished by template rules implementing tail recursion.  I find XSLT is easiest for processing X3D or other XML documents, more so than imperative program languages (Java etc.).

There are a number of good books but one is by far the most thorough and authoritative reference work, highly recommended once you are familiar with XSLT/XPath language constructs.  Author is long-time lead of W3C XSLT standards development, he also monitors StackOverflow posts.

Michael Kay, _XSLT 2.0 and XPath 2.0 Programmers Reference_, 4th edition 2008, 1376 pages (no really).

http://www.wrox.com/WileyCDA/WroxTitle/XSLT-2-0-and-XPath-2-0-Programmer-s-Reference-4th-Edition.productCd-0470192747.html

Available X3D-related stylesheets, writeups and products are mostly found at

	https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/
and
	https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/tooltips/

Many of those stylesheets include console-based diagnostic statements, i.e. <xsl:message> blocks.  Typically I either hide them within trace-variable tests or XML comments so that they are easily reusable/adaptable.  Trace statements have a lot of value (especially on big/huge inputs) and so retaining them adds value.  They may help you understand the structure of code there as weool

Have fun with X3D XSLT!  8)

all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman



More information about the x3d-public mailing list