XPath AI Extension Functions: Transform & Verify Content Effortlessly

Updated on May 20,2025

Table of Contents

In today's rapidly evolving digital landscape, content creation and management are more critical than ever. XML (Extensible Markup Language) stands as a cornerstone for structuring and exchanging data, particularly in technical documentation, publishing, and data-driven applications. However, working with XML can be complex, often requiring specialized skills and tools. Fortunately, advancements in Artificial Intelligence (AI) are paving the way for more intuitive and efficient XML workflows.

Key Points

AI can be used to generate and transform XML content, improving efficiency.

XPath AI extension functions automate XML processes within Oxygen XML Editor.

Schematron and SQF leverage AI for content verification and correction.

XSL and XQuery, enhanced with AI, streamline content transformation and refactoring.

Always critically assess the AI's responses for accuracy.

XPath AI Extension Functions: Revolutionizing XML Content

Harnessing AI for Content Transformation

The core idea is that you can leverage AI to dramatically transform content.

This is especially beneficial when dealing with large XML documents or when aiming for specific stylistic or readability goals. Some examples include:

  • Simplifying Text for Readability: AI can make complex technical jargon more accessible to a wider audience.
  • Correcting Spelling and Grammar: Ensure accuracy and professionalism with automated error correction.
  • Active Voice Conversion: Transform passive voice into a more engaging and direct active voice.
  • Content Length Optimization: Rephrasing to meet specific WORD count requirements.
  • Question Answering: AI can adapt paragraphs to directly answer specific questions, improving information retrieval.
  • Translation: Seamlessly Translate XML content between languages. These capabilities can significantly reduce the time and effort involved in content refinement, allowing users to focus on the core message and its effective delivery.

AI-Powered Content Generation

AI can also be used to automatically generate contents!

Beyond transformation, AI can also be instrumental in generating XML content from scratch. This opens up new possibilities for automated documentation and content creation. Consider these use cases:

  • Template File Generation: Quickly generate a template file.
  • Table Completion: Use AI to add missing cells to tables.
  • Schema-Based Content: Automatically create content that conforms to a defined XML schema.
  • Code Documentation: Automate the creation of documentation for code segments.
  • Code Explanation: AI can explain the function for current code blocks. By leveraging AI for content generation, you can accelerate development cycles and ensure consistency across your XML documents.

AI-Driven Content Verification

AI verification can offer an unparalleled level of quality control for XML content. AI offers powerful tools for verifying the accuracy, style, and overall quality of XML content. Some examples of verification with AI are as follows:

  • Readability Assessment: Determine if the text is easy to read and understand.
  • Spelling and Grammar Checks: Perform advanced grammar checks.
  • Active/Passive Voice Analysis: Verify the correct use of voice.
  • Style Guide Adherence: Ensure content adheres to a predefined style guide.
  • Question Alignment: Check if the content answers specific questions. By using AI to check, the content generated follows all rules or guidelines. This is especially critical in highly regulated industries or when dealing with complex technical documentation where accuracy is paramount.

XPath AI Extension Functions in Detail

The core of this AI integration lies in new XPath extension functions that call AI engine APIs.

The extension functions allow users to interact with the AI engine through Xpath expressions. These functions can differ depending on the AI model you are using.

The 2 main functions provided are as follows:

  • ai:transform-content(): This function transforms content based on an instruction provided by the user. It takes an instruction STRING and the content to be transformed as input and returns the generated content.
  • ai:verify-content(): This function verifies content against a user-provided instruction. It takes an instruction string and the content as input and returns a boolean value (true or false) indicating whether the content meets the specified criteria. These functions provide a flexible and powerful way to integrate AI into your XML workflows directly within the XPath environment.

Transform Content Function Explained

The transform content function provides a specific Prompt on built in prompts, using the user specified instruction, along with the content to be transformed. This function gives OxygenXML users 2 parameters:

  • Instruction
  • Content

For example, consider that Oxygen XML Editor is automatically adding the following built in prompt: 'You are a developer and you need to perform the following task:'. Adding the prompt:' Rephrase to use active voice'. Oxygen will automatically convert from passive to active voices!

Verify Content Function Explained

This function allows the user to verify all content by specifying the instructions, and the content that is meant to be verified with true or false. It makes use of a built-in prompt function.

Like you're a technical Writer you need to verify the following and respond to the question or request with 'true or false'

'Is active voice used in the description'!

This uses the string parameter instruction to verify the content and return either true or false based on this.

Advanced Transform Content: Context-Aware Transformations

Recent enhancements introduce a more detailed context using (user, agent) pairs. This expands the capabilities of the transform content function by incorporating a history of the discussion, enabling more nuanced and context-aware transformations. To do so, use the following method ai:transform-content(instruction,(user,agent)*, content).

The example they use uses the following action: Act as a technical writer and perform the following task. rephrase to use active voice. Choose the best variant based on the strong points. Provide 3 variants. Provide strong points. Adding User entry: how to correct. What this does is it allows the writer to use specific users based to the strong points! It helps create a better output in all facets!

Leveraging AI Functions in Schematron and SQF

These functions, in turn, enables Schematron and SQF to check and automatically correct things in XML files.

XPath AI extension functions can also be used in Schematron and SQF rules, enabling automated content verification and correction. This allows you to embed AI-powered quality control directly into your validation workflows.

Example functionalities include:

  • Schematron: Automatically verify that documents can use AI.
  • SQF: Correct the code to work with AI. This integration ensures that your XML content adheres to your quality standards.

Unlocking AI Potential in XSL and XQuery

These allow the power of AI to automatically change content in code, with features including:

  • Using AI to automatically translate content.
  • Adding refactoring based on AI!

A Deeper Look Into Ai's Role

The Role of AI in XML Document Processing

The integration of AI into XML document processing brings several paradigm-shifting changes to the industry.

  • Accelerated Content Creation: AI can generate large volumes of accurate, schema-compliant XML content in a fraction of the time compared to traditional methods.
  • Enhanced Content Quality: AI-powered verification and correction tools ensure that XML documents adhere to strict quality standards and style guides.
  • Improved Accessibility: AI can automatically simplify complex technical language, making XML content more accessible to a wider audience.
  • Streamlined Workflows: Automation enabled by AI eliminates manual tasks, streamlining XML editing and transformation processes.

How to use Xpath AI extension functions

Here is how to use schematron to verify a content

This helps you make sure that your text has been actively used for your content. The rule check that checks that the text uses an active voice:

<sch:rule context="shortdesc"> <sch:assert test="ai:verify-content('Is active voice used?',.)">In the description we should use active voice.</sch:assert> </sch:rule>

FAQ

How does the AI learn and adapt to specific XML schemas and style guides?
The AI models are trained on large datasets of XML documents and can be further fine-tuned with specific schemas and style guides to improve accuracy and relevance.
What AI engine is used for this function?
The Call AI engine API does so using an XPath extension function.
Is it possible to integrate custom AI models with Oxygen XML Editor?
Yes, Oxygen XML Editor provides extension points that allow you to integrate custom AI models and APIs.

Related Questions

What are the limitations of using AI for XML content transformation?
It is important to note that the use of the AI to transform all content isn't for certain scenarios. AI is designed to help accelerate tasks, however, it isn't meant to replace developers or content writers.

Most people like