Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turn off xml header output in Saxon

Tags:

xml

xpath

saxon

Using the .NET version of Saxon 9.4, I run a command line like:

Query.exe -s:myfile.xml -qs:/cruisecontrol/build/msbuild[@success='true']/project[1]/target[@name='GetLatestSource']/message[last()]/text()

and I get a result like

<?xml version="1.0" encoding="UTF-8"?>375

How can I turn off the XML header (omit the XML declaration) so that I just get 375 as output? I've checked the documentation, but perhaps I'm just missing it.

like image 330
Andrew Avatar asked Feb 16 '12 23:02

Andrew


1 Answers

Figured it out...

I needed to add the omit-xml-declaration option:

Query.exe -s:myfile.xml -qs:"declare option saxon:output 'omit-xml-declaration=yes'; /cruisecontrol/build/msbuild[@success='true']/project[1]/target[@name='GetLatestSource']/message[last()]/text()"

would be one way to accomplish this.

like image 172
Andrew Avatar answered Sep 18 '22 15:09

Andrew