One of our config files is being transformed oddly.
<?xml version="1.0"?>
<configuration >
</configuration>
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform" xmlns:role="http://www.sitecore.net/xmlconfig/role/" xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore xdt:Transform="Insert">
<contentSearch>
<configuration>
<indexes>
<index id="sitecore_web_index">
<param desc="core" patch:instead="param[@desc='core']">#{IndexEnvironment}#_web_index</param>
</index>
</indexes>
<indexes role:require="Standalone or ContentManagement">
<index id="sitecore_master_index">
<param desc="core" patch:instead="param[@desc='core']">#{IndexEnvironment}#_master_index</param>
</index>
After a build is run, the output of the final config looks very strange:
<?xml version="1.0"?>
<configuration>
<sitecore>
<contentSearch>
<configuration>
<indexes>
<index id="sitecore_web_index">
<param desc="core" d7p1:instead="param[@desc='core']" xmlns:d7p1="http://www.sitecore.net/xmlconfig/">ASHQA_web_index</param>
</index>
</indexes>
<indexes d5p1:require="Standalone or ContentManagement" xmlns:d5p1="http://www.sitecore.net/xmlconfig/role/">
<index id="sitecore_master_index">
<param desc="core" d7p1:instead="param[@desc='core']" xmlns:d7p1="http://www.sitecore.net/xmlconfig/">ASHQA_master_index</param>
</index>
Notice how the patch
and role
definitions are changed to d7p1
and d5p1
respectively.
While this is valid XML, it is causing issues in our application which parses the XML and looks for the proper terms of patch
and role
.
Any namespaces required in a transformed config, need to be defined in the base config.
<?xml version="1.0"?>
<configuration xmlns:role="http://www.sitecore.net/xmlconfig/role/" xmlns:patch="http://www.sitecore.net/xmlconfig/">
</configuration>
Even though the base config does not rely on these namespaces, they do not carry over properly if they are not included. This also cleans up the output of the resulting config as expected:
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform" xmlns:role="http://www.sitecore.net/xmlconfig/role/" xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<contentSearch>
<configuration>
<indexes>
<index id="sitecore_web_index">
<param desc="core" patch:instead="param[@desc='core']">#{IndexEnvironment}#_web_index</param>
</index>
</indexes>
<indexes role:require="Standalone or ContentManagement">
<index id="sitecore_master_index">
<param desc="core" patch:instead="param[@desc='core']">#{IndexEnvironment}#_master_index</param>
</index>