xslt:transform, spaces and mixed content

Monday, 23 July 2012 · 10 messages · last reply 14 Aug 2012
CG
Christian Grünin reply to France Baril, 23 Jul 2012, 20:1423 Jul 2012 18:47 #
Hi France,
Quoted text · France Baril · 5 lines
> I have an issue with spaces in mixed content, when applying the > xslt:transform command. I have been working around it for months with a hack > in my css that puts the spaces back as   on inline elements, yet I > still haven't run upon a clue to help me resolve this for good the clean > way.
It might help to set the "chop" keyword in he prolog (head) of your query module to "no":
  declare option db:chop "no";
Hope this helps; if not, just ask again, Christian
Quoted text · France Baril · 74 lines
> The xslt applied to my xml outside the BaseX environment (Oxygen + Saxon) > gets me right html content (with spaces for inline elements in mixed > content) > The query, when it returns the XML file from BaseX, shows that the XML file > still has its spaces. > When the xslt is applied to the XML file from BaseX (Using Saxon), with the > BaseX XSLT module, spaces disappear around inline elements in mixed content. > > IN DETAILS > > I have mixed content in a file. Ex. <p>Text <i>italic</i> more text.</p>. > > I have this function:; > > declare %rest:path("/how2-html-topic/{$id}/{$menu-id}") > > %rest:GET > > function topic:html-get-how2-topic($id as xs:string, $menu-id as > xs:string) as node()*{ > > let $x := topic:xml-get-how2-topic($id) > > let $params := map{ "menucontext" := $menu-id} > > let $stylesheet := doc(concat($app:xslt_html_topic, 't')) > > return xslt:transform($x, $stylesheet, $params) > > }; > > > My access a web page runs this query. Result (lost spaces): > <p>Text<i>italic</i>more text.</p> > > Note: The content has been uploaded with chop spaces = false > The xquery module specifies: declare boundary-space preserve; declare > option db:chop 'no' > > If I get the same content without applying the xslt:transform, I get the xml > with all the right spaces: > > declare %rest:path("/how2-html-topic/{$id}/{$menu-id}") > %rest:GET > function topic:html-get-how2-topic($id as xs:string, $menu-id as > xs:string) as node()*{ > let $x := topic:xml-get-how2-topic($id) > let $params := map{ "menucontext" := $menu-id} > let $stylesheet := doc(concat($app:xslt_html_topic, 't')) > (: return xslt:transform($x, $stylesheet, $params) :) > return $x > }; > > > Maybe I am missing some config details for the xslt module, in BaseX? In > XLST? My xslt sets the output as follow: > > <xsl:output indent="yes" method="xml" encoding="UTF-8"/> > > > Regards, > > France > -- > France Baril > Architecte documentaire / Documentation architect > france.baril at architextus.com > (514) 572-0341 > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
FB
France Baril23 Jul 2012 20:14 #
Hi, I have an issue with spaces in mixed content, when applying the xslt:transform command. I have been working around it for months with a hack in my css that puts the spaces back as &#160; on inline elements, yet I still haven't run upon a clue to help me resolve this for good the clean way. IN SUMMARY - The xslt applied to my xml outside the BaseX environment (Oxygen + Saxon) gets me right html content (with spaces for inline elements in mixed content) - The query, when it returns the XML file from BaseX, shows that the XML file still has its spaces. - When the xslt is applied to the XML file from BaseX (Using Saxon), with the BaseX XSLT module, spaces disappear around inline elements in mixed content. IN DETAILS I have mixed content in a file. Ex. <p>Text <i>italic</i> more text.</p>. I have this function:;
declare %rest:path("/how2-html-topic/{$id}/{$menu-id}")
%rest:GET
   function topic:html-get-how2-topic($id as xs:string, $menu-id as
xs:string) as node()*{

    let $x := topic:xml-get-how2-topic($id)

    let $params := map{ "menucontext" := $menu-id}

    let $stylesheet := doc(concat($app:xslt_html_topic, 't'))
return xslt:transform($x, $stylesheet, $params) }; My access a web page runs this query. Result (lost spaces): <p>Text<i>italic</i>more text.</p> - Note: The content has been uploaded with chop spaces = false - The xquery module specifies: declare boundary-space preserve; declare option db:chop 'no' If I get the same content without applying the xslt:transform, I get the xml with all the right spaces:
declare %rest:path("/how2-html-topic/{$id}/{$menu-id}")
   %rest:GET
   function topic:html-get-how2-topic($id as xs:string, $menu-id as
xs:string) as node()*{
    let $x := topic:xml-get-how2-topic($id)
    let $params := map{ "menucontext" := $menu-id}
    let $stylesheet := doc(concat($app:xslt_html_topic, 't'))
    (: return xslt:transform($x, $stylesheet, $params) :)
    return $x
};
Maybe I am missing some config details for the xslt module, in BaseX? In XLST? My xslt sets the output as follow:
<xsl:output indent="yes" method="xml" encoding="UTF-8"/>
Regards, France
-- France Baril Architecte documentaire / Documentation architect france.baril at architextus.com (514) 572-0341
FB
France Barilin reply to Christian Grün, 23 Jul 2012, 18:4724 Jul 2012 20:31 #
I already have that, along with the boundary-space option.
declare boundary-space preserve;
declare option db:chop 'no';
On Mon, Jul 23, 2012 at 12:47 PM, Christian Grün <christian.gruen at gmail.com>wrote:
Quoted text · Christian Grün · 97 lines
> Hi France, > > > I have an issue with spaces in mixed content, when applying the > > xslt:transform command. I have been working around it for months with a > hack > > in my css that puts the spaces back as &#160; on inline elements, yet I > > still haven't run upon a clue to help me resolve this for good the clean > > way. > > It might help to set the "chop" keyword in he prolog (head) of your > query module to "no": > > declare option db:chop "no"; > > Hope this helps; if not, just ask again, > Christian > > > > The xslt applied to my xml outside the BaseX environment (Oxygen + Saxon) > > gets me right html content (with spaces for inline elements in mixed > > content) > > The query, when it returns the XML file from BaseX, shows that the XML > file > > still has its spaces. > > When the xslt is applied to the XML file from BaseX (Using Saxon), with > the > > BaseX XSLT module, spaces disappear around inline elements in mixed > content. > > > > IN DETAILS > > > > I have mixed content in a file. Ex. <p>Text <i>italic</i> more text.</p>. > > > > I have this function:; > > > > declare %rest:path("/how2-html-topic/{$id}/{$menu-id}") > > > > %rest:GET > > > > function topic:html-get-how2-topic($id as xs:string, $menu-id as > > xs:string) as node()*{ > > > > let $x := topic:xml-get-how2-topic($id) > > > > let $params := map{ "menucontext" := $menu-id} > > > > let $stylesheet := doc(concat($app:xslt_html_topic, 't')) > > > > return xslt:transform($x, $stylesheet, $params) > > > > }; > > > > > > My access a web page runs this query. Result (lost spaces): > > <p>Text<i>italic</i>more text.</p> > > > > Note: The content has been uploaded with chop spaces = false > > The xquery module specifies: declare boundary-space preserve; declare > > option db:chop 'no' > > > > If I get the same content without applying the xslt:transform, I get the > xml > > with all the right spaces: > > > > declare %rest:path("/how2-html-topic/{$id}/{$menu-id}") > > %rest:GET > > function topic:html-get-how2-topic($id as xs:string, $menu-id as > > xs:string) as node()*{ > > let $x := topic:xml-get-how2-topic($id) > > let $params := map{ "menucontext" := $menu-id} > > let $stylesheet := doc(concat($app:xslt_html_topic, 't')) > > (: return xslt:transform($x, $stylesheet, $params) :) > > return $x > > }; > > > > > > Maybe I am missing some config details for the xslt module, in BaseX? In > > XLST? My xslt sets the output as follow: > > > > <xsl:output indent="yes" method="xml" encoding="UTF-8"/> > > > > > > Regards, > > > > France > > -- > > France Baril > > Architecte documentaire / Documentation architect > > france.baril at architextus.com > > (514) 572-0341 > > > > _______________________________________________ > > BaseX-Talk mailing list > > BaseX-Talk at mailman.uni-konstanz.de > > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > > >
-- France Baril Architecte documentaire / Documentation architect france.baril at architextus.com (514) 572-0341
AB
Andy Bunce26 Jul 2012 11:52 #
Quoted text · France Baril · 3 lines
>I already have that, along with the boundary-space option. >declare boundary-space preserve; >declare option db:chop 'no';
I have the same problem with RESTXQ I guess this is relevant https://github.com/BaseXdb/basex/issues/548 But I believe this problem has not always been there with RESTXQ. Using the API (via Node) without these declares I do not get the problem. Surely special declarations should not be required to, for example, get<spaces/>here for html o/p? /Andy
CG
Christian Grünin reply to France Baril, 24 Jul 2012, 20:3126 Jul 2012 11:55 #
Hi France, hi Andy, thanks for sending me a test case. The issue, documented in [1], has been fixed: all database options specified in a query module will now be set before the query is evaluated. Feel free to check out the latest 7.4 snapshot [2]. Hope this helps, Christian [1] https://github.com/BaseXdb/basex/issues/548 [2] http://files.basex.org/releases/latest/
Quoted text · France Baril · 119 lines
On Tue, Jul 24, 2012 at 6:31 PM, France Baril <france.baril at architextus.com> wrote: > I already have that, along with the boundary-space option. > > > declare boundary-space preserve; > declare option db:chop 'no'; > > > On Mon, Jul 23, 2012 at 12:47 PM, Christian Grün <christian.gruen at gmail.com> > wrote: >> >> Hi France, >> >> > I have an issue with spaces in mixed content, when applying the >> > xslt:transform command. I have been working around it for months with a >> > hack >> > in my css that puts the spaces back as &#160; on inline elements, yet I >> > still haven't run upon a clue to help me resolve this for good the clean >> > way. >> >> It might help to set the "chop" keyword in he prolog (head) of your >> query module to "no": >> >> declare option db:chop "no"; >> >> Hope this helps; if not, just ask again, >> Christian >> >> >> > The xslt applied to my xml outside the BaseX environment (Oxygen + >> > Saxon) >> > gets me right html content (with spaces for inline elements in mixed >> > content) >> > The query, when it returns the XML file from BaseX, shows that the XML >> > file >> > still has its spaces. >> > When the xslt is applied to the XML file from BaseX (Using Saxon), with >> > the >> > BaseX XSLT module, spaces disappear around inline elements in mixed >> > content. >> > >> > IN DETAILS >> > >> > I have mixed content in a file. Ex. <p>Text <i>italic</i> more >> > text.</p>. >> > >> > I have this function:; >> > >> > declare %rest:path("/how2-html-topic/{$id}/{$menu-id}") >> > >> > %rest:GET >> > >> > function topic:html-get-how2-topic($id as xs:string, $menu-id as >> > xs:string) as node()*{ >> > >> > let $x := topic:xml-get-how2-topic($id) >> > >> > let $params := map{ "menucontext" := $menu-id} >> > >> > let $stylesheet := doc(concat($app:xslt_html_topic, 't')) >> > >> > return xslt:transform($x, $stylesheet, $params) >> > >> > }; >> > >> > >> > My access a web page runs this query. Result (lost spaces): >> > <p>Text<i>italic</i>more text.</p> >> > >> > Note: The content has been uploaded with chop spaces = false >> > The xquery module specifies: declare boundary-space preserve; declare >> > option db:chop 'no' >> > >> > If I get the same content without applying the xslt:transform, I get the >> > xml >> > with all the right spaces: >> > >> > declare %rest:path("/how2-html-topic/{$id}/{$menu-id}") >> > %rest:GET >> > function topic:html-get-how2-topic($id as xs:string, $menu-id as >> > xs:string) as node()*{ >> > let $x := topic:xml-get-how2-topic($id) >> > let $params := map{ "menucontext" := $menu-id} >> > let $stylesheet := doc(concat($app:xslt_html_topic, 't')) >> > (: return xslt:transform($x, $stylesheet, $params) :) >> > return $x >> > }; >> > >> > >> > Maybe I am missing some config details for the xslt module, in BaseX? In >> > XLST? My xslt sets the output as follow: >> > >> > <xsl:output indent="yes" method="xml" encoding="UTF-8"/> >> > >> > >> > Regards, >> > >> > France >> > -- >> > France Baril >> > Architecte documentaire / Documentation architect >> > france.baril at architextus.com >> > (514) 572-0341 >> > >> > _______________________________________________ >> > BaseX-Talk mailing list >> > BaseX-Talk at mailman.uni-konstanz.de >> > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >> > > > > > > -- > France Baril > Architecte documentaire / Documentation architect > france.baril at architextus.com > (514) 572-0341
CG
Christian Grün27 Jul 2012 00:56 #
…yet another update: with the latest snapshot [1], database options can also be set for a particular operation:
(# db:chop false #) {
  parse-xml('<xml> hi </xml>')
}
At least for now, this won't work out for updating expressions, which will only be evaluated at the very end of a query. The new feature is documented at [2]. Hope this helps, Christian [1] http://files.basex.org/releases/latest/ [2] http://docs.basex.org/wiki/Options
Quoted text · Christian Grün · 119 lines
> On Tue, Jul 24, 2012 at 6:31 PM, France Baril > <france.baril at architextus.com> wrote: >> I already have that, along with the boundary-space option. >> >> >> declare boundary-space preserve; >> declare option db:chop 'no'; >> >> >> On Mon, Jul 23, 2012 at 12:47 PM, Christian Grün <christian.gruen at gmail.com> >> wrote: >>> >>> Hi France, >>> >>> > I have an issue with spaces in mixed content, when applying the >>> > xslt:transform command. I have been working around it for months with a >>> > hack >>> > in my css that puts the spaces back as &#160; on inline elements, yet I >>> > still haven't run upon a clue to help me resolve this for good the clean >>> > way. >>> >>> It might help to set the "chop" keyword in he prolog (head) of your >>> query module to "no": >>> >>> declare option db:chop "no"; >>> >>> Hope this helps; if not, just ask again, >>> Christian >>> >>> >>> > The xslt applied to my xml outside the BaseX environment (Oxygen + >>> > Saxon) >>> > gets me right html content (with spaces for inline elements in mixed >>> > content) >>> > The query, when it returns the XML file from BaseX, shows that the XML >>> > file >>> > still has its spaces. >>> > When the xslt is applied to the XML file from BaseX (Using Saxon), with >>> > the >>> > BaseX XSLT module, spaces disappear around inline elements in mixed >>> > content. >>> > >>> > IN DETAILS >>> > >>> > I have mixed content in a file. Ex. <p>Text <i>italic</i> more >>> > text.</p>. >>> > >>> > I have this function:; >>> > >>> > declare %rest:path("/how2-html-topic/{$id}/{$menu-id}") >>> > >>> > %rest:GET >>> > >>> > function topic:html-get-how2-topic($id as xs:string, $menu-id as >>> > xs:string) as node()*{ >>> > >>> > let $x := topic:xml-get-how2-topic($id) >>> > >>> > let $params := map{ "menucontext" := $menu-id} >>> > >>> > let $stylesheet := doc(concat($app:xslt_html_topic, 't')) >>> > >>> > return xslt:transform($x, $stylesheet, $params) >>> > >>> > }; >>> > >>> > >>> > My access a web page runs this query. Result (lost spaces): >>> > <p>Text<i>italic</i>more text.</p> >>> > >>> > Note: The content has been uploaded with chop spaces = false >>> > The xquery module specifies: declare boundary-space preserve; declare >>> > option db:chop 'no' >>> > >>> > If I get the same content without applying the xslt:transform, I get the >>> > xml >>> > with all the right spaces: >>> > >>> > declare %rest:path("/how2-html-topic/{$id}/{$menu-id}") >>> > %rest:GET >>> > function topic:html-get-how2-topic($id as xs:string, $menu-id as >>> > xs:string) as node()*{ >>> > let $x := topic:xml-get-how2-topic($id) >>> > let $params := map{ "menucontext" := $menu-id} >>> > let $stylesheet := doc(concat($app:xslt_html_topic, 't')) >>> > (: return xslt:transform($x, $stylesheet, $params) :) >>> > return $x >>> > }; >>> > >>> > >>> > Maybe I am missing some config details for the xslt module, in BaseX? In >>> > XLST? My xslt sets the output as follow: >>> > >>> > <xsl:output indent="yes" method="xml" encoding="UTF-8"/> >>> > >>> > >>> > Regards, >>> > >>> > France >>> > -- >>> > France Baril >>> > Architecte documentaire / Documentation architect >>> > france.baril at architextus.com >>> > (514) 572-0341 >>> > >>> > _______________________________________________ >>> > BaseX-Talk mailing list >>> > BaseX-Talk at mailman.uni-konstanz.de >>> > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >>> > >> >> >> >> >> -- >> France Baril >> Architecte documentaire / Documentation architect >> france.baril at architextus.com >> (514) 572-0341
FB
France Baril31 Jul 2012 00:03 #
Thank you, As we are moving fast toward a release, I won't be able to upgrade just now. Will try within the next few weeks. Regards, France On Thu, Jul 26, 2012 at 6:56 PM, Christian Grün <christian.gruen at gmail.com>wrote:
Quoted text · Christian Grün · 147 lines
> …yet another update: with the latest snapshot [1], database options > can also be set for a particular operation: > > (# db:chop false #) { > parse-xml('<xml> hi </xml>') > } > > At least for now, this won't work out for updating expressions, which > will only be evaluated at the very end of a query. The new feature is > documented at [2]. > > Hope this helps, > Christian > > [1] http://files.basex.org/releases/latest/ > [2] http://docs.basex.org/wiki/Options > ___________________________ > > > On Tue, Jul 24, 2012 at 6:31 PM, France Baril > > <france.baril at architextus.com> wrote: > >> I already have that, along with the boundary-space option. > >> > >> > >> declare boundary-space preserve; > >> declare option db:chop 'no'; > >> > >> > >> On Mon, Jul 23, 2012 at 12:47 PM, Christian Grün < > christian.gruen at gmail.com> > >> wrote: > >>> > >>> Hi France, > >>> > >>> > I have an issue with spaces in mixed content, when applying the > >>> > xslt:transform command. I have been working around it for months > with a > >>> > hack > >>> > in my css that puts the spaces back as &#160; on inline elements, > yet I > >>> > still haven't run upon a clue to help me resolve this for good the > clean > >>> > way. > >>> > >>> It might help to set the "chop" keyword in he prolog (head) of your > >>> query module to "no": > >>> > >>> declare option db:chop "no"; > >>> > >>> Hope this helps; if not, just ask again, > >>> Christian > >>> > >>> > >>> > The xslt applied to my xml outside the BaseX environment (Oxygen + > >>> > Saxon) > >>> > gets me right html content (with spaces for inline elements in mixed > >>> > content) > >>> > The query, when it returns the XML file from BaseX, shows that the > XML > >>> > file > >>> > still has its spaces. > >>> > When the xslt is applied to the XML file from BaseX (Using Saxon), > with > >>> > the > >>> > BaseX XSLT module, spaces disappear around inline elements in mixed > >>> > content. > >>> > > >>> > IN DETAILS > >>> > > >>> > I have mixed content in a file. Ex. <p>Text <i>italic</i> more > >>> > text.</p>. > >>> > > >>> > I have this function:; > >>> > > >>> > declare %rest:path("/how2-html-topic/{$id}/{$menu-id}") > >>> > > >>> > %rest:GET > >>> > > >>> > function topic:html-get-how2-topic($id as xs:string, $menu-id as > >>> > xs:string) as node()*{ > >>> > > >>> > let $x := topic:xml-get-how2-topic($id) > >>> > > >>> > let $params := map{ "menucontext" := $menu-id} > >>> > > >>> > let $stylesheet := doc(concat($app:xslt_html_topic, 't')) > >>> > > >>> > return xslt:transform($x, $stylesheet, $params) > >>> > > >>> > }; > >>> > > >>> > > >>> > My access a web page runs this query. Result (lost spaces): > >>> > <p>Text<i>italic</i>more text.</p> > >>> > > >>> > Note: The content has been uploaded with chop spaces = false > >>> > The xquery module specifies: declare boundary-space preserve; > declare > >>> > option db:chop 'no' > >>> > > >>> > If I get the same content without applying the xslt:transform, I get > the > >>> > xml > >>> > with all the right spaces: > >>> > > >>> > declare %rest:path("/how2-html-topic/{$id}/{$menu-id}") > >>> > %rest:GET > >>> > function topic:html-get-how2-topic($id as xs:string, $menu-id as > >>> > xs:string) as node()*{ > >>> > let $x := topic:xml-get-how2-topic($id) > >>> > let $params := map{ "menucontext" := $menu-id} > >>> > let $stylesheet := doc(concat($app:xslt_html_topic, 't')) > >>> > (: return xslt:transform($x, $stylesheet, $params) :) > >>> > return $x > >>> > }; > >>> > > >>> > > >>> > Maybe I am missing some config details for the xslt module, in > BaseX? In > >>> > XLST? My xslt sets the output as follow: > >>> > > >>> > <xsl:output indent="yes" method="xml" encoding="UTF-8"/> > >>> > > >>> > > >>> > Regards, > >>> > > >>> > France > >>> > -- > >>> > France Baril > >>> > Architecte documentaire / Documentation architect > >>> > france.baril at architextus.com > >>> > (514) 572-0341 > >>> > > >>> > _______________________________________________ > >>> > BaseX-Talk mailing list > >>> > BaseX-Talk at mailman.uni-konstanz.de > >>> > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > >>> > > >> > >> > >> > >> > >> -- > >> France Baril > >> Architecte documentaire / Documentation architect > >> france.baril at architextus.com > >> (514) 572-0341 >
-- France Baril Architecte documentaire / Documentation architect france.baril at architextus.com (514) 572-0341
FB
France Baril3 Aug 2012 00:39 #
Updated to 7.4, it all works! Thank you! On Mon, Jul 30, 2012 at 4:02 PM, France Baril <france.baril at architextus.com>wrote:
Quoted text · France Baril · 169 lines
> Thank you, > > As we are moving fast toward a release, I won't be able to upgrade just > now. Will try within the next few weeks. > > Regards, > > France > > > On Thu, Jul 26, 2012 at 6:56 PM, Christian Grün <christian.gruen at gmail.com > > wrote: > >> …yet another update: with the latest snapshot [1], database options >> can also be set for a particular operation: >> >> (# db:chop false #) { >> parse-xml('<xml> hi </xml>') >> } >> >> At least for now, this won't work out for updating expressions, which >> will only be evaluated at the very end of a query. The new feature is >> documented at [2]. >> >> Hope this helps, >> Christian >> >> [1] http://files.basex.org/releases/latest/ >> [2] http://docs.basex.org/wiki/Options >> ___________________________ >> >> > On Tue, Jul 24, 2012 at 6:31 PM, France Baril >> > <france.baril at architextus.com> wrote: >> >> I already have that, along with the boundary-space option. >> >> >> >> >> >> declare boundary-space preserve; >> >> declare option db:chop 'no'; >> >> >> >> >> >> On Mon, Jul 23, 2012 at 12:47 PM, Christian Grün < >> christian.gruen at gmail.com> >> >> wrote: >> >>> >> >>> Hi France, >> >>> >> >>> > I have an issue with spaces in mixed content, when applying the >> >>> > xslt:transform command. I have been working around it for months >> with a >> >>> > hack >> >>> > in my css that puts the spaces back as &#160; on inline elements, >> yet I >> >>> > still haven't run upon a clue to help me resolve this for good the >> clean >> >>> > way. >> >>> >> >>> It might help to set the "chop" keyword in he prolog (head) of your >> >>> query module to "no": >> >>> >> >>> declare option db:chop "no"; >> >>> >> >>> Hope this helps; if not, just ask again, >> >>> Christian >> >>> >> >>> >> >>> > The xslt applied to my xml outside the BaseX environment (Oxygen + >> >>> > Saxon) >> >>> > gets me right html content (with spaces for inline elements in mixed >> >>> > content) >> >>> > The query, when it returns the XML file from BaseX, shows that the >> XML >> >>> > file >> >>> > still has its spaces. >> >>> > When the xslt is applied to the XML file from BaseX (Using Saxon), >> with >> >>> > the >> >>> > BaseX XSLT module, spaces disappear around inline elements in mixed >> >>> > content. >> >>> > >> >>> > IN DETAILS >> >>> > >> >>> > I have mixed content in a file. Ex. <p>Text <i>italic</i> more >> >>> > text.</p>. >> >>> > >> >>> > I have this function:; >> >>> > >> >>> > declare %rest:path("/how2-html-topic/{$id}/{$menu-id}") >> >>> > >> >>> > %rest:GET >> >>> > >> >>> > function topic:html-get-how2-topic($id as xs:string, $menu-id as >> >>> > xs:string) as node()*{ >> >>> > >> >>> > let $x := topic:xml-get-how2-topic($id) >> >>> > >> >>> > let $params := map{ "menucontext" := $menu-id} >> >>> > >> >>> > let $stylesheet := doc(concat($app:xslt_html_topic, 't')) >> >>> > >> >>> > return xslt:transform($x, $stylesheet, $params) >> >>> > >> >>> > }; >> >>> > >> >>> > >> >>> > My access a web page runs this query. Result (lost spaces): >> >>> > <p>Text<i>italic</i>more text.</p> >> >>> > >> >>> > Note: The content has been uploaded with chop spaces = false >> >>> > The xquery module specifies: declare boundary-space preserve; >> declare >> >>> > option db:chop 'no' >> >>> > >> >>> > If I get the same content without applying the xslt:transform, I >> get the >> >>> > xml >> >>> > with all the right spaces: >> >>> > >> >>> > declare %rest:path("/how2-html-topic/{$id}/{$menu-id}") >> >>> > %rest:GET >> >>> > function topic:html-get-how2-topic($id as xs:string, $menu-id as >> >>> > xs:string) as node()*{ >> >>> > let $x := topic:xml-get-how2-topic($id) >> >>> > let $params := map{ "menucontext" := $menu-id} >> >>> > let $stylesheet := doc(concat($app:xslt_html_topic, 't')) >> >>> > (: return xslt:transform($x, $stylesheet, $params) :) >> >>> > return $x >> >>> > }; >> >>> > >> >>> > >> >>> > Maybe I am missing some config details for the xslt module, in >> BaseX? In >> >>> > XLST? My xslt sets the output as follow: >> >>> > >> >>> > <xsl:output indent="yes" method="xml" encoding="UTF-8"/> >> >>> > >> >>> > >> >>> > Regards, >> >>> > >> >>> > France >> >>> > -- >> >>> > France Baril >> >>> > Architecte documentaire / Documentation architect >> >>> > france.baril at architextus.com >> >>> > (514) 572-0341 >> >>> > >> >>> > _______________________________________________ >> >>> > BaseX-Talk mailing list >> >>> > BaseX-Talk at mailman.uni-konstanz.de >> >>> > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >> >>> > >> >> >> >> >> >> >> >> >> >> -- >> >> France Baril >> >> Architecte documentaire / Documentation architect >> >> france.baril at architextus.com >> >> (514) 572-0341 >> > > > > -- > France Baril > Architecte documentaire / Documentation architect > france.baril at architextus.com > (514) 572-0341 >
-- France Baril Architecte documentaire / Documentation architect france.baril at architextus.com (514) 572-0341
FB
France Barilin reply to France Baril, 23 Jul 2012, 20:1414 Aug 2012 00:07 #
Hi, I have made the upgrade to 7.4 and it has resolved the issue. However, it has now poped up in a different context. Context: - User is working with Oxygen and is connected to BaseX through WebDAV. - DB is set with Whitespace chopping: false. Steps: 1. User opens a file with content <p>This is <i>mixed</i> content.</p>. 2. User makes a change. Ex. Adds <p>A new paragraph</p> and saves the changes. 3. Users closes and re-opens the file. New p is there, but spaces around <i>mixed</i> have dispappeared. Since whitespace chopping is false, shouldn't documents saved through webDAV be saved following the default DB settings? If not, what are our options here? Regards, France Baril
Quoted text · France Baril · 82 lines
On Mon, Jul 23, 2012 at 12:14 PM, France Baril <france.baril at architextus.com > wrote: > Hi, > > I have an issue with spaces in mixed content, when applying the > xslt:transform command. I have been working around it for months with a > hack in my css that puts the spaces back as &#160; on inline elements, yet > I still haven't run upon a clue to help me resolve this for good the clean > way. > > IN SUMMARY > > - The xslt applied to my xml outside the BaseX environment (Oxygen + > Saxon) gets me right html content (with spaces for inline elements in mixed > content) > - The query, when it returns the XML file from BaseX, shows that the > XML file still has its spaces. > - When the xslt is applied to the XML file from BaseX (Using Saxon), > with the BaseX XSLT module, spaces disappear around inline elements in > mixed content. > > IN DETAILS > > I have mixed content in a file. Ex. <p>Text <i>italic</i> more text.</p>. > > I have this function:; > > declare %rest:path("/how2-html-topic/{$id}/{$menu-id}") > > %rest:GET > > function topic:html-get-how2-topic($id as xs:string, $menu-id as > xs:string) as node()*{ > > let $x := topic:xml-get-how2-topic($id) > > let $params := map{ "menucontext" := $menu-id} > > let $stylesheet := doc(concat($app:xslt_html_topic, 't')) > > return xslt:transform($x, $stylesheet, $params) > > }; > > My access a web page runs this query. Result (lost spaces): > <p>Text<i>italic</i>more text.</p> > > > - Note: The content has been uploaded with chop spaces = false > - The xquery module specifies: declare boundary-space preserve; declare > option db:chop 'no' > > If I get the same content without applying the xslt:transform, I get the > xml with all the right spaces: > > declare %rest:path("/how2-html-topic/{$id}/{$menu-id}") > %rest:GET > function topic:html-get-how2-topic($id as xs:string, $menu-id as > xs:string) as node()*{ > let $x := topic:xml-get-how2-topic($id) > let $params := map{ "menucontext" := $menu-id} > let $stylesheet := doc(concat($app:xslt_html_topic, 't')) > (: return xslt:transform($x, $stylesheet, $params) :) > return $x > }; > > > Maybe I am missing some config details for the xslt module, in BaseX? In > XLST? My xslt sets the output as follow: > > <xsl:output indent="yes" method="xml" encoding="UTF-8"/> > > > Regards, > > France > -- > France Baril > Architecte documentaire / Documentation architect > france.baril at architextus.com > (514) 572-0341 >
-- France Baril Architecte documentaire / Documentation architect france.baril at architextus.com (514) 572-0341
CG
Christian Grün14 Aug 2012 13:16 #
Hi France, I agree that the behavior of the WebDAV service is/was somewhat inconsistent. With the latest stable snapshot [1], all of your whitespaces should be preserved. Note that the CHOP option is not assigned to a database; instead, it’s an XML parser option that is reinterpreted every time a document is stored to disk. I must concede that this is not clearly reflected in our documentation (we’ll probably work at this soon). A general note on whitespaces, directed to everyone: our CHOP option frequently causes discussions on this list. While the majority of our users would probably prefer to have this option set to »false« by default, we are still hesitant the do this, because a) this would cause incompatibilities with existing applications, and b) the storage of text nodes with whitespaces results in larger databases. Thus, our current plan is to first design and implement better ways for storing whitespace-only text nodes, and then change the default option with the next major release (probably BaseX 8). Hope this helps, Christian
Quoted text · France Baril · 121 lines
> I have made the upgrade to 7.4 and it has resolved the issue. However, it > has now poped up in a different context. > > Context: > > User is working with Oxygen and is connected to BaseX through WebDAV. > DB is set with Whitespace chopping: false. > > Steps: > > User opens a file with content <p>This is <i>mixed</i> content.</p>. > User makes a change. Ex. Adds <p>A new paragraph</p> and saves the changes. > Users closes and re-opens the file. New p is there, but spaces around > <i>mixed</i> have dispappeared. > > Since whitespace chopping is false, shouldn't documents saved through webDAV > be saved following the default DB settings? > > If not, what are our options here? > > Regards, > > France Baril > > On Mon, Jul 23, 2012 at 12:14 PM, France Baril > <france.baril at architextus.com> wrote: >> >> Hi, >> >> I have an issue with spaces in mixed content, when applying the >> xslt:transform command. I have been working around it for months with a hack >> in my css that puts the spaces back as &#160; on inline elements, yet I >> still haven't run upon a clue to help me resolve this for good the clean >> way. >> >> IN SUMMARY >> >> The xslt applied to my xml outside the BaseX environment (Oxygen + Saxon) >> gets me right html content (with spaces for inline elements in mixed >> content) >> The query, when it returns the XML file from BaseX, shows that the XML >> file still has its spaces. >> When the xslt is applied to the XML file from BaseX (Using Saxon), with >> the BaseX XSLT module, spaces disappear around inline elements in mixed >> content. >> >> IN DETAILS >> >> I have mixed content in a file. Ex. <p>Text <i>italic</i> more text.</p>. >> >> I have this function:; >> >> declare %rest:path("/how2-html-topic/{$id}/{$menu-id}") >> >> %rest:GET >> >> function topic:html-get-how2-topic($id as xs:string, $menu-id as >> xs:string) as node()*{ >> >> let $x := topic:xml-get-how2-topic($id) >> >> let $params := map{ "menucontext" := $menu-id} >> >> let $stylesheet := doc(concat($app:xslt_html_topic, 't')) >> >> return xslt:transform($x, $stylesheet, $params) >> >> }; >> >> >> My access a web page runs this query. Result (lost spaces): >> <p>Text<i>italic</i>more text.</p> >> >> Note: The content has been uploaded with chop spaces = false >> The xquery module specifies: declare boundary-space preserve; declare >> option db:chop 'no' >> >> If I get the same content without applying the xslt:transform, I get the >> xml with all the right spaces: >> >> declare %rest:path("/how2-html-topic/{$id}/{$menu-id}") >> %rest:GET >> function topic:html-get-how2-topic($id as xs:string, $menu-id as >> xs:string) as node()*{ >> let $x := topic:xml-get-how2-topic($id) >> let $params := map{ "menucontext" := $menu-id} >> let $stylesheet := doc(concat($app:xslt_html_topic, 't')) >> (: return xslt:transform($x, $stylesheet, $params) :) >> return $x >> }; >> >> >> Maybe I am missing some config details for the xslt module, in BaseX? In >> XLST? My xslt sets the output as follow: >> >> <xsl:output indent="yes" method="xml" encoding="UTF-8"/> >> >> >> Regards, >> >> France >> -- >> France Baril >> Architecte documentaire / Documentation architect >> france.baril at architextus.com >> (514) 572-0341 > > > > > -- > France Baril > Architecte documentaire / Documentation architect > france.baril at architextus.com > (514) 572-0341 > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >

⚡Generated with XQuery