Goog Morning, Im using a simple xsl to tranform an imput xml that sometimes has the empty element “ContentVersion”, the xsl adds a “dummy” element when it’s empty, it works fine but in a specific server (windows Server 2019) the output is different, this is the input sample xml:
<?xml version="1.0" encoding="UTF-8"?>
<CompositionPlaylist xmlns="http://www.sample.com/SAMPLE-20040511#">
<Id>urn:uuid:129de837-6eed-40d4-a635-db58380dfd9e</Id>
<AnnotationText>Title</AnnotationText>
<IssueDate>2014-09-22T19:18:56.001+01:00</IssueDate>
<Issuer>issuer</Issuer>
<Creator>Creator Name</Creator>
<ContentTitleText>Content Title</ContentTitleText>
<ContentKind>feature</ContentKind>
<ContentVersion>
<ContentVersion>
<LabelText/>
</ContentVersion</ContentVersion>
<RatingList/>
the xsl is this:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0" xmlns:ns1="http://www.sample.com/SAMPLE-20040511#" exclude-result-prefixes="ns1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<!-- identity transform -->
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<!--Add dummy "id" and "LabelText" if "LabelText" is empty-->
<xsl:template match="ns1:ContentVersion[not(ns1:LabelText) or ns1:LabelText = '']">
<ContentVersion xmlns="http://www.sample.com/SAMPLE-20040511#">
<Id>urn:uuid:11111111-1111-1111-1111-111111111111</Id>
<LabelText>DUMMY</LabelText>
</ContentVersion>
</xsl:template>
</xsl:stylesheet>
from most of PC I have used the output (just the modified element) is:
<ContentVersion>
<Id>urn:uuid:11111111-1111-1111-1111-111111111111</Id>
<LabelText>DUMMY</LabelText>
</ContentVersion>
the output from another server is:
<ContentVersion>
<LabelText>1.0</LabelText>
</ContentVersion>
so different, I used some different XML tools to parse the xml file but, in this machine, the result is always different, I didn’t find a solution yet, can somebody help me to understand the different behavior?