@tibtof's solution worked for my complex Cordova config.xml transformation using gulp and gulp-xml-transformer to fix the ionic-plugin-deeplinks AndroidManifest.xml implementation by targeting the android:host attribute like so since the colon in the attribute name would not work with path: '//xmlns:platform[@name="android"]/xmlns:config-file/xmlns:intent-filter/xmlns:data[@android:host]':
gulpfile.js:
var gulp = require('gulp'),
xeditor = require("gulp-xml-transformer");
function config(avc, bundleId, ioscfbv, version, appLabel, hostname, done) {
gulp.src('config.xml')
.pipe(xeditor([
{
path: '//xmlns:widget',
attr: { 'android-versionCode': avc, 'id': bundleId, 'ios-CFBundleVersion': ioscfbv, 'version': version }
},
{
path: '//xmlns:name',
text: appLabel
},
{
path: '//*[@name="Hostname"]',
attr: { 'value': bundleId }
},
{
path: '//*[@name="ios"]/xmlns:config-file/xmlns:array/xmlns:string',
text: 'applinks:' + hostname
},
{
path: '//xmlns:platform[@name="android"]/xmlns:config-file/xmlns:intent-filter/xmlns:data[@*[name()="android:host"]]',
attr: { 'android:host': hostname }
}
], 'http://www.w3.org/ns/widgets'))
.pipe(gulp.dest('.'))
.on('finish', done);
}
config.xml:
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0" android-versionCode="0" id="com.bundle.placeholder" ios-CFBundleVersion="1.0.0.0" version="1.0.0">
...
<platform name="android">
...
<config-file target="AndroidManifest.xml" parent="/manifest/application/activity">
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="https"/>
<data android:host="com.bundle.placeholder"/>
</intent-filter>
</config-file>
...
</platform>
...
</widget>