how to preserve newlines in a text result of an XQuery with Saxon with html input?

Posted on 2013-09-07
Medium Priority
Last Modified: 2013-09-24
As a result of an XQuery with Saxon (& Tagsoup) launched in command-line mode
with "declare option saxon:output 'method=text'"
I get a text result that omits newlines for example when the original html has paragraph changes.
I would these newlines.

Is there something like an XQuery "declare option" or a command-line switch to tell it to KEEP or try to imitate the html newlines?   (at least for the <p></p> and the </br>)
Question by:lucavilla
  • 2
LVL 60

Accepted Solution

Geert Bormans earned 2000 total points
ID: 39473644
It sounds as if you don't need a serialisation setting.

By setting the output method to "text" you essentialy remove the information from tags, only keeping the text nodes
just have an extra for-loop, over each <p> and and a newline on each node you touch
LVL 17

Expert Comment

ID: 39489411

What about :

 "declare option saxon:output 'method=html'"
LVL 60

Expert Comment

by:Geert Bormans
ID: 39489432
depends on what you need really, if html is what you need, go ahead
if it is just for the newlines, add them yourself
having html als an output method can give you other undesired effects
(such as character serialisation into named character entities)

Featured Post

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

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

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
Planning to migrate your EDB file(s) to a new or an existing Outlook PST file? This video will guide you how to convert EDB file(s) to PST. Besides this, it also describes, how one can easily search any item(s) from multiple folders or mailboxes…
From store locators to asset tracking and route optimization, learn how leading companies are using Google Maps APIs throughout the customer journey to increase checkout conversions, boost user engagement, and optimize order fulfillment. Powered …
Suggested Courses

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question