Reputation: 299
After exceuting a xquery expression, the output is all 'together'. How do I add a newline or space inbetween elements of an xquery.
Is it through this:
<?xml version="1.0" standalone="no"?>
If so, where do I put it within the xquery expression?
So I get:
<a><b>asdasdasd</b></a>
I want:
<a>
<b>asdasdasd<b>
<a>
Upvotes: 2
Views: 1427
Reputation: 20414
The output or serialization specifications described by W3C ( http://www.w3.org/TR/xslt-xquery-serialization/ ) apply to both XSLT and XQuery. The difference is that it is well known how to use that in XSLT (the xsl:output
instruction), whereas it hasn't been incorporated like that in the XQuery 1.0 specification. Most implementations provided custom extension to support it though. You would be looking for an indent="yes"
property.
If you could share with us which XQuery implementation you are using, we could provided more details on how to enforce indentation.
Upvotes: 1
Reputation: 20330
That layout is usually done on windows with a built in XSLT provided with MSXML.
so you can apply it to the result of your XQuery (if teh resukt is valid xml !) Rember the output is HTML.
Last I looked the xsl was in one of the msxml dlls as a resource and called DefaultSS.xsl
If this is just for display, another way is to save the output to a temporary file.
Add a webbrowser control and then navigate to the file.
If you don't like the idea of the file, then HTMLDocument is possibility, it's not pretty though.
Upvotes: 0