Skip to content

MIR-1540 migrate xeditor files to saxon compatibility#1283

Merged
yagee-de merged 12 commits intomainfrom
issues/MIR-1540_migrate_xeditor_xsl_to_saxon
Mar 13, 2026
Merged

MIR-1540 migrate xeditor files to saxon compatibility#1283
yagee-de merged 12 commits intomainfrom
issues/MIR-1540_migrate_xeditor_xsl_to_saxon

Conversation

@kkrebs
Copy link
Contributor

@kkrebs kkrebs commented Feb 25, 2026

Link to jira.

Work in progress:

  • derivate editor works again
  • XSL functions in MyCoRe needs stripHtml function
  • mods editor is not tested yet and work in progress

@kkrebs kkrebs marked this pull request as draft February 25, 2026 18:50
@kkrebs kkrebs force-pushed the issues/MIR-1540_migrate_xeditor_xsl_to_saxon branch 2 times, most recently from e34bc20 to add46e1 Compare February 27, 2026 17:51
@kkrebs kkrebs marked this pull request as ready for review February 27, 2026 17:51
@kkrebs kkrebs marked this pull request as draft February 27, 2026 17:57
@yagee-de yagee-de force-pushed the issues/MIR-1540_migrate_xeditor_xsl_to_saxon branch from 4f1a511 to bcfb6ba Compare March 13, 2026 07:51
@yagee-de yagee-de marked this pull request as ready for review March 13, 2026 09:26
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a9080dcc3d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@yagee-de
Copy link
Member

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ed6931c150

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@yagee-de
Copy link
Member

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 06ff8fd934

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@kkrebs
Copy link
Contributor Author

kkrebs commented Mar 13, 2026

we should put generic xslt functions to mycore in a next step
so far this is ok for me

🚢

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates MIR’s XEditor-related XSLT/XED resources from Xalan/XSLT 1.0 patterns to Saxon-compatible XSLT 3.0 by replacing Java extension calls with pure XSLT function modules and updating editor include URIs/configuration.

Changes:

  • Added new XSLT 3.0 function libraries (date conversion, editor utils, classification mapping/validation) and wired them via xslInclude:functions.
  • Updated editor transforms/templates (e.g., mods2xeditor, xeditor2mods, xeditor templates) to use the new functions and XSLT 3.0 constructs.
  • Added JUnit-based XSLT regression tests plus minimal classification fixtures to validate the new functions and key editor behaviors.

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
mir-module/src/test/resources/xslt/functions/mirvalidationhelper-test.xsl XSLT harness to exercise mirvalidationhelper functions in tests.
mir-module/src/test/resources/xslt/functions/mirmapper-test.xsl XSLT harness to exercise mirmapper functions in tests.
mir-module/src/test/resources/xslt/functions/mireditorutils-test.xsl XSLT harness to exercise mireditorutils functions in tests.
mir-module/src/test/resources/xslt/functions/mirdateconverter-test.xsl XSLT harness to exercise mirdateconverter functions in tests.
mir-module/src/test/resources/classification/SDNB.xml Test classification fixture for SDNB mapping/validation.
mir-module/src/test/resources/classification/MIRTestClassification.xml Test classification fixture for URI/category mapping scenarios.
mir-module/src/test/java/org/mycore/mir/xslt/XEditor2ModsXSLTest.java Regression tests for editor-save transform (xeditor2mods.xsl) behavior.
mir-module/src/test/java/org/mycore/mir/xslt/MIRXSLTFunctionTestCase.java Shared test base for XSLT transforms and result extraction.
mir-module/src/test/java/org/mycore/mir/xslt/MIRValidationHelperXSLTest.java Unit tests for mirvalidationhelper function module.
mir-module/src/test/java/org/mycore/mir/xslt/MIRMapperXSLTest.java Unit tests for mirmapper function module.
mir-module/src/test/java/org/mycore/mir/xslt/MIREditorUtilsXSLTest.java Unit tests for mireditorutils function module.
mir-module/src/test/java/org/mycore/mir/xslt/MIRDateConverterXSLTest.java Unit tests for mirdateconverter function module.
mir-module/src/main/resources/xslt/xeditor-mir-templates.xsl Migrates xeditor templates XSLT to 3.0 and integrates default params/functions.
mir-module/src/main/resources/xslt/functions/mirvalidationhelper.xsl New XSLT 3.0 validation helper functions (classification existence, SDNB validation).
mir-module/src/main/resources/xslt/functions/mirmapper.xsl New XSLT 3.0 classification mapping functions and SDNB/DDC mapping logic.
mir-module/src/main/resources/xslt/functions/mireditorutils.xsl New XSLT 3.0 editor utility functions (serialize, object-id validation, extent parsing).
mir-module/src/main/resources/xslt/functions/mirdateconverter.xsl New XSLT 3.0 date conversion and timezone normalization functions.
mir-module/src/main/resources/xslt/editor/xeditor2mods.xsl Migrates editor-save transform to XSLT 3.0 and new function modules.
mir-module/src/main/resources/xslt/editor/mods2xeditor.xsl Migrates editor-load transform to XSLT 3.0 and new function modules.
mir-module/src/main/resources/xslt/editor/mods-node-utils.xsl Replaces old Java-based escaping/stripping utilities with Saxon-compatible functions.
mir-module/src/main/resources/xslt/editor/mir2xeditor.xsl Updates editor UI transform to use new i18n/functions includes.
mir-module/src/main/resources/xslt/editor/derivate2xeditor.xsl Adjusts namespaces/excluded prefixes for Saxon/XSLT migration.
mir-module/src/main/resources/config/mir/mycore.properties Updates transformer stylesheets/includes to XSLT paths and adds xslIncludes.functions.
mir-module/src/main/resources/META-INF/resources/editor/editor-includes.xed Updates encoding and rewrites XEditor URIs/post-processor config for Saxon pipeline.
mir-module/src/main/resources/META-INF/resources/editor/editor-dynamic.xed Rewrites preload URI syntax for Saxon-compatible XEditor resolution.
mir-module/src/main/resources/META-INF/resources/editor/editor-derivate.xed Rewrites include URI syntax for Saxon-compatible XEditor resolution.
mir-module/src/main/resources/META-INF/resources/editor/editor-derivate-includes.xed Rewrites source/include URIs and post-processor config for Saxon pipeline.
mir-module/src/main/resources/META-INF/resources/editor/editor-admins.xed Rewrites preload URI syntax for Saxon-compatible XEditor resolution.
mir-module/src/main/resources/META-INF/resources/editor/change_genre.xed Rewrites source/include URI syntax for Saxon-compatible XEditor resolution.
Comments suppressed due to low confidence (2)

mir-module/src/main/resources/xslt/editor/mir2xeditor.xsl:12

  • default-parameters.xsl is included via a relative path, unlike the other XSLTs which use resource:xslt/default-parameters.xsl. Since default-parameters.xsl is not located in this directory, this include is likely to fail at runtime (missing resource). Use the same resource:xslt/default-parameters.xsl URI (or a correct relative path) to ensure the stylesheet can be compiled.
    mir-module/src/main/resources/xslt/editor/mods2xeditor.xsl:224
  • This mods:typeOfResource template copies only attributes and conditionally adds mcr:categId, but it never copies the element’s text/child nodes. That means the original typeOfResource value will be lost in the editor output, even when mcrmods:to-category(.) returns empty. Preserve the existing content (e.g., apply templates to node() and/or only override text when a category mapping exists).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

<xsl:function name="mirmapper:getSDNBfromDDC" as="xs:string">
<xsl:param name="ddc-string" as="xs:string?" />
<xsl:variable name="normalized" select="replace(normalize-space($ddc-string), '[^0-9.]', '')" />
<xsl:variable name="ddc" select="if ($normalized != '') then xs:decimal($normalized) else ()" />
Copy link
Member

@rsteph-de rsteph-de left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some smaller issues after first reading ...

@yagee-de yagee-de requested a review from rsteph-de March 13, 2026 16:58
@yagee-de yagee-de merged commit fcaa5bb into main Mar 13, 2026
2 checks passed
@yagee-de yagee-de deleted the issues/MIR-1540_migrate_xeditor_xsl_to_saxon branch March 13, 2026 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants