This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 29516 - [ser31] Definitions spanning paragraphs
Summary: [ser31] Definitions spanning paragraphs
Status: RESOLVED WORKSFORME
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Serialization 3.1 (show other bugs)
Version: Candidate Recommendation
Hardware: PC All
: P2 editorial
Target Milestone: ---
Assignee: C. M. Sperberg-McQueen
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 29513
  Show dependency treegraph
 
Reported: 2016-03-03 12:04 UTC by Michael Kay
Modified: 2016-09-02 11:02 UTC (History)
1 user (show)

See Also:


Attachments

Description Michael Kay 2016-03-03 12:04:21 UTC
See the definition of https://www.w3.org/TR/xslt-xquery-serialization-31/#to-a-json-string

At first sight it appears that the spec has solved the problem of writing a multi-paragraph definition, highlighted in bug #29513 against the XSLT 3.0 specification.

However, on closer examination it appears that the markup is not DTD-valid, so it's not a solution to the problem at all (and I'm surprised that the build succeeds).  It has a <p> which contains a <termdef> which contains an <olist>. Our markup doesn't allow lists within paragraphs, so this breaks the rules.

It would be good to enhance the DTD and stylesheet for all the specs to allow multi-paragraph definitions. Note that there are many cases in the serialization spec where a definition ends in mid-sentence because of this limitation.
Comment 1 Michael Kay 2016-03-03 12:20:54 UTC
Solving this is tricky if only because of the complexity of the DTD design and the fact that few of us write DTDs every day. The fact that there is quite a bit of stylesheet machinery around termref/xtermref/termdef means we need to be cautious.

I'm inclined to the following rather clunky solution:

(a) add an attribute <termdef open="true"> to indicate that the termdef continues beyond the end of the actual termdef element;

(b) add the markup <p role="closetermdef"/> to signal the end of the most recent open termdef.

The only stylesheet changes are then, I think

(i) Change or override the match="termdef" template (xmlspec line 2145), currently

  <xsl:template match="termdef">
    <xsl:text>[</xsl:text>
    <a name="{@id}" id="{@id}" title="{@term}">
      <xsl:text>Definition</xsl:text>
    </a>
    <xsl:text>: </xsl:text>
    <xsl:apply-templates/>
    <xsl:text>]</xsl:text>
  </xsl:template>

to omit the closing "]" if open="true"

(ii) Add a template rule

<xsl:template match="p[@role='closetermdef']">
  <p>]</p>
</xsl:template>
Comment 2 Michael Kay 2016-03-03 12:30:43 UTC
And of course we have to change the stylesheet code that produces the glossary (xsl-query.xsl line 546). I'm not sure about the diff case, but the non-diff code replaces

        <dd>
          <p>
            <xsl:apply-templates/>
          </p>
        </dd>

by 
        <dd>
          <p>
            <xsl:apply-templates/>
          </p>
          <xsl:if test="@open='true'">
            <xsl:variable name="close" select="../p[@role='closetermdef'][1]"/>
            <xsl:apply-templates select="../following-sibling::*[$close >> .]"/>
          </xsl:if>
        </dd>
Comment 3 Michael Kay 2016-03-04 00:08:45 UTC
I have provisionally made (but not committed) the suggested DTD and stylesheet changes, and used them for four definitions in the XSLT spec that logically ran into multiple paragraphs.

I found that some of the templates needing change were overridden in the XSLT version of the stylesheets, so the changes to the base templates have not actually been tested by this process.

(In the course of this I noticed that oXygen, which I use for authoring the specs, was actually using its own version of xmlspec to validate the documents, rather than using the version that we link to. So changing the DTD didn't clear the apparent validation errors. I've changed my oXygen configuration to prevent this happening. But the serialization spec still shows up as DTD-invalid.)
Comment 4 Andrew Coleman 2016-09-02 11:02:00 UTC
This was discussed between the editors, and it was decided not to make any changes to the serialization spec.