Update XSLT and XPath inspections messages.

GitOrigin-RevId: d4cb3e4b7d94144d96dd4b08638a61a42c58c354
This commit is contained in:
Piotr Tomiak
2021-04-12 12:00:48 +00:00
committed by intellij-monorepo-bot
parent 24f710d6b5
commit 2132c79c77
9 changed files with 34 additions and 32 deletions
@@ -16,8 +16,8 @@
<body>
<p>
This inspection checks whether any element/attribute names that are used in XPath-expressions are actually part of an
associated XML file or are defined in a referenced schema. This helps to avoid problems caused by typos in
Reports any element or attribute names that are used in XPath-expressions, which are not part of an
associated XML file and are not defined in a referenced schema. This helps to avoid problems caused by typos in
XPath-expressions that would otherwise occur when running the script and may even then not be recognized immediately.
</p>
@@ -16,7 +16,7 @@
<body>
<p>
This inspection checks for comparisons of the <tt>name()</tt>-function against strings that contain a ":" - which
Reports comparisons of the <code>name()</code> function against strings that contain a ':', which
usually indicates a hardwired namespace-prefix in the comparison. Such code will break when run against XML that
uses a different prefix for the same namespace.
</p>
@@ -16,9 +16,9 @@
<body>
<p>
This inspection checks for any implicit conversions between the predefined XPath-types STRING, NUMBER, BOOLEAN and
NODESET. While this is usually not a problem as the conversions are well-defined by the standard, this inspection can
help to write XSLT scripts that are more expressive about types and can even help to avoid subtle bugs:
Reports any implicit conversions between the predefined XPath-types <code>STRING</code>, <code>NUMBER</code>, <code>BOOLEAN</code>
and <code>NODESET</code>. While this is usually not a problem as the conversions are well-defined by the standard,
this inspection can help to write XSLT scripts that are more expressive about types and can even help to avoid subtle bugs:
</p>
<p>
@@ -16,8 +16,8 @@
<body>
<p>
This inspection checks for any accidental use of zero in a predicate index or in a comparision with the function
<code>position()</code>. Such is almost always a bug because in XPath, the index starts at one, <em>not</em> at zero.
Reports accidental usage of zero in a predicate index or in a comparison with the function
<code>position()</code>. Such usage is almost always a bug because in XPath, the index starts at one, <em>not</em> at zero.
</p>
<p>
@@ -16,8 +16,8 @@
<body>
<p>
This inspection checks whether any type-conversion with the functions <code>string()</code>, <code>number()</code> or
<code>boolean()</code> is redundant, i.e. whether the type of argument is the same as the functions return type or if
Reports type-conversions with functions <code>string()</code>, <code>number()</code> or
<code>boolean()</code>, which are redundant. I.e. whether the type of argument is the same as the functions return type or if
the expected type of the expression is of type "any". While such an explicit conversion may sometimes be intentional
to emphasize the type, this can usually be safely removed.
</p>
@@ -16,7 +16,7 @@
<body>
<p>
This inspection checks for problems in invocations of named XSLT templates, such as missing arguments, passing
Reports problems in invocations of named XSLT templates, such as missing arguments, passing
arguments that are not declared by the template or passing an argument for a certain parameter more than once.
</p>
@@ -25,7 +25,6 @@
invocation does not specify an argument for such parameters.
</p>
<p id="footer">Powered by XPathView + XSLT-Support</p>
</body>
</html>
@@ -16,7 +16,7 @@
<body>
<p>
This inspections checks for shadowed XSLT variables which can lead to possibly undesired effects.
Reports shadowed XSLT variables which can lead to possibly undesired effects.
</p>
<p id="footer">Powered by XPathView + XSLT-Support</p>
@@ -101,7 +101,7 @@ dialog.message.cannot.perform.refactoring=Cannot perform refactoring.\n{0}
dialog.message.custom.functions.require.prefixed.name=Custom functions require a prefixed name
dialog.message.error.in.xpath.expression.for.variable=Error in XPath Expression for Variable ''{0}'': {1}
dialog.message.error.while.evaluating.xpath=Error while evaluating XPath:\n{0}
dialog.message.expression.produced=Expression produced
dialog.message.expression.produced=Expression produced
dialog.message.function.name=Function name:
dialog.message.inline.local.variable=Inline {0} ''{1}''? ({2} local {2, choice, 1#occurrence|1<occurrences})\n\nWarning: It is being used in external files. Its declaration will not be removed.
dialog.message.inline.variable=Inline {0} ''{1}''? ({2} {2, choice, 1#occurrence|1<occurrences})
@@ -118,7 +118,7 @@ dialog.message.selected.output.file.points.to.directory=Selected output file poi
dialog.message.selected.xml.input.file.not.found=Selected XML input file not found
dialog.message.selected.xslt.file.not.found=Selected XSLT file not found
dialog.message.sorry.your.expression.did.not.return.any.result=Sorry, your expression did not return any result
dialog.message.template.name=Template name:
dialog.message.template.name=Template name:
dialog.message.x.has.no.value={0} ''{1}'' has no value.
dialog.title.choose.output.file=Choose Output File
dialog.title.choose.xml.file=Choose XML File
@@ -167,7 +167,8 @@ inspection.message.duplicates.declaration.from=Duplicates declaration from ''{0}
inspection.message.empty.name.not.permitted=Empty name not permitted
inspection.message.expression.should.be.type=Expression should be of type ''{0}''
inspection.message.hardwired.namespace.prefix=Hardwired namespace prefix
inspection.message.html.unknown.name.html=<html>Unknown {0} name {1}</html>
inspection.message.html.unknown.attribute.name.html=Unknown attribute name {0}
inspection.message.html.unknown.element.name.html=Unknown element name {0}
inspection.message.illegal.name=Illegal name
inspection.message.missing.template.parameter=Missing template parameter: {0}
inspection.message.never.used={0} ''{1}'' is never used
@@ -179,15 +180,15 @@ inspection.message.undefined.mode=Undefined mode ''{0}''
inspection.message.unknown.type=Unknown type
inspection.message.use.of.0.as.predicate.index=Use of 0 as predicate index
inspection.message.variable.shadows.variable={0, choice, 0#Parameter|1#Variable} ''{1}'' shadows {2, choice, 0#parameter|1#variable}
inspection.xpath.check.node.test.display.name=Check node test
inspection.xpath.hardwired.namespace.prefix.display.name=Hardwired namespace prefix
inspection.xpath.check.node.test.display.name=Unknown element or attribute name
inspection.xpath.hardwired.namespace.prefix.display.name=Hardcoded namespace prefix
inspection.xpath.implicit.type.conversion.display.name=Implicit type conversion
inspection.xpath.index.zero.usage.display.name=Use of index 0 in XPath predicates
inspection.xpath.index.zero.usage.display.name=XPath predicate with index 0
inspection.xpath.redundant.type.conversion.display.name=Redundant type conversion
inspection.xslt.declarations.display.name=Declaration problems
inspection.xslt.template.invocation.display.name=Template invocation problems
inspection.xslt.unused.declaration.display.name=Unused variable/parameter
inspection.xslt.variable.shadowing.display.name=Variable shadowing
inspection.xslt.declarations.display.name=Incorrect declaration
inspection.xslt.template.invocation.display.name=Incorrect template invocation
inspection.xslt.unused.declaration.display.name=Unused variable or parameter
inspection.xslt.variable.shadowing.display.name=Shadowed variable
inspections.xpath.group.name=XPath
inspections.xslt.group.name=XSLT
intention.family.name.add.argument=Add argument
@@ -232,10 +233,10 @@ label.classpath.and.jdk=Classpath and JDK:
label.disabled=Disabled
label.enter.an.xpath.expression=Enter an XPath expression:
label.enter.the.prefix.and.uri.of.the.namespace.to.add=Enter the Prefix and URI of the Namespace to add:
label.expression.is.of.type=Expression is of type:
label.expression.is.of.type=Expression is of type:
label.highlight.output.as=Highlight output as:
label.html.from.hr.center.to.center.html=<html>From <hr> <center>To</center></html>
label.name1=&Name:
label.name1=&Name:
label.name=Name
label.prefix1=&Prefix:
label.prefix=Prefix
@@ -89,7 +89,7 @@ public class CheckNodeTest extends XPathInspection {
}
}
if (!found) {
registerProblem(contextProvider, prefixedName, nodeTest, "element");
registerProblem(contextProvider, prefixedName, nodeTest, false);
}
}
} else if (nodeTest.getPrincipalType() == XPathNodeTest.PrincipalType.ATTRIBUTE) {
@@ -103,7 +103,7 @@ public class CheckNodeTest extends XPathInspection {
}
}
if (!found) {
registerProblem(contextProvider, prefixedName, nodeTest, "attribute");
registerProblem(contextProvider, prefixedName, nodeTest, true);
}
}
}
@@ -111,24 +111,26 @@ public class CheckNodeTest extends XPathInspection {
}
}
private void registerProblem(ContextProvider contextProvider, PrefixedName prefixedName, XPathNodeTest nodeTest, String type) {
private void registerProblem(ContextProvider contextProvider, PrefixedName prefixedName, XPathNodeTest nodeTest, boolean attribute) {
final QName qName = contextProvider.getQName(prefixedName, nodeTest);
final String name;
if (qName != null) {
final String pattern;
if (!"".equals(qName.getNamespaceURI())) {
pattern = "''<b>{0}</b>'' (<i>{1}</i>)";
pattern = "''{0}'' ({1})";
} else {
pattern = "''<b>{0}</b>''";
pattern = "''{0}''";
}
name = MessageFormat.format(pattern, qName.getLocalPart(), qName.getNamespaceURI());
} else {
name = MessageFormat.format("''<b>{0}</b>''", prefixedName.getLocalName());
name = MessageFormat.format("''{0}''", prefixedName.getLocalName());
}
final LocalQuickFix[] fixes = contextProvider.getQuickFixFactory().createUnknownNodeTestFixes(nodeTest);
addProblem(myManager.createProblemDescriptor(nodeTest,
XPathBundle.message("inspection.message.html.unknown.name.html", type, name),
XPathBundle.message(attribute ? "inspection.message.html.unknown.attribute.name.html"
: "inspection.message.html.unknown.element.name.html",
name),
myOnTheFly, fixes, ProblemHighlightType.GENERIC_ERROR_OR_WARNING));
}