fix various attribute normalisation problems reported by Ashwin this

* parser.c: fix various attribute normalisation problems reported
  by Ashwin
* result/c14n/without-comments/example-4
  result/c14n/with-comments/example-4: this impacted the result of
  two c14n tests :-\
* test/att9 test/att10 test/att11 result//att9* result//att10*
  result//att11*: added 3 specific regression tests coming from the
  XML spec revision and from Ashwin
Daniel

svn path=/trunk/; revision=3715
diff --git a/result/att10 b/result/att10
new file mode 100644
index 0000000..5b29bf8
--- /dev/null
+++ b/result/att10
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<!DOCTYPE doc [
+<!ELEMENT doc (tst)*>
+<!ELEMENT tst (#PCDATA)>
+<!ATTLIST tst a NMTOKENS #IMPLIED>
+<!ATTLIST tst b CDATA #IMPLIED>
+<!ENTITY d "&#xD;">
+<!ENTITY a "&#xA;">
+<!ENTITY da "&#xD;&#xA;">
+]>
+<doc>
+<tst a="xyz" b="  xyz"/>
+<tst a="&d;&d;A&a; &a;B&da;" b="&d;&d;A&a; &a;B&da;"/>
+<tst a="&#13;&#13;A&#10;&#10;B&#13;&#10;" b="&#13;&#13;A&#10;&#10;B&#13;&#10;"/>
+<tst a="x y" b=" x  y "/>
+<tst a="a b" b=" a b "/>
+<tst a="a b" b="  a  b  "/>
+</doc>
diff --git a/result/att10.rde b/result/att10.rde
new file mode 100644
index 0000000..2ca7905
--- /dev/null
+++ b/result/att10.rde
@@ -0,0 +1,23 @@
+0 10 doc 0 0
+0 1 doc 0 0
+1 14 #text 0 1 
+
+1 1 tst 1 0
+1 14 #text 0 1 
+
+1 1 tst 1 0
+1 14 #text 0 1 
+
+1 1 tst 1 0
+1 14 #text 0 1 
+
+1 1 tst 1 0
+1 14 #text 0 1 
+
+1 1 tst 1 0
+1 14 #text 0 1 
+
+1 1 tst 1 0
+1 14 #text 0 1 
+
+0 15 doc 0 0
diff --git a/result/att10.rdr b/result/att10.rdr
new file mode 100644
index 0000000..2ca7905
--- /dev/null
+++ b/result/att10.rdr
@@ -0,0 +1,23 @@
+0 10 doc 0 0
+0 1 doc 0 0
+1 14 #text 0 1 
+
+1 1 tst 1 0
+1 14 #text 0 1 
+
+1 1 tst 1 0
+1 14 #text 0 1 
+
+1 1 tst 1 0
+1 14 #text 0 1 
+
+1 1 tst 1 0
+1 14 #text 0 1 
+
+1 1 tst 1 0
+1 14 #text 0 1 
+
+1 1 tst 1 0
+1 14 #text 0 1 
+
+0 15 doc 0 0
diff --git a/result/att10.sax b/result/att10.sax
new file mode 100644
index 0000000..2df49a5
--- /dev/null
+++ b/result/att10.sax
Binary files differ
diff --git a/result/att10.sax2 b/result/att10.sax2
new file mode 100644
index 0000000..7c6f61d
--- /dev/null
+++ b/result/att10.sax2
Binary files differ
diff --git a/result/att11 b/result/att11
new file mode 100644
index 0000000..121b06d
--- /dev/null
+++ b/result/att11
@@ -0,0 +1,9 @@
+<?xml version="1.0" standalone="yes"?>
+<!DOCTYPE attributes [
+<!ELEMENT attributes EMPTY>
+<!ATTLIST attributes nmtoken NMTOKEN #IMPLIED>
+<!ATTLIST attributes nmtokens NMTOKENS #IMPLIED>
+<!ENTITY ent " entity&recursive; ">
+<!ENTITY recursive "reference">
+]>
+<attributes nmtoken="&ent; &ent; &ent;" nmtokens="Test&#13;&#10; this normalization"/>
diff --git a/result/att11.rde b/result/att11.rde
new file mode 100644
index 0000000..cc83bea
--- /dev/null
+++ b/result/att11.rde
@@ -0,0 +1,2 @@
+0 10 attributes 0 0
+0 1 attributes 1 0
diff --git a/result/att11.rdr b/result/att11.rdr
new file mode 100644
index 0000000..cc83bea
--- /dev/null
+++ b/result/att11.rdr
@@ -0,0 +1,2 @@
+0 10 attributes 0 0
+0 1 attributes 1 0
diff --git a/result/att11.sax b/result/att11.sax
new file mode 100644
index 0000000..67dcf22
--- /dev/null
+++ b/result/att11.sax
@@ -0,0 +1,21 @@
+SAX.setDocumentLocator()
+SAX.startDocument()
+SAX.internalSubset(attributes, , )
+SAX.elementDecl(attributes, 1, ...)
+SAX.attributeDecl(attributes, nmtoken, 7, 3, NULL, ...)
+SAX.attributeDecl(attributes, nmtokens, 8, 3, NULL, ...)
+SAX.entityDecl(ent, 1, (null), (null),  entity&recursive; )
+SAX.getEntity(ent)
+SAX.entityDecl(recursive, 1, (null), (null), reference)
+SAX.getEntity(recursive)
+SAX.externalSubset(attributes, , )
+SAX.getEntity(ent)
+SAX.getEntity(recursive)
+SAX.getEntity(ent)
+SAX.getEntity(recursive)
+SAX.getEntity(ent)
+SAX.getEntity(recursive)
+SAX.startElement(attributes, nmtoken=' &ent;   &ent; &ent; ', nmtokens=' Test

+     this  normalization ')
+SAX.endElement(attributes)
+SAX.endDocument()
diff --git a/result/att11.sax2 b/result/att11.sax2
new file mode 100644
index 0000000..859a970
--- /dev/null
+++ b/result/att11.sax2
@@ -0,0 +1,20 @@
+SAX.setDocumentLocator()
+SAX.startDocument()
+SAX.internalSubset(attributes, , )
+SAX.elementDecl(attributes, 1, ...)
+SAX.attributeDecl(attributes, nmtoken, 7, 3, NULL, ...)
+SAX.attributeDecl(attributes, nmtokens, 8, 3, NULL, ...)
+SAX.entityDecl(ent, 1, (null), (null),  entity&recursive; )
+SAX.getEntity(ent)
+SAX.entityDecl(recursive, 1, (null), (null), reference)
+SAX.getEntity(recursive)
+SAX.externalSubset(attributes, , )
+SAX.getEntity(ent)
+SAX.getEntity(recursive)
+SAX.getEntity(ent)
+SAX.getEntity(recursive)
+SAX.getEntity(ent)
+SAX.getEntity(recursive)
+SAX.startElementNs(attributes, NULL, NULL, 0, 2, 0, nmtoken='&ent...', 17, nmtokens='Test...', 25)
+SAX.endElementNs(attributes, NULL, NULL)
+SAX.endDocument()
diff --git a/result/att9 b/result/att9
new file mode 100644
index 0000000..e4982a2
--- /dev/null
+++ b/result/att9
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<!DOCTYPE doc [
+<!ATTLIST doc a1 NMTOKENS "1 2">
+<!ELEMENT doc (#PCDATA)>
+]>
+<doc/>
diff --git a/result/att9.rde b/result/att9.rde
new file mode 100644
index 0000000..9b0a34d
--- /dev/null
+++ b/result/att9.rde
@@ -0,0 +1,2 @@
+0 10 doc 0 0
+0 1 doc 1 0
diff --git a/result/att9.rdr b/result/att9.rdr
new file mode 100644
index 0000000..9b0a34d
--- /dev/null
+++ b/result/att9.rdr
@@ -0,0 +1,2 @@
+0 10 doc 0 0
+0 1 doc 1 0
diff --git a/result/att9.sax b/result/att9.sax
new file mode 100644
index 0000000..0fe14a1
--- /dev/null
+++ b/result/att9.sax
@@ -0,0 +1,9 @@
+SAX.setDocumentLocator()
+SAX.startDocument()
+SAX.internalSubset(doc, , )
+SAX.attributeDecl(doc, a1, 8, 1, 1 2, ...)
+SAX.elementDecl(doc, 3, ...)
+SAX.externalSubset(doc, , )
+SAX.startElement(doc)
+SAX.endElement(doc)
+SAX.endDocument()
diff --git a/result/att9.sax2 b/result/att9.sax2
new file mode 100644
index 0000000..09b3a04
--- /dev/null
+++ b/result/att9.sax2
@@ -0,0 +1,9 @@
+SAX.setDocumentLocator()
+SAX.startDocument()
+SAX.internalSubset(doc, , )
+SAX.attributeDecl(doc, a1, 8, 1, 1 2, ...)
+SAX.elementDecl(doc, 3, ...)
+SAX.externalSubset(doc, , )
+SAX.startElementNs(doc, NULL, NULL, 0, 1, 1, a1='1 2...', 3)
+SAX.endElementNs(doc, NULL, NULL)
+SAX.endDocument()
diff --git a/result/c14n/with-comments/example-4 b/result/c14n/with-comments/example-4
index 26937c8..19a2559 100644
--- a/result/c14n/with-comments/example-4
+++ b/result/c14n/with-comments/example-4
@@ -5,5 +5,5 @@
    <compute>value&gt;"0" &amp;&amp; value&lt;"10" ?"valid":"error"</compute>
    <compute expr="value>&quot;0&quot; &amp;&amp; value&lt;&quot;10&quot; ?&quot;valid&quot;:&quot;error&quot;">valid</compute>
    <norm attr=" '    &#xD;&#xA;&#x9;   ' "></norm>
-   <normId id="'  &#xD;&#xA;&#x9; '"></normId>
+   <normId id="' &#xD;&#xA;&#x9; '"></normId>
 </doc>
\ No newline at end of file
diff --git a/result/c14n/without-comments/example-4 b/result/c14n/without-comments/example-4
index 26937c8..19a2559 100644
--- a/result/c14n/without-comments/example-4
+++ b/result/c14n/without-comments/example-4
@@ -5,5 +5,5 @@
    <compute>value&gt;"0" &amp;&amp; value&lt;"10" ?"valid":"error"</compute>
    <compute expr="value>&quot;0&quot; &amp;&amp; value&lt;&quot;10&quot; ?&quot;valid&quot;:&quot;error&quot;">valid</compute>
    <norm attr=" '    &#xD;&#xA;&#x9;   ' "></norm>
-   <normId id="'  &#xD;&#xA;&#x9; '"></normId>
+   <normId id="' &#xD;&#xA;&#x9; '"></normId>
 </doc>
\ No newline at end of file
diff --git a/result/noent/att10 b/result/noent/att10
new file mode 100644
index 0000000..cc1c6b0
--- /dev/null
+++ b/result/noent/att10
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<!DOCTYPE doc [
+<!ELEMENT doc (tst)*>
+<!ELEMENT tst (#PCDATA)>
+<!ATTLIST tst a NMTOKENS #IMPLIED>
+<!ATTLIST tst b CDATA #IMPLIED>
+<!ENTITY d "&#xD;">
+<!ENTITY a "&#xA;">
+<!ENTITY da "&#xD;&#xA;">
+]>
+<doc>
+<tst a="xyz" b="  xyz"/>
+<tst a="&#13;&#13;A&#10; &#10;B&#13;&#10;" b="&#13;&#13;A&#10; &#10;B&#13;&#10;"/>
+<tst a="&#13;&#13;A&#10;&#10;B&#13;&#10;" b="&#13;&#13;A&#10;&#10;B&#13;&#10;"/>
+<tst a="x y" b=" x  y "/>
+<tst a="a b" b=" a b "/>
+<tst a="a b" b="  a  b  "/>
+</doc>
diff --git a/result/noent/att11 b/result/noent/att11
new file mode 100644
index 0000000..3646e62
--- /dev/null
+++ b/result/noent/att11
@@ -0,0 +1,9 @@
+<?xml version="1.0" standalone="yes"?>
+<!DOCTYPE attributes [
+<!ELEMENT attributes EMPTY>
+<!ATTLIST attributes nmtoken NMTOKEN #IMPLIED>
+<!ATTLIST attributes nmtokens NMTOKENS #IMPLIED>
+<!ENTITY ent " entity&recursive; ">
+<!ENTITY recursive "reference">
+]>
+<attributes nmtoken="entityreference entityreference entityreference" nmtokens="Test&#13;&#10; this normalization"/>
diff --git a/result/noent/att9 b/result/noent/att9
new file mode 100644
index 0000000..e4982a2
--- /dev/null
+++ b/result/noent/att9
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<!DOCTYPE doc [
+<!ATTLIST doc a1 NMTOKENS "1 2">
+<!ELEMENT doc (#PCDATA)>
+]>
+<doc/>