• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 275
  • Last Modified:

how to get a simple text string as results of a XQuery with Saxon

With Saxon (& tagsoup parser) command-line I launch this xquery to extract a number out of an html page:

 declare default element namespace 'http://www.w3.org/1999/xhtml';

The result "correctly" show the answer:
 <?xml version="1.0" encoding="UTF-8"?>
 <span xmlns="http://www.w3.org/1999/xhtml"

However I just want that cleaned "2" as simple text string.
How can I modify the XQuery or the command line Saxon switches to just get the simple text string?
  • 2
2 Solutions
Geert BormansInformation ArchitectCommented:
set the output method serialisation

declare option saxon:output "method=text";
Geert BormansInformation ArchitectCommented:
it is also not a bad idea to make it explicit that you need the text nodes

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now