davsclaus commented on code in PR #27648:
URL: https://github.com/apache/camel/pull/27648#discussion_r4236660637
##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/XmlChecks.java:
##########
@@ -187,4 +187,52 @@ public static List<String> validateXml(String content) {
return msgs;
}
+ private static final String XSL_NS =
"http://www.w3.org/1999/XSL/Transform";
+ /** A {...} in text that reads as an XPath expression: a function call, a
path, an attribute or a variable. */
+ private static final Pattern LITERAL_BRACES =
Pattern.compile("\\{([^{}\"']*(?:\\w\\(|/|@|\\$)[^{}\"']*)}");
+
+ /**
+ * Text in an element the stylesheet writes out (not inside an xsl:
instruction) that holds a {expression}: in XSLT
+ * 1.0 and 2.0 an attribute value template is evaluated only in an
attribute value, so in element content the braces
+ * and the expression are written as they are, with no error
(CAMEL-25514). Not reported when the stylesheet turns
+ * on expand-text (XSLT 3.0), nor for braces around text with quotes (JSON
written by the stylesheet).
+ */
+ static List<String> literalBraceNotes(String content) {
+ List<String> notes = new ArrayList<>();
+ if (content == null || content.isBlank() ||
content.contains("expand-text")) {
Review Comment:
Added in 3bf7fcf42db8: a comment that the check is coarse on purpose.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]