Tricks from the Command Line: xsltproc and xmllint

By February 26, 2009 September 6th, 2019 One Comment

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 >""><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 >"">
    <title>Project Manager</title>

That’s much easier to read.

Have questions? You can contact my team directly for more insights. Or, check out our other FileMaker posts to learn more about customizing your solution.

Kristin Luna

Kristin Luna

Kristin is a marketing consultant specializing in copywriting. When she isn't contemplating brilliant marketing campaigns, she's either working on her latest novel, teaching her cats sign language, or rounding out her handmade Jadzia Dax figurine collection.

One Comment

Leave a Reply

Need to adjust your business processes quickly? We're helping clients use technology to keep their teams productive and running smoothly in these times of uncertainty. Our team can guide yours if you need help in these areas.

Talk to a Consultant