serialize() does just what I want: <pre> { let $map := dftest:testResolveTopicOrMapUri($repo, $branch) return serialize($map)
} </pre> Cheers, E. ————— Eliot Kimber, Owner Contrext, LLC http://contrext.com On 4/17/15, 12:43 PM, "Christian Grün" <christian.gr...@gmail.com> wrote: >> declare function dftest:xmlToHtmlCode($nodes as node()*) as node()* { >> <pre>{ >> for $node in $nodes >> return dftest:nodeToHtml($node) >> }</pre> >> }; > >You could serialize the nodes... > > let $input := <x/> > return <pre>{ serialize($input) }</pre> > >...or directly retrieve them from a file: > > let $input := fn:unparsed-text(...) > return <pre>{ $input }</pre> > > > > > >let $text := '<x/>' >return <pre>{ $text }</pre> > >I see.. This won't work, because the children of the pre node > >> >> >> >> That is, I just want to format the XML markup within a <pre> element. >> >> The result could be arbitrary XML elements, not necessarily a complete >> document. >> >> Cheers, >> >> E. >> >> ————— >> Eliot Kimber, Owner >> Contrext, LLC >> http://contrext.com >> >> >> >> >> On 4/17/15, 12:13 PM, "Christian Grün" <christian.gr...@gmail.com> >>wrote: >> >>>> I'm use the RESTXQ stuff (very nice) to build a little DITA link >>>> management application. In the service of this I need to sometimes >>>>show >>>> the raw XML source of the docs in the repo. >>> >>>Did you e.g. try to embed the results of file:read-text() or >>>fn:unparsed-text() ? >>> >>>But I may have got wrong what you are trying to do. I am not sure what >>>part of the DBA you are talking about.. Do you refer to the result >>>view of the query panel? Maybe you need to specify different >>>serialization parameters (i.e., a different output method) as >>>described in our Wiki. >>> >>> >>> >>>On Fri, Apr 17, 2015 at 6:36 PM, Eliot Kimber <ekim...@contrext.com> >>>wrote: >>>> >>>> I looked at the DBA Web app and it looks like it's using some >>>>Javascript >>>> for this and I didn't see any obvious solution in the various BaseX >>>> packages, but I could have missed something. >>>> >>>> I hacked a quick little typeswitch transform just to get something but >>>>it >>>> doesn't preserve newlines from the source XML (but I notice the DBA >>>>Web >>>> app does, so they must be preserved under the covers). >>>> >>>> Is there a built-in way to generate escaped XML for use in e.g., HTML >>>> <pre> or is there some silly thing I need to do in my typeswitch to >>>>make >>>> sure the newlines make it to the HTML result? >>>> >>>> Thanks, >>>> >>>> Eliot >>>> >>>> ————— >>>> Eliot Kimber, Owner >>>> Contrext, LLC >>>> http://contrext.com >>>> >>>> >>>> >>> >> >> >