Subject: [xml2rfc] Strange behavior with a DOI reference include

From: Robert Moskowitz <[email-masked]>
Date: Mon, 14 Dec 2020 22:47:37 -0500

this include:

      <?rfc 
include="https://xml2rfc.tools.ietf.org/public/rfc/bibxml7/reference.DOI.10.1109/IEEESTD.2016.7786995.xml"?>

worked when my xml was ver 2 and building with xml2rfc --v3

then I did the --v2v3 and the script replaced all my includes with some 
actual xml.  For this one, it is:

         <reference anchor="DOI_10.1109_IEEESTD.2016.7786995" 
xml:base="https://xml2rfc.tools.ietf.org/public/rfc/bibxml7/reference.DOI.10.1109/IEEESTD.2016.7786995.xml">
           <front>
             <title>IEEE Standard for Information 
technology--Telecommunications and information exchange between systems 
Local and metropolitan area networks--Specific requirements - Part 11: 
Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) 
Specifications</title>
             <author>
               <organization/>
             </author>
             <date>n.d.</date>
           </front>
           <seriesInfo name="IEEE" value="standard"/>
           <seriesInfo name="DOI" value="10.1109/ieeestd.2016.7786995"/>
         </reference>

Which works.

But if I replace this with the include I get the following errors:

$ xml2rfc --v3 draft-ietf-hip-dex.xml
Traceback (most recent call last):
   File "/home/rgm/.local/bin/xml2rfc", line 11, in <module>
     load_entry_point('xml2rfc==3.5.0', 'console_scripts', 'xml2rfc')()
   File "/home/rgm/.local/lib/python3.8/site-packages/xml2rfc/run.py", 
line 736, in main
     xmlrfc.tree = prep.prep()
   File 
"/home/rgm/.local/lib/python3.8/site-packages/xml2rfc/writers/preptool.py", 
line 208, in prep
     tree = self.dispatch(self.selectors)
   File 
"/home/rgm/.local/lib/python3.8/site-packages/xml2rfc/writers/base.py", 
line 1905, in dispatch
     func(e, e.getparent())
   File 
"/home/rgm/.local/lib/python3.8/site-packages/xml2rfc/writers/preptool.py", 
line 411, in check_attribute_values
     if i and not i.isdigit() and not 
i==self.get_attribute_defaults(c.tag)[a]:
KeyError: 'year'

When I do a wget on this DOI I get:

<reference anchor="DOI_10.1109_IEEESTD.2016.7786995" >
   <front>
     <title>IEEE Standard for Information technology—Telecommunications 
and information exchange between systems Local and metropolitan area 
networks—Specific requirements - Part 11: Wireless LAN Medium Access 
Control (MAC) and Physical Layer (PHY) Specifications</title>
     <author >
       <organization></organization>
     </author>
     <date year="n.d."/>
   </front>
   <seriesInfo name="IEEE" value="standard"/>
   <seriesInfo name="DOI" value="10.1109/ieeestd.2016.7786995"/>
</reference>

I have a LOT of other DOIs, but this is the only IEEE one.  Here are 
some of my other DOIs:

      <?rfc 
include="https://xml2rfc.tools.ietf.org/public/rfc/bibxml7/reference.DOI.10.6028/NIST.SP.800-56C.xml"?>
      <?rfc 
include="https://xml2rfc.tools.ietf.org/public/rfc/bibxml7/reference.DOI.10.6028/NIST.SP.800-108.xml"?>
      <?rfc 
include="https://xml2rfc.tools.ietf.org/public/rfc/bibxml7/reference.DOI.10.1007/978-3-540-28628-8_30.xml"?>
      <?rfc 
include="https://xml2rfc.tools.ietf.org/public/rfc/bibxml7/reference.DOI.10.1109/TIT.1976.1055638.xml"?>
      <?rfc 
include="https://xml2rfc.tools.ietf.org/public/rfc/bibxml7/reference.DOI.10.1109/IPSN.2008.47.xml"?>
      <?rfc 
include="https://xml2rfc.tools.ietf.org/public/rfc/bibxml7/reference.DOI.10.1109/ICNP.2013.6733571.xml"?>

Why is the one failing, but the others work?

---

From: Carsten Bormann <[email-masked]>
Date: Tue, 15 Dec 2020 07:46:46 +0100

On 2020-12-15, at 04:47, Robert Moskowitz <[email-masked]> wrote:
>     <date year="n.d.”/>

That triggers an issue in RFCXML V3 that so far was papered over by the v2v3 converter.

In v2, if you want to have non-numeric information in the date field (e.g., “n.d.” for no date), you put it into the year attribute of the date element:

https://tools.ietf.org/html/rfc7749#section-2.13

In v3, this was changed:  The date element got content, which is supposed to be used for dates that do not clearly have year/month/day.  Actually:

https://tools.ietf.org/html/rfc7991#section-2.17 still says it’s the way it was in v2, but 

https://tools.ietf.org/html/draft-levkowetz-xml2rfc-v3-implementation-notes-11#section-4.1.3

reneges and the documentation that comes with xml2rfc (the URI for which I forget) has more details on the change.  

The bibxml data generated from DOIs don’t know that.

If you convert a v2 document into v3, non-numeric year data will be moved into the content of <date>.  If you import bibxml data into a document that is putatively v3, that breaks for a non-numeric date.

(There also is a question whether doilit should apply a heuristic to generate a date even if the DOI data say

{"issued":{"date-parts":[[null]]}}

which I think is breakage.  But that is orthogonal to be above issue.)

Grüße, Carsten

---

From: Carsten Bormann <[email-masked]>
Date: Tue, 15 Dec 2020 08:02:45 +0100

> {"issued":{"date-parts":[[null]]}}

Reproduce:

$ curl -sLH "Accept: application/citeproc+json" https://dx.doi.org/10.1109/IEEESTD.2016.7786995 | jq .issued
{
  "date-parts": [
    [
      null
    ]
  ]
}

(Origin of that data:

$ curl -ILH "Accept: application/citeproc+json" https://dx.doi.org/10.1109/IEEESTD.2016.7786995

HTTP/2 302
…
location: https://data.crossref.org/10.1109%2FIEEESTD.2016.7786995

HTTP/1.1 200 OK
…
link: <http://dx.doi.org/10.1109/ieeestd.2016.7786995>; rel=“canonical"

I don’t know whether crossref is broken or whether IEEE sullied it with broken data; the effect is the same.)

Grüße, Carsten