, and applies templates to all children.Discuss and Improve Code with Chat About Code – If you want to
optimize or extend the previous template, select it and use the Chat
About Code action. For example, you might ask:
How can I add a check to display a warning if the section has no title?
The AI suggested:
match="section">
class="section">
test="title">
select="title"/>
class="warning">[WARNING: section has no title]
terminate="no">
WARNING: a element has no .
select="para"/>
Document Templates with Document Code – To help with future
maintenance, select the previous updated template and use the Document
Code action. The AI will insert a comment before the template:
match="section">
[...]
Annotate Intricate Logic with Annotate Code – For complex
templates, use the Annotate Code action to insert both template
documentation and inline comments, all comments in this example were
generated by AI:
match="book">
select="title"/>
select="chapter">
select="title"/>
select="section"/>
Generate New Templates with Generate Code – Place your cursor
after a comment that describes the desired functionality and use the
Generate Code action:
The AI generates:
match="authors">
select="author">
select="name"/>
test="position() != last()">,
Refactor Complex Code with Suggest Refactoring – If you have a
monolithic template such as:
This template processes the entire book structure in a single, nested
template using for chapters and
for sections. While this works, it can become difficult to maintain, extend,
or debug as the complexity of the XML structure grows.
Use the Suggest Refactoring action and the AI will suggest to break it
into smaller templates:
match="book">
select="title"/>
select="chapter"/>
match="chapter">
select="title"/>
select="section"/>
match="section">
select="title"/>
By breaking the logic into separate templates for , ,
and
modular approach makes it easier to understand what each part of the code is
doing, and to locate or update specific logic.
Summary: With these AI-powered actions, you can quickly understand, document,
generate, refactor, and annotate XSLT code, making your XSLT development process
faster and your stylesheets easier to maintain. For more hands-on examples, see the
AI Positron Assistant samples on GitHub.
Creating a Custom AI Action
For advanced automation and customized workflows, Oxygen lets you build and
integrate custom AI actions directly into your workspace. These actions extend
Oxygen’s standard tools and give you greater flexibility and control over AI-driven
tasks.
Use the New Document wizard to create an AI Positron Custom Action
file. This file contains an action definition in JSON format, where you can specify
the action’s intent, parameters, and AI logic.
Oxygen offers automatic validation and content completion for these
files, so you can edit and maintain them with confidence. Work in text mode
for exact control, or switch to the Author visual editing mode for a guided,
interactive experience.
For example, you can create an AI action that generates a new XSLT document from
specific content with a simple guided workflow. You define the action logic and
workflow in JSON, and the integrated AI produces a complete XSLT stylesheet based on
your instructions.
The following JSON shows a custom AI action that generates an XSLT 3.0 document based
on provided source content:
{
"id": "create.new.xslt",
"title": "Create New XSLT",
"output-action": "create-new-document",
"context": "# CONTEXT #nYou will act as a senior XSLT developer.nn # OBJECTIVE #nYou are tasked with creating an XSLT starting from the provided text. Create an XSLT with version 3.0 nn# RESPONSE #nRespond with just the XSLT file content, without any other explanations.",
"parameters": {
"function_refs": [
{"ref": "get_content_for_document_url"}
]
}
}
In Author mode, this action appears as a structured form, allowing you to
configure and review the action visually:
![[ The Create New XSLT action displayed in Author mode, with editable fields and advanced AI parameters. ] Boosting XML Development with AI-Driven Code Actions in Oxygen XML Editor](https://blog.oxygenxml.com/images/customAIActionXSL.png)
In this setup, you supply context, objectives, the desired output action, and any
helper functions (such as extracting content from a document URL). The AI then
generates the XSLT file and returns only the requested code.
For a detailed walkthrough on creating and customizing AI actions in Oxygen, see the
official documentation: Creating Custom AI Actions in Oxygen.
Video Tutorial:
How to Create Custom AI Actions in Oxygen
Tips and Best Practices
- Focused Selection: Select small code blocks for targeted explanations and
documentation. - Iterative Chat: Use the Chat About Code action for ongoing
improvements, to ask questions, make changes, and regenerate code snippets
interactively. - Refactor Files: Run the Suggest Refactoring action on your code to
update it to modern standards and to create more readable, reusable
modules. - Comprehensive Comments: Annotate large, multi-template XSLT or XSD files
to improve shared understanding and make onboarding easier. - Explore Samples: Review and adapt provided samples to help your team get started quickly.
Conclusion
AI-driven actions in Oxygen XML Editor are changing how developers approach code
understanding, editing, and maintenance. Whether you’re explaining a Schematron
rule, documenting a schema, generating new validation logic, or refactoring for the
future, AI Positron delivers efficiency at every step. Take advantage of these tools
to elevate your XML development workflow.
To experiment and learn more, check out the Code Development subfolder in the AI
Positron samples project.
- Affordable SEO Powered Toolkit. RankFaster Today.
- Echobase.AI. Easily Integrate AI into your business. Access Here.
- EliteSocialHUB. Media Strategy. Social Management tools. Access Here.
- Next-Gen Intelligent Tools. AICryptoPredictions, WriteCraftAI, AIQuickTasks, BlockChain, Articles, Blog. Access Here.
- CoreFlowIntelligence.AI. Leaders in AI Consulting and Solutions. Contact US Here.










