Often, when writing an XSLT file, you’ll want to test it quickly, without contacting a FileMaker Server or otherwise accessing the rest of the world.
On Linux and OS X, you can use the command-line utility, ‘xsltproc’, to run XSLT programs quickly:
xsltproc transform.xsl input.xml
This applies the stylesheet in the file transform.xml to the XML in input.xml, and
writes the output to your terminal. You can instead write the output to a file:
xsltproc transform.xsl input.xml > output.xml
Another useful command-line tool is ‘xmllint,’ which can be used to prettify an XML file. For example, of your XML file, data.xml, has the contents:
<?xml version="1.0" encoding="utf-8"?> <people xmlns:fm="http://www.filemaker.com/fmpxmlresult"><person><first>Thomas</first><last>Andrews</last><title>Developer</title></person><person><first>Mickey</first><last>Burns</last><title>Project Manager</title></person></people>
you can run the command:
xmllint -format data.xml
and get the output:
"1.0" encoding="utf-8"?> <people xmlns:fm="http://www.filemaker.com/fmpxmlresult"> <person> <first>Thomas</first> <last>Andrews</last> <title>Developer</title> </person> <person> <first>Mickey</first> <last>Burns</last> <title>Project Manager</title> </person> </people>
That’s much easier to read.
Related posts:
- Coding PHP Applications for the Command Line When writing a PHP application, avoid explicitly using the special...
- Generating XSL transforms for FileMaker Writing XSL which generates FileMaker XML is somewhat painful, because...
Related posts brought to you by Yet Another Related Posts Plugin.










|
Posted by admin on February 26, 2009 at 1:26 pm
