Skip to content

Xslt 3.0 larva tests break in newer versions #10139

@lenardvandermaas

Description

@lenardvandermaas

Current Behavior

when using the XsltProviderListener with an xslt 3.0 stylesheet in larva, the output is not the same as in older versions. The only change to the test scenario is adding the configurationName property to reference an xslt that is in the configuration directory.

Expected Behavior

I would expect the output to be the same as in older versions

Environment Information

version 9.2 or higher I think. I didn't test exactly which version this problem first appears, but I know it worked fine in 9.1.1-20250513.130355

Steps To Reproduce

scenario 9.1.1-20250513.130355

scenario.description =

include =../common.properties

zaakbrug.ApplyValueOverrides.className = nl.nn.adapterframework.testtool.XsltProviderListener
zaakbrug.ApplyValueOverrides.filename = Translate/Common/xsl/ResolveDynamicValuesWithExtraElementenContext.xslt
step1.zaakbrug.ApplyValueOverrides.read = ResolveDynamicValuesWithEmptyExtraElementShouldResultInPreValueOverrideValue/in.xml
step1.zaakbrug.ApplyValueOverrides.read.param1.name = ExtraElementenContext
step1.zaakbrug.ApplyValueOverrides.read.param1.valuefile = ResolveDynamicValuesWithEmptyExtraElementShouldResultInPreValueOverrideValue/context.xml
step1.zaakbrug.ApplyValueOverrides.read.param1.type = domdoc
step1.zaakbrug.ApplyValueOverrides.read.param2.name = PreValueOverridesContext
step1.zaakbrug.ApplyValueOverrides.read.param2.valuefile = ResolveDynamicValuesWithEmptyExtraElementShouldResultInPreValueOverrideValue/PreValueOverridesContext.xml
step1.zaakbrug.ApplyValueOverrides.read.param2.type = domdoc
step1.zaakbrug.ApplyValueOverrides.read.param3.name = debug
step1.zaakbrug.ApplyValueOverrides.read.param3.value = false
step2.zaakbrug.ApplyValueOverrides.write = ResolveDynamicValuesWithEmptyExtraElementShouldResultInPreValueOverrideValue/out.xml

Scenario 9.2.2-20251110.093214

scenario.description =

include =../common.properties

zaakbrug.ApplyValueOverrides.className = nl.nn.adapterframework.testtool.XsltProviderListener
zaakbrug.ApplyValueOverrides.filename = /Common/xsl/ResolveDynamicValuesWithExtraElementenContext.xslt
zaakbrug.ApplyValueOverrides.configurationName = Translate
step1.zaakbrug.ApplyValueOverrides.read = ResolveDynamicValuesWithEmptyExtraElementShouldResultInPreValueOverrideValue/in.xml
step1.zaakbrug.ApplyValueOverrides.read.param1.name = ExtraElementenContext
step1.zaakbrug.ApplyValueOverrides.read.param1.valuefile = ResolveDynamicValuesWithEmptyExtraElementShouldResultInPreValueOverrideValue/context.xml
step1.zaakbrug.ApplyValueOverrides.read.param1.type = domdoc
step1.zaakbrug.ApplyValueOverrides.read.param2.name = PreValueOverridesContext
step1.zaakbrug.ApplyValueOverrides.read.param2.valuefile = ResolveDynamicValuesWithEmptyExtraElementShouldResultInPreValueOverrideValue/PreValueOverridesContext.xml
step1.zaakbrug.ApplyValueOverrides.read.param2.type = domdoc
step1.zaakbrug.ApplyValueOverrides.read.param3.name = debug
step1.zaakbrug.ApplyValueOverrides.read.param3.value = false
step2.zaakbrug.ApplyValueOverrides.write = ResolveDynamicValuesWithEmptyExtraElementShouldResultInPreValueOverrideValue/out.xml

xslt

<xsl:stylesheet version="3.0" exclude-result-prefixes="#all" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:map="http://www.w3.org/2005/xpath-functions/map" xmlns:array="http://www.w3.org/2005/xpath-functions/array">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="yes" />
    <xsl:strip-space elements="*"/>

    <xsl:param name="ExtraElementenContext" as="node()?"><xsl:document /></xsl:param>
	<xsl:param name="PreValueOverridesContext" as="node()?"><xsl:document /></xsl:param>

    <xsl:param name="debug" as="xs:string" select="'false'" />
	<xsl:variable name="debugSerializeParams" as="map(xs:string, item()?)">
		<xsl:map>
			<xsl:map-entry key="'indent'" select="true()"/>
		</xsl:map>
	</xsl:variable>

	<xsl:key name="valueOverrideKey" match="valueOverrides" use="key" />

	<xsl:template match="@*|node()">
		<xsl:copy>
			<xsl:apply-templates select="@*|node()" />
		</xsl:copy>
	</xsl:template>

	<xsl:template match="/">
		<xsl:apply-templates />
	</xsl:template>

	<xsl:template match="*[contains(text(), '${extraElementen:')]">
		<xsl:if test="$debug = 'true'"><xsl:comment expand-text="yes"> matchOnSubstitutionSection: [{serialize(., $debugSerializeParams)}] </xsl:comment></xsl:if>

		<xsl:variable name="substitutionAction" select="substring-before(substring-after(., '${extraElementen:'), '}')" />
		<xsl:if test="$debug = 'true'"><xsl:comment expand-text="yes"> substitutionAction: [{serialize($substitutionAction, $debugSerializeParams)}] </xsl:comment></xsl:if>

		<xsl:variable name="resolvedSubstitutionAction">
			<xsl:call-template name="resolveSubstitutionAction">
				<xsl:with-param name="action" as="xs:string" select="$substitutionAction" />
			</xsl:call-template>
		</xsl:variable>
		<xsl:if test="$debug = 'true'"><xsl:comment expand-text="yes"> resolvedSubstitutionSection: [{serialize($resolvedSubstitutionAction, $debugSerializeParams)}] </xsl:comment></xsl:if>

		<!-- In ZDS usually the absence of an element means: ignore it/keep it the same as it was before. An empty element with xsi:nil="true" StUF:noValue="geenWaarde" is an explicit "set as empty value".
			For UpdateZaak ZGW PATCH we need to makes sure that the absence of an extraElement is handled as if the valueOverride doesn't exist. Without this logic the absence of extraElement would overwrite
			defaults or composite values from the ZDS to ZGW translation with an empty string. Therefor, if the extraElement is absent or empty, copy the pre-valueOverride value back in, unless it has been explicitly
			flagged to be set to an empty string with xsi:nil="true" StUF:noValue="geenWaarde" -->
		<xsl:choose>
			<xsl:when test="$resolvedSubstitutionAction/*:extraElement/@*:nil = 'true' or $resolvedSubstitutionAction/*:extraElement/text() != ''">
				<xsl:copy select=".">
					<xsl:value-of select="$resolvedSubstitutionAction/*:extraElement" />
				</xsl:copy>
			</xsl:when>
			<xsl:otherwise>
					<xsl:if test="$debug = 'true'"><xsl:comment expand-text="yes"> xpath: [{serialize(path(), $debugSerializeParams)}] </xsl:comment></xsl:if>
					<xsl:evaluate context-item="$PreValueOverridesContext" xpath="path()"></xsl:evaluate>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="resolveSubstitutionAction">
		<xsl:param name="action" as="xs:string" />

		<xsl:variable name="xpathExpression" as="xs:string" select="concat('//*:extraElementen/*:extraElement[@*:naam=''', $action, ''']')" />
		<xsl:if test="$debug = 'true'"><xsl:comment expand-text="yes"> xpathExpression: [{serialize($xpathExpression, $debugSerializeParams)}] </xsl:comment></xsl:if>

		<xsl:variable name="xpathExpressionResult"><xsl:evaluate xpath="$xpathExpression" context-item="$ExtraElementenContext" /></xsl:variable>
		<xsl:if test="$debug = 'true'"><xsl:comment expand-text="yes"> xpathExpressionnResult: [{serialize($xpathExpressionResult, $debugSerializeParams)}] </xsl:comment></xsl:if>

		<xsl:copy-of select="$xpathExpressionResult" />
	</xsl:template>
</xsl:stylesheet>

Input

<zgwRol>
	<betrokkeneIdentificatie>
		<ann.identificatie>${extraElementen:kvkNummer}</ann.identificatie>
		<authentiek>N</authentiek>
		<geslachtsnaam>fromValueOverride</geslachtsnaam>
		<innNnpId>823288444</innNnpId>
		<innRechtsvorm>overig_privaatrechtelijke_rechtspersoon</innRechtsvorm>
		<statutaireNaam>Gemeente Súdwest-Fryslân</statutaireNaam>
	</betrokkeneIdentificatie>
	<betrokkeneType>niet_natuurlijk_persoon</betrokkeneType>
	<omschrijving>Initiator</omschrijving>
	<omschrijvingGeneriek>initiator</omschrijvingGeneriek>
	<roltoelichting>Initiator:Gemeente Súdwest-Fryslân</roltoelichting>
	<roltype>http://open-zaak.nginx:9001/catalogi/api/v1/roltypen/a892d249-d866-417b-bc88-8d1287da7de8</roltype>
</zgwRol>

Param ExtraElementenContext

<ZKN:heeftAlsInitiator StUF:entiteittype="ZAKBTRINI" StUF:verwerkingssoort="T" xmlns:StUF="http://www.egem.nl/StUF/StUF0301" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:BG="http://www.egem.nl/StUF/sector/bg/0310" xmlns:ZKN="http://www.egem.nl/StUF/sector/zkn/0310">
    <ZKN:gerelateerde>
        <ZKN:nietNatuurlijkPersoon StUF:entiteittype="NNP" StUF:verwerkingssoort="T">
            <BG:inn.nnpId>823288444</BG:inn.nnpId>
            <BG:authentiek StUF:metagegeven="true">N</BG:authentiek>
            <BG:statutaireNaam>Gemeente Súdwest-Fryslân</BG:statutaireNaam>
            <!--<BG:inn.rechtsvorm
            xsi:nil="true" StUF:noValue="geenWaarde"/>-->
            <BG:inn.rechtsvorm>Eenmanszaak</BG:inn.rechtsvorm>
            <BG:bezoekadres>
                <BG:aoa.identificatie>0091200000046730</BG:aoa.identificatie>
                <BG:authentiek StUF:metagegeven="true">J</BG:authentiek>
                <BG:wpl.woonplaatsNaam>Sneek</BG:wpl.woonplaatsNaam>
                <BG:gor.openbareRuimteNaam>Marktstraat</BG:gor.openbareRuimteNaam>
                <BG:gor.straatnaam>Marktstraat</BG:gor.straatnaam>
                <BG:aoa.postcode>8601CR</BG:aoa.postcode>
                <BG:aoa.huisnummer>15</BG:aoa.huisnummer>
                <BG:aoa.huisletter xsi:nil="true" StUF:noValue="geenWaarde" />
                <BG:aoa.huisnummertoevoeging />
                <BG:inp.locatiebeschrijving xsi:nil="true" StUF:noValue="geenWaarde" />
            </BG:bezoekadres>
        </ZKN:nietNatuurlijkPersoon>
    </ZKN:gerelateerde>
    <StUF:extraElementen>
        <StUF:extraElement naam="kvkNummer" />
    </StUF:extraElementen>
</ZKN:heeftAlsInitiator>

Param PreValueOverridesContext

<zgwRol>
	<betrokkeneIdentificatie>
		<ann.identificatie>this is the pre-override value</ann.identificatie>
		<authentiek>N</authentiek>
		<geslachtsnaam>fromValueOverride</geslachtsnaam>
		<innNnpId>823288444</innNnpId>
		<innRechtsvorm>overig_privaatrechtelijke_rechtspersoon</innRechtsvorm>
		<statutaireNaam>Gemeente Súdwest-Fryslân</statutaireNaam>
	</betrokkeneIdentificatie>
	<betrokkeneType>niet_natuurlijk_persoon</betrokkeneType>
	<omschrijving>Initiator</omschrijving>
	<omschrijvingGeneriek>initiator</omschrijvingGeneriek>
	<roltoelichting>Initiator:Gemeente Súdwest-Fryslân</roltoelichting>
	<roltype>http://open-zaak.nginx:9001/catalogi/api/v1/roltypen/a892d249-d866-417b-bc88-8d1287da7de8</roltype>
</zgwRol>

Param debug: false

Output 9.1.1-20250513.130355

<zgwRol>
    <betrokkeneIdentificatie>
        <ann.identificatie>this is the pre-override value</ann.identificatie>
        <authentiek>N</authentiek>
        <geslachtsnaam>fromValueOverride</geslachtsnaam>
        <innNnpId>823288444</innNnpId>
        <innRechtsvorm>overig_privaatrechtelijke_rechtspersoon</innRechtsvorm>
        <statutaireNaam>Gemeente Súdwest-Fryslân</statutaireNaam>
    </betrokkeneIdentificatie>
    <betrokkeneType>niet_natuurlijk_persoon</betrokkeneType>
    <omschrijving>Initiator</omschrijving>
    <omschrijvingGeneriek>initiator</omschrijvingGeneriek>
    <roltoelichting>Initiator:Gemeente Súdwest-Fryslân</roltoelichting>
    <roltype>http://open-zaak.nginx:9001/catalogi/api/v1/roltypen/a892d249-d866-417b-bc88-8d1287da7de8</roltype>
</zgwRol>

output 9.2.2-20251110.093214

<zgwRol>
   <betrokkeneIdentificatie>
      <ann.identificatie/>
      <authentiek>N</authentiek>
      <geslachtsnaam>fromValueOverride</geslachtsnaam>
      <innNnpId>823288444</innNnpId>
      <innRechtsvorm>overig_privaatrechtelijke_rechtspersoon</innRechtsvorm>
      <statutaireNaam>Gemeente Súdwest-Fryslân</statutaireNaam>
   </betrokkeneIdentificatie>
   <betrokkeneType>niet_natuurlijk_persoon</betrokkeneType>
   <omschrijving>Initiator</omschrijving>
   <omschrijvingGeneriek>initiator</omschrijvingGeneriek>
   <roltoelichting>Initiator:Gemeente Súdwest-Fryslân</roltoelichting>
   <roltype>http://open-zaak.nginx:9001/catalogi/api/v1/roltypen/a892d249-d866-417b-bc88-8d1287da7de8</roltype>
</zgwRol>

Configuration

Input

No response

What database are you using?

No response

What browsers are you seeing the problem on?

No response

Relevant Log Output

Anything else?

No response

Metadata

Metadata

Assignees

Labels

Type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions