Skip to content

Conversation

@BartChris
Copy link
Collaborator

@BartChris BartChris commented Oct 27, 2025

Adresses #6730

The XSL logic for the import uses more complex structures then the one for the export.

Export:

static ByteArrayOutputStream transformXmlByXslt(StreamSource source, URI xslFile)

Import:

private String transformXmlByXslt(String xmlString, InputStream stylesheetFile) {

It also fails in resolving external files during the XSL based import. (See #6730). I tried to simplify the import XSL logic by making it more similar to the export logic. Have not stumbled over problems so far. External files are now also supported during import XSL transformations.

@BartChris BartChris force-pushed the 3-9-import_xsl_transform branch 2 times, most recently from e2d1b65 to 9e6db4f Compare October 27, 2025 14:29
@BartChris BartChris force-pushed the 3-9-import_xsl_transform branch from 9e6db4f to 9f04546 Compare October 27, 2025 14:32
@BartChris BartChris changed the title Simplify Import XSL and allow usage of external files [3.9] Simplify Import XSL and allow usage of external files Oct 27, 2025
@BartChris BartChris marked this pull request as ready for review October 27, 2025 14:47
@BartChris
Copy link
Collaborator Author

BartChris commented Oct 27, 2025

I tested with this simple mapping file:

mapping.xml

<mappings>
    <map from="#test" to="external mapping works"/>
</mappings>

xsl-file:

<xsl:variable name="mapping-root" select="document('mapping.xml')/mappings"/>

<xsl:variable name="testMap" select="$mapping-root/map[@from='#test']/@to"/>
<kitodo:metadata name="MappingTest">
   <xsl:value-of select="if ($testMap) then $testMap else 'mapping.xml not loaded'"/>
</kitodo:metadata>

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.

1 participant