Andreas,

Have you tried putting the p in the correct xhtml namespace? I vaguely recall 
that makes difference in xqy output, so maybe in xslt output as well..

Cheers,
Geert

From: 
<[email protected]<mailto:[email protected]>>
 on behalf of Andreas Hubmer 
<[email protected]<mailto:[email protected]>>
Reply-To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Date: Friday, February 12, 2016 at 12:45 PM
To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Subject: Re: [MarkLogic Dev General] XSLT: empty elements in XHTML output

Hi,

Thanks for your fast response.

I think that in your case the "Auto" mode is playing with the result. When I 
switch to the "Raw" mode or wrap the result in xdmp:quote then the result is 
<p/>

I am running 8.0-3 on Windows.

Cheers,
Andreas


2016-02-12 12:36 GMT+01:00 Rob Szkutak 
<[email protected]<mailto:[email protected]>>:
Hi,

Which version of MarkLogic are you running? On 8.0-4 on Windows I'm getting the 
expected result. Screenshot attached of trying it in Query Console.

If you're running the same version of MarkLogic, how are you rendering the 
result? It's possible something else may be playing with the result.

Best,
Rob

Rob Szkutak
Senior Consultant
MarkLogic Corporation
[email protected]<mailto:[email protected]>
www.marklogic.com<http://www.marklogic.com>

________________________________
From:[email protected]<mailto:[email protected]>
 
[[email protected]<mailto:[email protected]>]
 on behalf of Andreas Hubmer 
[[email protected]<mailto:[email protected]>]
Sent: Friday, February 12, 2016 5:21 AM
To: MarkLogic Developer Discussion
Subject: [MarkLogic Dev General] XSLT: empty elements in XHTML output

Hi,

I use the XHTML output method and to me it seems that tags with a non-empty 
content model (like <p/>) are serialized incorrectly, when they are empty.

Example:
xquery version "1.0-ml";
xdmp:xslt-eval(
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="2.0">
      <xsl:output method="xhtml" media-type="text/html" encoding="utf-8" 
omit-xml-declaration="yes" indent="no"/>
      <xsl:template match="root">
          <p/>
      </xsl:template>
  </xsl:stylesheet>
  ,
  <root></root>
)
==> Result: <p/>
Expected result: <p></p>

In the specification for the XHTML output method [1] the following is defined:
Given an empty instance of an XHTML element whose content model is not EMPTY 
(for example, an empty title or paragraph) the serializer MUST NOT use the 
minimized form. That is, it MUST output <p></p> and not <p />.

Cheers,
Andreas

[1] https://www.w3.org/TR/xslt-xquery-serialization/#xhtml-output

_______________________________________________
General mailing list
[email protected]<mailto:[email protected]>
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general




--
Andreas Hubmer
Senior IT Consultant

EBCONT enterprise technologies GmbH
Millennium Tower
Handelskai 94-96
A-1200 Vienna

Mobile: +43 664 60651861
Fax: +43 2772 512 69-9
Email: [email protected]<mailto:[email protected]>
Web: http://www.ebcont.com

OUR TEAM IS YOUR SUCCESS

UID-Nr. ATU68135644
HG St.Pölten - FN 399978 d
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to