xcop 0.10.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/xcop/document.rb +9 -0
- data/lib/xcop/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fa89e4f1fcf4bd98059669b6fdd5dfae445a9c6fc43bbee41486f974b8d7af6e
|
|
4
|
+
data.tar.gz: 32f664bba8e5dc4450919c6af6f19146a80d97ef9bc5db595cbd4800afd8d9e2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9fc34e6689bb4f67f3f14c764f2443764daf856b6b4c5be763b07bc9b4ab0003b3841fdb38c3120478dfc9e1f93d23462c8021c4d189ec9a4cf69a60c588200d
|
|
7
|
+
data.tar.gz: 71fae53f841ad1cb2ff31e3ca741d4d167643099daad5d270aac8aaac86732b3851c659d18974a707d51f01f4fae1eb7742324681d3ce7aca3b295ddd38776a2
|
data/lib/xcop/document.rb
CHANGED
|
@@ -103,6 +103,14 @@ class Xcop::Document
|
|
|
103
103
|
# Returns the set of namespace prefixes that are declared in +xml+
|
|
104
104
|
# but never referenced by any element or attribute. A +nil+ entry in
|
|
105
105
|
# the set represents the default namespace.
|
|
106
|
+
#
|
|
107
|
+
# A prefix counts as "used" not only when it appears as an element or
|
|
108
|
+
# attribute QName, but also when it is referenced from an attribute
|
|
109
|
+
# value as a +prefix:+ token. XSLT and XPath routinely mention a
|
|
110
|
+
# prefix only inside +select+, +test+, +match+, +as+, +use+ and
|
|
111
|
+
# similar attributes (e.g. +as="xs:integer"+ or +select="eo:foo()"+),
|
|
112
|
+
# so stripping such a "declared but not QName-used" prefix would break
|
|
113
|
+
# the stylesheet. See #161.
|
|
106
114
|
def unused(xml)
|
|
107
115
|
used = Set.new
|
|
108
116
|
declared = Set.new
|
|
@@ -111,6 +119,7 @@ class Xcop::Document
|
|
|
111
119
|
used << node.namespace.prefix if node.namespace
|
|
112
120
|
node.attribute_nodes.each do |attr|
|
|
113
121
|
used << attr.namespace.prefix if attr.namespace
|
|
122
|
+
attr.value.scan(/([A-Za-z_][\w.-]*):/) { |m| used << m.first }
|
|
114
123
|
end
|
|
115
124
|
node.namespace_definitions.each { |ns| declared << ns.prefix }
|
|
116
125
|
end
|
data/lib/xcop/version.rb
CHANGED