how to specify xml-stylesheet when generating xml ?

Friday, 15 July 2011 · 3 messages
FE
Fabrice Etanchaud15 Jul 2011 11:18 #
Dear all at BaseX, how can one specify xml-stylesheet (for example in XQuery 3 prolog) ? I would like to add something like <?xml-stylesheet type="text/xsl" href="linktomystylesheet.xsl"?> between the xml declaration and the generated xml. I did not find any xml-stylesheet option for serialization. BaseX is just wonderful. best regards, Fabrice ETANCHAUD Senior Software Engineer edital Berkenlaan 1 B-1831 Brussels, Belgium
   <skype:fabrice.etanchaud?call>
+32 2 716 32 32 general +32 2 716 32 20 fax fetanchaud at edital.com corsearch.com <http://www.corsearch.com/> | edital.com <http://www.edital.com/> Confidentiality Notice: This email and its attachments (if any) contain confidential information of the sender. The information is intended only for the use by the direct addressees of the original sender of this email. If you are not an intended recipient of the original sender (or responsible for delivering the message to such person), you are hereby notified that any review, disclosure, copying, distribution or the taking of any action in reliance of the contents of and attachments to this email is strictly prohibited. If you have received this email in error, please immediately notify the sender at the address shown herein and permanently delete any copies of this email (digital or paper) in your possession.
LW
Leo Wörteler15 Jul 2011 12:32 #
Dear Fabrice,
Quoted text · Fabrice Etanchaud · 5 lines
Am 15.07.2011 11:18, schrieb Fabrice Etanchaud: > I would like to add something like <?xml-stylesheet type="text/xsl" > href="linktomystylesheet.xsl"?>between the xml declaration and the > generated xml. > I did not find any xml-stylesheet option for serialization.
as BaseX doesn't have to understand what xml-stylesheet does, it treats it like any other processing instruction [1]. To add one to your output document, just insert it as the first node:
Quoted text · Fabrice Etanchaud · 8 lines
> declare option output:omit-xml-declaration "no"; > > let $generated-xml := <foo><bar/></foo> > return document { > <?xml-stylesheet type="text/xsl" href="linktomystylesheet.xsl"?>, > text { '&#xa;' }, > $generated-xml > }
This produces:
Quoted text · Fabrice Etanchaud · 5 lines
> <?xml version="1.0" encoding="UTF-8"?> > <?xml-stylesheet type="text/xsl" href="linktomystylesheet.xsl"?> > <foo> > <bar/> > </foo>
Note that &#xa; is the entity for the ASCII newline character, I inserted it only for readability.
Quoted text · Fabrice Etanchaud · 1 line
> BaseX is just wonderful.
E
Eric15 Jul 2011 16:01 #
Quoted text · Leo Wörteler · 44 lines
Leo Wörteler <lw at basex.org> wrote: >Dear Fabrice, > >Am 15.07.2011 11:18, schrieb Fabrice Etanchaud: >> I would like to add something like <?xml-stylesheet type="text/xsl" >> href="linktomystylesheet.xsl"?>between the xml declaration and the >> generated xml. >> I did not find any xml-stylesheet option for serialization. > >as BaseX doesn't have to understand what xml-stylesheet does, it treats >it like any other processing instruction [1]. To add one to your output >document, just insert it as the first node: > > > declare option output:omit-xml-declaration "no"; > > > > let $generated-xml := <foo><bar/></foo> > > return document { > > <?xml-stylesheet type="text/xsl" href="linktomystylesheet.xsl"?>, > > text { '&#xa;' }, > > $generated-xml > > } > >This produces: > > > <?xml version="1.0" encoding="UTF-8"?> > > <?xml-stylesheet type="text/xsl" href="linktomystylesheet.xsl"?> > > <foo> > > <bar/> > > </foo> > >Note that &#xa; is the entity for the ASCII newline character, I >inserted it only for readability. > >> BaseX is just wonderful. > >Thank you! > >Leo >__________ >[1] http://en.wikipedia.org/wiki/Processing_instruction >_______________________________________________ >BaseX-Talk mailing list >BaseX-Talk at mailman.uni-konstanz.de >https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk

⚡Generated with XQuery