Close [x]

Convert layout XML files

Edit this page on GitHub

Contents

Overview of layout XML conversion

When XML schema are updated, you should update your layout XML files to match the new Extensible Stylesheet Language Transformations (XSLT) stylesheet. This command enables you to perform these updates.

For more information about layout XML files, see:

First steps

  1. Log in to the Magento server as, or switch to, a user who has permissions to write to the Magento file system. One way to do this is to switch to the Magento file system owner.

    If you use the bash shell, you can also use the following syntax to switch to the Magento file system owner and enter the command at the same time:

    su <Magento file system owner> -s /bin/bash -c <command>
    
  2. To run Magento commands from any directory, add <your Magento install dir>/bin to your system PATH.

    Because shells have differing syntax, consult a reference like unix.stackexchange.com.

    bash shell example for CentOS:

    export PATH=$PATH:/var/www/html/magento2/bin
    

You can also run the commands in the following ways:

  • cd <your Magento install dir>/bin and run them as ./magento <command name>
  • php <your Magento install dir>/bin/magento <command name>

<your Magento install dir> is a subdirectory of your web server's docroot. Need help locating the docroot? Click here.

In addition to the command arguments discussed here, see Common arguments.

Convert layout XML files

Command options:

magento dev:xml:convert [-o|--overwrite] {xml file} {xslt stylesheet}

where

  • {xml file} is the full path and file name of a layout XML file to convert (required)
  • {xslt stylesheet} is the full path and file name of an XSLT schema file to use for conversion (required)
  • -o|--overwrite include this option to overwrite the existing XML file