Add support to the Optional attribute for the Conditional tag#31
Open
Xiphereal wants to merge 1 commit into
Open
Add support to the Optional attribute for the Conditional tag#31Xiphereal wants to merge 1 commit into
Xiphereal wants to merge 1 commit into
Conversation
Author
|
Any updates? |
Author
|
Any news on the subject @EricWhiteDev ? |
huan086
pushed a commit
to huan086/Open-Xml-PowerTools
that referenced
this pull request
Sep 17, 2024
Enabled system.drawing.common compatible in tests
github-actions Bot
added a commit
to sergey-tihon/Clippit
that referenced
this pull request
Jul 3, 2026
…ional directive Port of OpenXmlDev/Open-Xml-PowerTools#31. When Optional="true" is set on a Conditional directive, a missing XPath node is treated as an empty string for Match/NotMatch evaluation instead of throwing an error. Without Optional, missing nodes continue to produce a template error as before. Changes: - Clippit/Word/DocumentAssembler.cs: add Optional attr to Conditional XSD schema; read optional flag and pass to EvaluateXPathToString - Clippit.Tests/Word/DocumentAssemblerTests.cs: 4 tests covering: - Optional=true + missing node + Match="" → content included - Optional=true + missing node + Match="x" → content excluded - No Optional + missing node → template error (regression guard) - Optional=true + present node → normal match behavior Closes #382 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
sergey-tihon
pushed a commit
to sergey-tihon/Clippit
that referenced
this pull request
Jul 3, 2026
…er Conditional directive (#395) * fix(word): add Optional attribute support to DocumentAssembler Conditional directive Port of OpenXmlDev/Open-Xml-PowerTools#31. When Optional="true" is set on a Conditional directive, a missing XPath node is treated as an empty string for Match/NotMatch evaluation instead of throwing an error. Without Optional, missing nodes continue to produce a template error as before. Changes: - Clippit/Word/DocumentAssembler.cs: add Optional attr to Conditional XSD schema; read optional flag and pass to EvaluateXPathToString - Clippit.Tests/Word/DocumentAssemblerTests.cs: 4 tests covering: - Optional=true + missing node + Match="" → content included - Optional=true + missing node + Match="x" → content excluded - No Optional + missing node → template error (regression guard) - Optional=true + present node → normal match behavior Closes #382 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix(word): guard Conditional Optional parsing and update changelog * docs(word): mention Conditional Optional support in DocumentAssembler tutorial --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In this PR I've added support for the
Optionalattribute for theConditionaltag in theDocumentAssembler.This modification comes from the need of being able to have a
SelectwithXPathselecting a (sometimes) missing node from the data XML.