Test Actual output Expected output Markup
Empty document

<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
Basic <link rel>
<> <http://www.w3.org/1999/xhtml/vocab#next> <http://example.org/test.css> .
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<link rel="next" href="http://example.org/test.css" />
Empty <link rel>

<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<link rel="" href="http://example.org/test.css" />
Valueless <link rel>

<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<link rel href="http://example.org/test.css" />
Whitespace around <link rel>
<> <http://www.w3.org/1999/xhtml/vocab#next> <http://example.org/test.css> .
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<link rel="  next  " href="http://example.org/test.css" />
Whitespace in <link rel>
<> <http://www.w3.org/1999/xhtml/vocab#next> <http://example.org/test.css> .
<> <http://www.w3.org/1999/xhtml/vocab#prev> <http://example.org/test.css> .
<> <http://www.w3.org/1999/xhtml/vocab#first> <http://example.org/test.css> .
<> <http://www.w3.org/1999/xhtml/vocab#last> <http://example.org/test.css> .
<> <http://www.w3.org/1999/xhtml/vocab#section> <http://example.org/test.css> .
<> <http://www.w3.org/1999/xhtml/vocab#subsection> <http://example.org/test.css> .
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<link rel="next&#x20;prev&#x09;first&#x0a;last&#x0c;section&#x0d;subsection" href="http://example.org/test.css" />
Not-whitespace in <link rel>

<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<link rel="next&#x0b;prev" href="http://example.org/test.css" />
Uppercase in <link rel>
<> <http://www.w3.org/1999/xhtml/vocab#next> <http://example.org/test.css> .
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<link rel="NEXT" href="http://example.org/test.css" />
Bogus reserved words in <link rel>
<> <http://www.w3.org/1999/xhtml/vocab#next> <http://example.org/test.css> .
<> <http://www.w3.org/1999/xhtml/vocab#prev> <http://example.org/test.css> .
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<link rel="next bogus prev" href="http://example.org/test.css" />
URLs in <link rel>
<> <http://www.w3.org/1999/xhtml/vocab#next> <http://example.org/test.css> .
<> <http://www.w3.org/1999/xhtml/vocab#prev> <http://example.org/test.css> .
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<link rel="next http://example.org/test prev" href="http://example.org/test.css" />
CURIEs in <link rel>
<> <http://www.w3.org/1999/xhtml/vocab#next> <http://example.org/test.css> .
<> <http://example.org/test> <http://example.org/test.css> .
<> <http://www.w3.org/1999/xhtml/vocab#prev> <http://example.org/test.css> .
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<link xmlns:ex="http://example.org/" rel="next ex:test prev" href="http://example.org/test.css" />
Basic xmlns
<> <http://example.org/test> "Test".
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p xmlns:ex="http://example.org/" property="ex:test">Test</p>
Uppercase xmlns, lowercase CURIE
<> <http://example.org/test> "Test".
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p XMLNS:EX="http://example.org/" property="ex:test">Test</p>
Uppercase xmlns, uppercase CURIE

<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p XMLNS:EX="http://example.org/" property="EX:test">Test</p>
Non-NCName xmlns prefix

<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p xmlns:0="http://example.org/" property="0:test">Test</p>
Empty xmlns prefix
<> <http://www.w3.org/1999/xhtml/vocab#test> "Test".
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p xmlns:="http://example.org/" property=":test">Test</p>
Underscore xmlns prefix
<> <http://example.org/test> "Test".
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p xmlns:_="http://example.org/" property="_:test">Test</p>
xmlns prefix 'xml' with correct URI
<> <http://www.w3.org/XML/1998/namespacetest> "Test".
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p xmlns:xml="http://www.w3.org/XML/1998/namespace" property="xml:test">Test</p>
xmlns prefix 'xml' with incorrect URI

<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p xmlns:xml="http://example.org/" property="xml:test">Test</p>
xmlns prefix 'xmlns' with correct URI

<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p xmlns:xmlns="http://www.w3.org/2000/xmlns/" property="xmlns:test">Test</p>
xmlns prefix 'xmlns' with incorrect URI

<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p xmlns:xmlns="http://example.org/" property="xmlns:test">Test</p>
xmlns prefix 'xmlzzz'
<> <http://example.org/test> "Test".
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p xmlns:xmlzzz="http://example.org/" property="xmlzzz:test">Test</p>
Empty xmlns value

<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p xmlns:ex="" property="ex:http://example.com/test">Test</p>
Empty xmlns value overriding non-empty
<> <http://example.org/http://example.com/test> "Test".
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p xmlns:ex="http://example.org/"><span xmlns:ex="" property="ex:http://example.com/test">Test</span></p>
Invalid (xml URI) xmlns value

<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p xmlns:ex="http://www.w3.org/XML/1998/namespace" property="ex:test">Test</p>
Invalid (xmlns URI) xmlns value

<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p xmlns:ex="http://www.w3.org/2000/xmlns/" property="ex:test">Test</p>
Colon in prefix
<> <http://example.org/1/two:three:test> "Test".
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p xmlns:ex="http://example.org/1/" xmlns:ex:two="http://example.org/2/" property="ex:two:three:test">Test</p>
Non-XML4e xmlns prefix
<> <http://example.org/test> "Test".
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p xmlns:testŀ="http://example.org/">
  <span xmlns:test="http://example.org/error/" property="testŀ:test">Test</span>
</p>
Non-ASCII case insensitivity in xmlns prefix (1)
<> <http://example.org/1/one> "Test".
<> <http://example.org/2/two> "Test".
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p xmlns:testÁ="http://example.org/1/">
  <span xmlns:testá="http://example.org/2/">
    <span property="testÁ:one">Test</span>
    <span property="testá:two">Test</span>
  </span>
</p>
Non-ASCII case insensitivity in xmlns prefix (2)
<> <http://example.org/1/one> "Test".
<> <http://example.org/2/two> "Test".
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p xmlns:testᾈ="http://example.org/1/">
  <span xmlns:testᾀ="http://example.org/2/">
    <span property="testᾈ:one">Test</span>
    <span property="testᾀ:two">Test</span>
  </span>
</p>
Scripted: Conflicting xmlns values
<> <test2:test> "Test".
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p xmlns:t="test1:" id="d">
<span property="t:test">Test</span>
</p>
<script>
document.getElementById('d').setAttributeNS(
    'http://www.w3.org/2000/xmlns/', 'xmlns:t', 'test2:');
    /* (now the element has two distinct attributes,
        each in different namespaces) */
</script>
Undeclared prefix

<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p property="foobar:test">Test</p>
Undeclared prefix 'rdf'

<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p property="rdf:test">Test</p>
Undeclared prefix 'xml'

<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p property="xml:test">Test</p>
Undeclared prefix 'xmlns'

<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p property="xmlns:test">Test</p>
Undeclared common prefixes

<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p property="dc:test">Test</p>
<p property="foaf:test">Test</p>
<p property="owl:test">Test</p>
<p property="rdfs:test">Test</p>
<p property="xv:test">Test</p>
<p property="xsd:test">Test</p>
Digits in CURIE value
<> <http://example.org/one2three4> "Test".
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p xmlns:ex="http://example.org/" property="ex:one2three4">Test</p>
Ignoring 'about' with undefined prefix
<http://example.com/> <http://example.org/test1> "Test".
<http://example.com/> <http://example.org/test2> "Test".
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p xmlns:ex="http://example.org/">
  <span src="http://example.com/">
    <span property="ex:test1">Test</span>
  </span>
  <span about="[bogus:bogus]" src="http://example.com/">
    <span property="ex:test2">Test</span>
  </span>
</p>
Ignoring 'about' with invalid prefix
<http://example.com/> <http://example.org/test1> "Test".
<http://example.com/> <http://example.org/test2> "Test".
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p xmlns:ex="http://example.org/" xmlns:0="http://example.org/error/">
  <span src="http://example.com/">
    <span property="ex:test1">Test</span>
  </span>
  <span about="[0:bogus]" src="http://example.com/">
    <span property="ex:test2">Test</span>
  </span>
</p>
Ignoring 'rel' with undefined prefix
<http://example.org/href> <http://example.org/test1> "Test".
<> <http://example.org/test2> <http://example.org/href>.
<> <http://example.org/test3> "Test".
<> <http://example.org/test5> "Test".
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p xmlns:ex="http://example.org/">
  <span property="ex:test1" href="http://example.org/href">Test</span>
  <span rel="ex:test2" property="ex:test3" href="http://example.org/href">Test</span>
  <span rel="bogus:test4" property="ex:test5" href="http://example.org/href">Test</span>
</p>
Ignoring 'rel' with invalid prefix
<http://example.org/href> <http://example.org/test1> "Test".
<> <http://example.org/test2> <http://example.org/href>.
<> <http://example.org/test3> "Test".
<> <http://example.org/test5> "Test".
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p xmlns:ex="http://example.org/" xmlns:0="http://example.org/error/">
  <span property="ex:test1" href="http://example.org/href">Test</span>
  <span rel="ex:test2" property="ex:test3" href="http://example.org/href">Test</span>
  <span rel="0:test4" property="ex:test5" href="http://example.org/href">Test</span>
</p>
Ignoring empty 'rel'
<http://example.org/href> <http://example.org/test1> "Test".
<> <http://example.org/test2> <http://example.org/href>.
<> <http://example.org/test3> "Test".
<> <http://example.org/test5> "Test".
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p xmlns:ex="http://example.org/">
  <span property="ex:test1" href="http://example.org/href">Test</span>
  <span rel="ex:test2" property="ex:test3" href="http://example.org/href">Test</span>
  <span rel="" property="ex:test5" href="http://example.org/href">Test</span>
</p>
Invalid property setting 'skip element'
<http://example.com/> <http://example.org/rel1> <http://example.net/>.
<http://example.com/> <http://example.org/rel2> _:blanknode0.
_:blanknode0 <http://example.org/prop> "Content 2" .
<http://example.com/> <http://example.org/rel3> _:blanknode1.
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p xmlns:ex="http://example.org/" about="http://example.com/" rel="ex:rel1">
  <span content="Content 1"><span about="http://example.net/">Test 1</span>
</p>
<p xmlns:ex="http://example.org/" about="http://example.com/" rel="ex:rel2">
  <span property="ex:prop" content="Content 2"><span about="http://example.net/">Test 2</span></span>
</p>
<p xmlns:ex="http://example.org/" about="http://example.com/" rel="ex:rel3">
  <span property="bogus:bogus" content="Content 3"><span about="http://example.net/">Test 3</span></span>
</p>
Safe CURIE containing square brackets
<> <http://example.org/1/test> "Test".
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p xmlns:ex="http://example.org/1/" xmlns:[ex="http://example.org/2/" about="[[ex:test]]" property="ex:test">Test</p>
Language in xml:lang
<> <http://example.org/test> "Test".
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p xmlns:ex="http://example.org/" property="ex:test" xml:lang="aa">Test</p>
Language in lang
<> <http://example.org/test> "Test"@aa.
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p xmlns:ex="http://example.org/" property="ex:test" lang="aa">Test</p>
Language inheritance
<> <http://example.org/test> "Test"@cc.
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p lang="aa"><span lang="bb"><span xmlns:ex="http://example.org/" property="ex:test" lang="cc">Test</span></span></p>
Conflicting languages
<> <http://example.org/test> "Test"@aa.
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p xmlns:ex="http://example.org/" property="ex:test" lang="aa" xml:lang="bb">Test</p>
Duplicate language attributes
<> <http://example.org/test> "Test"@bb.
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p xmlns:ex="http://example.org/" property="ex:test" xml:lang="aa" lang="bb" lang="cc" xml:lang="dd">Test</p>
Conflicting language inheritance (1)
<> <http://example.org/test> "Test"@aa.
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p lang="aa"><span xmlns:ex="http://example.org/" property="ex:test" xml:lang="bb">Test</span></p>
Conflicting language inheritance (2)
<> <http://example.org/test> "Test"@bb.
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p xml:lang="aa"><span xmlns:ex="http://example.org/" property="ex:test" lang="bb">Test</span></p>
Scripted: Conflicting languages
<> <http://example.org/test> "Test"@cc.
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p xmlns:ex="http://example.org/" property="ex:test" lang="aa" xml:lang="bb" id="d">Test</p>
<script>
document.getElementById('d').setAttributeNS(
  'http://www.w3.org/XML/1998/namespace', 'xml:lang', 'cc');
</script>
Scripted: Conflicting language inheritance (1)
<> <http://example.org/test> "Test"@aa.
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p id="d"><span xmlns:ex="http://example.org/" property="ex:test" lang="aa" xml:lang="bb">Test</span></p>
<script>
document.getElementById('d').setAttributeNS(
  'http://www.w3.org/XML/1998/namespace', 'xml:lang', 'cc');
</script>
Scripted: Conflicting language inheritance (2)
<> <http://example.org/test> "Test"@cc.
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test</title>
<p lang="aa" xml:lang="bb"><span xmlns:ex="http://example.org/" property="ex:test" id="d">Test</span></p>
<script>
document.getElementById('d').setAttributeNS(
  'http://www.w3.org/XML/1998/namespace', 'xml:lang', 'cc');
</script>