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]
www.marklogic.com<http://www.marklogic.com>

________________________________
From: [email protected] 
[[email protected]] on behalf of Andreas Hubmer 
[[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]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to