You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "davsclaus (via GitHub)" <gi...@apache.org> on 2026/10/10 05:59:26 UTC
[PR] CAMEL-25514: camel-jbang - the validator notes a {expression} in element text of an XSLT stylesheet [camel]
davsclaus opened a new pull request, #27648:
URL: https://github.com/apache/camel/pull/27648
[CAMEL-25514](https://issues.apache.org/jira/browse/CAMEL-25514)
An attribute value template is evaluated only in an attribute value. In element content of an XSLT 1.0 or 2.0 stylesheet (camel-xslt is XSLT 1.0), `<pieces>{sum(line/@qty)}</pieces>` writes the braces and the expression out as text, with no error. A local model wrote exactly this in the benchmark's transform-xslt example and did not find the cause in 20 tool calls.
**Change**
- A write, an edit or `camel_validate_source` of a `.xsl` / `.xslt` file answers with a note - it does not refuse the write - for text in an output element (not an `xsl:` instruction) holding a `{expression}` that reads as XPath (a function call, a path, an attribute or a variable): *"<pieces> holds the text {sum(line/@qty)}, which is written out as it is: a {expression} is evaluated only in an attribute value; in element content write <xsl:value-of select="sum(line/@qty)"/>"*.
- Left alone: braces in attribute values (evaluated), braces around text with quotes (JSON the stylesheet writes), `xsl:text`, a plain word in braces, and stylesheets with `expand-text` (XSLT 3.0 text value templates).
- The camel-jbang monitor's own write gives the note too.
Tests: `SourceValidatorJavaXsltTest` (the note; the five cases left alone); camel-jbang-core suite (1628) and the monitor's `McpFacadeWriteFileTest` green.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-25514: camel-jbang - the validator notes a {expression} in element text of an XSLT stylesheet [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27648:
URL: https://github.com/apache/camel/pull/27648#issuecomment-6094442637
:star2: Thank you for your contribution to the Apache Camel project! :star2:
:robot: CI automation will test this PR automatically.
:camel: Apache Camel Committers, please review the following items:
* First-time contributors **require MANUAL approval** for the GitHub Actions to run
* You can use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot although they are normally detected and executed by CI.
* You can label PRs using `skip-tests` and `test-dependents` to fine-tune the checks executed by this PR.
* Build and test logs are available in the summary page. **Only** [Apache Camel committers](https://camel.apache.org/community/team/#committers) have access to the summary.
:warning: Be careful when sharing logs. Review their contents before sharing them publicly.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-25514: camel-jbang - the validator notes a {expression} in element text of an XSLT stylesheet [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27648:
URL: https://github.com/apache/camel/pull/27648#issuecomment-6094732997
<!-- ci-tested-modules -->
:test_tube: **CI tested the following changed modules:**
- `dsl/camel-jbang/camel-jbang-core`
- `dsl/camel-jbang/camel-jbang-plugin-tui`
---
<details><summary>:microscope: Scalpel shadow comparison — Scalpel: 6 of 704 tested, 8 compile-only — current: 6 all tested</summary>
[Maveniverse Scalpel](https://github.com/maveniverse/scalpel) detected **6 affected modules** (current approach: 6).
**Skip-tests mode would test 6 modules** (2 direct + 5 downstream), **skip tests for 8** (generated code, meta-modules)
<details><summary>Modules Scalpel would test (6)</summary>
- `camel-jbang-mcp` ← downstream of org.apache.camel:camel-jbang-core
- `camel-jbang-plugin-mcp` ← downstream of org.apache.camel:camel-jbang-core
- `camel-jbang-plugin-route-parser` ← downstream of org.apache.camel:camel-jbang-core
- `camel-jbang-plugin-tui` ← dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/McpFacade.java
- `camel-jbang-plugin-validate` ← downstream of org.apache.camel:camel-jbang-core
- `camel-launcher-container` ← downstream of org.apache.camel:camel-launcher
</details>
<details><summary>Modules with tests skipped (8)</summary>
- `camel-jbang-it`
- `camel-jbang-main`
- `camel-jbang-plugin-edit`
- `camel-jbang-plugin-generate`
- `camel-jbang-plugin-kubernetes`
- `camel-jbang-plugin-test`
- `camel-launcher`
- `coverage`
</details>
> :information_source: Shadow mode — Scalpel observes but does not affect test execution. [Learn more](https://github.com/maveniverse/scalpel)
</details>
:warning: **Some tests are disabled on GitHub Actions** (`@DisabledIfSystemProperty(named = "ci.env.name")`) and require manual verification:
- `dsl/camel-jbang/camel-jbang-core`: 2 test(s) disabled on GitHub Actions
:bulb: **Manual integration tests recommended:**
> You modified `dsl/camel-jbang/camel-jbang-core`. The related integration tests in `dsl/camel-jbang/camel-jbang-it` are excluded from CI. Consider running them manually:
> ```
> mvn verify -f dsl/camel-jbang/camel-jbang-it -Djbang-it-test
> ```
<details><summary>All tested modules (15 modules, 2m 53s total)</summary>
**Total reactor time:** 2m 53s
| Module | Duration | Status |
| --- | --- | --- |
| Camel :: Launcher | 54.1s | SUCCESS |
| Camel :: JBang :: MCP | 44.3s | SUCCESS |
| Camel :: JBang :: Plugin :: Kubernetes | 27.2s | SUCCESS |
| Camel :: JBang :: Plugin :: Validate | 21.2s | SUCCESS |
| Camel :: JBang :: Plugin :: Testing | 11.0s | SUCCESS |
| Camel :: Coverage | 5.6s | SUCCESS |
| Camel :: JBang :: Plugin :: MCP | 1.8s | SUCCESS |
| Camel :: JBang :: Plugin :: Generate | 1.8s | SUCCESS |
| Camel :: JBang :: Plugin :: Edit | 1.6s | SUCCESS |
| Camel :: JBang :: Plugin :: Route Parser | 1.5s | SUCCESS |
| Camel :: JBang :: Main | 1.0s | SUCCESS |
| Camel :: JBang :: Integration tests | 1.0s | SUCCESS |
| Camel :: Launcher :: Container | 0.8s | SUCCESS |
| Camel :: JBang :: Core | n/a | |
| Camel :: JBang :: Plugin :: TUI | n/a | |
**Top 20 slowest modules:**
- `Camel :: Launcher` (54.1s)
- `Camel :: JBang :: MCP` (44.3s)
- `Camel :: JBang :: Plugin :: Kubernetes` (27.2s)
- `Camel :: JBang :: Plugin :: Validate` (21.2s)
- `Camel :: JBang :: Plugin :: Testing` (11.0s)
- `Camel :: Coverage` (5.6s)
- `Camel :: JBang :: Plugin :: MCP` (1.8s)
- `Camel :: JBang :: Plugin :: Generate` (1.8s)
- `Camel :: JBang :: Plugin :: Edit` (1.6s)
- `Camel :: JBang :: Plugin :: Route Parser` (1.5s)
- `Camel :: JBang :: Main` (1.0s)
- `Camel :: JBang :: Integration tests` (1.0s)
- `Camel :: Launcher :: Container` (0.8s)
</details>
---
:gear: [View full build and test results](https://github.com/apache/camel/actions/runs/38029993271)
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-25514: camel-jbang - the validator notes a {expression} in element text of an XSLT stylesheet [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-25514: camel-jbang - the validator notes a {expression} in element text of an XSLT stylesheet [camel]
Posted by "gnodet-bot (via GitHub)" <gi...@apache.org>.
gnodet-bot commented on code in PR #27648:
URL: https://github.com/apache/camel/pull/27648#discussion_r4236657692
##########
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:
💡 **Nit:** `content.contains("expand-text")` is a raw string search over the entire document — a comment like `<!-- see expand-text docs -->` or an unrelated attribute would silently suppress all brace checks for the file. Per the Javadoc this is intentional: any mention of `expand-text` signals an XSLT 3.0 stylesheet where text value templates are valid. Worth a one-line comment to that effect so a future contributor doesn't "fix" this to a DOM-level check without also updating `collectLiteralBraces` to handle per-element `xsl:expand-text` attributes:
```suggestion
if (content == null || content.isBlank() || content.contains("expand-text")) {
// coarse on purpose: any occurrence of expand-text signals XSLT 3.0, where {expr} in element
// content is valid (text value templates). A DOM-level refinement would also need to check
// xsl:expand-text per-element inside collectLiteralBraces.
return notes;
}
```
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-25514: camel-jbang - the validator notes a {expression} in element text of an XSLT stylesheet [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus merged PR #27648:
URL: https://github.com/apache/camel/pull/27648
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org