Knowledge Base
Published Nov. 12, 2026

XLIFF not a valid value for NMTOKEN Errors During Content Page Translation

Written By

Rita Schaff

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Issue

  • When attempting to translate a Content Page containing a custom fragment, the translation fails with an XLIFF validation error and Liferay logs this exception:

    ERROR [ajp-nio-[TECHNICAL_ID]-8009-exec-1][PortletServlet:109] Unable to process portlet com_liferay_translation_web_internal_portlet_TranslationPortlet: com.liferay.translation.exception.XLIFFFileException$MustBeValid: net.sf.okapi.lib.xliff2.reader.XLIFFReaderException: Error lineNumber: 11; columnNumber: 54; cvc-datatype-valid.1.2.1: 'FragmentEntryLink_2655525:Main Headline' is not a valid value for 'NMTOKEN'.
  • This occurs if the fragment contains editable IDs with spaces (e.g., "Main Headline").

Environment

  • Liferay DXP 2025.Q1+

Resolution

  • The XLIFF format requires translatable element IDs to be valid NMTOKEN values. Since NMTOKEN values cannot contain spaces, when a fragment's editable ID contains a space, the exported XLIFF file is invalid.
  • To resolve this, you must modify the editable IDs in affected fragments so they do not contain spaces.

Manual Workaround

WARNING
Manually changing an editable ID hides the content already entered in that field on existing pages. To retain that content, you must run a bulk update with a Groovy script.

  1. Navigate to Design > Fragments and open each affected fragment.
  2. In the fragment's HTML, update the data-lfr-editable-id or <lfr-editable id="..."> values so they do not contain spaces. For example, change <lfr-editable id="Main Headline" type="text"> to <lfr-editable id="mainHeadline" type="text">.
  3. Publish the fragment and propagate the changes to the pages that use it.

Bulk Update

To rename IDs without losing existing content across multiple pages, you can write and execute a Groovy script to map the old IDs to the new IDs. If you pursue this option, ensure you:

  1. Take a full database backup before proceeding
  2. Optionally design and run the script with a dryRun = true functionality.
  3. If you maintain these fragments in a Fragments Toolkit project, ensure the IDs are also updated there (e.g., to mainHeadline) after executing the script. Otherwise, the next import reintroduces the spaces.

As one approach, you could surface a report section to identify “Content stored under editable IDs that the fragment HTML does not use.” Then, you can use this list of pages whose content is stranded under an old ID to determine renames to define in an editableIdMap.

Did this article resolve your issue ?

Knowledge Base