Date picture and xslt:transform()

Friday, 29 April 2022 · 4 messages
ZD
Zimmel, Daniel29 Apr 2022 10:05 #
Hi, why do I get different results with the following two queries? xslt:transform() does not respect my date picture. Expected result:
	<root>29. März 2022</root>
Query 1:
	<root>{format-date(xs:date('2022-03-29'), '[D]. [MNn] [Y]', 'de', (), ())}</root>
Result: <root>29. März 2022</root> Query 2:
declare namespace xsl = 'http://www.w3.org/1999/XSL/Transform';
let $xslt := <xsl:stylesheet version="3.0"
                              xmlns:xs="http://www.w3.org/2001/XMLSchema"
                              exclude-result-prefixes="xs">
              <xsl:template match="/">
                <root>
                  <xsl:sequence select="format-date(xs:date('2022-03-29'), '[D]. [MNn] [Y]', 'de', (), ())"/>
                </root>
              </xsl:template>
            </xsl:stylesheet>
let $xml := <root/>

return
  for $xml in $xml
  return
    $xml => xslt:transform($xslt)
Result: <root>[Language: en]29. March 2022</root> Running the XSLT with Saxon EE (not in BaseX via xslt:transform) returns (correctly):
	<root>29. März 2022</root>
Using BaseX 9.5 ? Daniel
ZD
Zimmel, Daniel29 Apr 2022 10:19 #
... for clarification, I can reproduce the behavior with stand-alone Saxon HE 10.6 (but not in PE and EE). Perhaps this needs to be addressed to Saxon then, since the documentation says "available in all editions"... still happy if anybody does have some helpful insights here. Daniel
Quoted text · Zimmel, Daniel · 37 lines
-----Ursprüngliche Nachricht----- Von: Zimmel, Daniel <> Gesendet: Freitag, 29. April 2022 10:05 An: basex-talk at mailman.uni-konstanz.de Betreff: Date picture and xslt:transform() Hi, why do I get different results with the following two queries? xslt:transform() does not respect my date picture. Expected result: <root>29. März 2022</root> Query 1: <root>{format-date(xs:date('2022-03-29'), '[D]. [MNn] [Y]', 'de', (), ())}</root> Result: <root>29. März 2022</root> Query 2: declare namespace xsl = 'http://www.w3.org/1999/XSL/Transform'; let $xslt := <xsl:stylesheet version="3.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs"> <xsl:template match="/"> <root> <xsl:sequence select="format-date(xs:date('2022-03-29'), '[D]. [MNn] [Y]', 'de', (), ())"/> </root> </xsl:template> </xsl:stylesheet> let $xml := <root/> return for $xml in $xml return $xml => xslt:transform($xslt) Result: <root>[Language: en]29. March 2022</root> Running the XSLT with Saxon EE (not in BaseX via xslt:transform) returns (correctly): <root>29. März 2022</root> Using BaseX 9.5 ? Daniel
CG
Christian Grünin reply to Zimmel, Daniel, 29 Apr 2022, 10:0529 Apr 2022 10:28 #
Hi Daniel, What do you get if you invoke xslt:processor() ? If it’s "Saxon EE", you should get "<root>29. März 2022</root>" as result of your query (at least that’s what I get). If it’s something else, it indicates that Saxon EE has not correctly been embedded in your Java classpath (see [1] for further information). If it’s only about formatting date, you can also run your function call within BaseX … format-date(xs:date('2022-03-29'), '[D]. [MNn] [Y]', 'de', (), ()) … but I guess that’s what you already know. Best, Christian [1] https://docs.basex.org/wiki/XSLT_Module
Quoted text · Daniel · 51 lines
On Fri, Apr 29, 2022 at 10:05 AM Zimmel, Daniel <D.Zimmel at esvmedien.de> wrote: > > Hi, > > why do I get different results with the following two queries? > xslt:transform() does not respect my date picture. > > Expected result: > > <root>29. März 2022</root> > > Query 1: > > <root>{format-date(xs:date('2022-03-29'), '[D]. [MNn] [Y]', 'de', (), ())}</root> > > Result: > <root>29. März 2022</root> > > Query 2: > > declare namespace xsl = 'http://www.w3.org/1999/XSL/Transform'; > let $xslt := <xsl:stylesheet version="3.0" > xmlns:xs="http://www.w3.org/2001/XMLSchema" > exclude-result-prefixes="xs"> > <xsl:template match="/"> > <root> > <xsl:sequence select="format-date(xs:date('2022-03-29'), '[D]. [MNn] [Y]', 'de', (), ())"/> > </root> > </xsl:template> > </xsl:stylesheet> > let $xml := <root/> > > return > for $xml in $xml > return > $xml => xslt:transform($xslt) > > Result: > <root>[Language: en]29. March 2022</root> > > > Running the XSLT with Saxon EE (not in BaseX via xslt:transform) returns (correctly): > > <root>29. März 2022</root> > > Using BaseX 9.5 > > ? > > Daniel >
ZD
Zimmel, Daniel29 Apr 2022 10:37 #
I get "Saxon HE", but that's what I already know ;-) Yes it works with Saxon EE, I only wonder why it does not with Saxon HE. I will ask over at Saxonica, already found a bug report that might be related... there is nothing in the documentation that says it should not work with HE as well. Thanks!
Quoted text · Christian Grün · 67 lines
-----Ursprüngliche Nachricht----- Von: Christian Grün <christian.gruen at gmail.com> Gesendet: Freitag, 29. April 2022 10:29 An: Zimmel, Daniel <D.Zimmel at ESVmedien.de> Cc: basex-talk at mailman.uni-konstanz.de Betreff: Re: [basex-talk] Date picture and xslt:transform() Hi Daniel, What do you get if you invoke xslt:processor() ? If it’s "Saxon EE", you should get "<root>29. März 2022</root>" as result of your query (at least that’s what I get). If it’s something else, it indicates that Saxon EE has not correctly been embedded in your Java classpath (see [1] for further information). If it’s only about formatting date, you can also run your function call within BaseX … format-date(xs:date('2022-03-29'), '[D]. [MNn] [Y]', 'de', (), ()) … but I guess that’s what you already know. Best, Christian [1] https://docs.basex.org/wiki/XSLT_Module On Fri, Apr 29, 2022 at 10:05 AM Zimmel, Daniel <D.Zimmel at esvmedien.de> wrote: > > Hi, > > why do I get different results with the following two queries? > xslt:transform() does not respect my date picture. > > Expected result: > > <root>29. März 2022</root> > > Query 1: > > <root>{format-date(xs:date('2022-03-29'), '[D]. [MNn] [Y]', > 'de', (), ())}</root> > > Result: > <root>29. März 2022</root> > > Query 2: > > declare namespace xsl = 'http://www.w3.org/1999/XSL/Transform'; > let $xslt := <xsl:stylesheet version="3.0" > xmlns:xs="http://www.w3.org/2001/XMLSchema" > exclude-result-prefixes="xs"> > <xsl:template match="/"> > <root> > <xsl:sequence select="format-date(xs:date('2022-03-29'), '[D]. [MNn] [Y]', 'de', (), ())"/> > </root> > </xsl:template> > </xsl:stylesheet> > let $xml := <root/> > > return > for $xml in $xml > return > $xml => xslt:transform($xslt) > > Result: > <root>[Language: en]29. March 2022</root> > > > Running the XSLT with Saxon EE (not in BaseX via xslt:transform) returns (correctly): > > <root>29. März 2022</root> > > Using BaseX 9.5 > > ? > > Daniel >

⚡Generated with XQuery