Learn how to build a complex n8n workflow to pull data from MySQL, structure it, convert it to XML, and format it using a dynamically served XSLT template for modern web delivery.
Download this n8n workflow template and start using it instantly.
Backend Developers needing automatic data feed generation.
System Integrators requiring specific XML outputs for legacy systems or partners.
Users looking for advanced examples of data transformation within an n8n workflow.
Anyone interested in mastering the n8n node for database interaction and XML handling.
This advanced n8n workflow addresses the challenge of serving structured, dynamically generated XML data that requires complex formatting via an external XSLT stylesheet—a common requirement for integrating data feeds or accommodating browser security policies (CORS).
The implementation uses two separate n8n trigger endpoints. The primary endpoint fetches database information (using the MySQL n8n node), transforms the results into a single XML document, and includes an xml-stylesheet instruction pointing back to a secondary webhook path within the same n8n instance.
This secondary n8n trigger is crucial: it fetches the raw XSLT file from a remote source (like a GitHub Gist) and serves it with the correct content type (text/xsl), ensuring browsers can securely retrieve and apply the transformation to the primary XML data. This comprehensive n8n template demonstrates sophisticated data routing and content serving.
This n8n workflow operates in two concurrent paths:
Path 1: Generating and Serving the XML Data
Product.Code, Product.Name) appropriate for the desired XML hierarchy. This is a vital step in preparing data for the next n8n node.Products.xml-stylesheet link that points to the secondary XSLT n8n trigger using the {{ $env.WEBHOOK_URL }} variable.text/xml.Path 2: Serving the Required XSLT Template
Content-Type header is correctly set to text/xsl for proper browser interpretation. This architecture demonstrates the flexibility of using multiple n8n trigger mechanisms in one solution.To deploy this powerful n8n workflow template:
db4free MySQL in the example). You must replace this with your active database credentials connected to a table containing 'products'.$env.WEBHOOK_URL environment variable being correctly configured so that the primary XML output can correctly reference the secondary XSLT n8n trigger. Webhook (n8n trigger): Primary entry point for the XML generation process. It waits for the response from the Respond to Webhook n8n node.
Show 16 random products (MySQL n8n node): Executes SELECT from products ORDER BY RAND() LIMIT 16;. Essential for extracting the source data.
Define file structure (Set n8n node): Maps specific SQL column names (like productCode) to structured XML element names (like Product.Code), ensuring the resulting XML is correctly structured. This n8n node uses 'Keep Only Set' to prune extraneous data.
Concatenate Items (Item Lists n8n node): Aggregates the list of product rows into a single JSON object under the key Products, which the subsequent XML n8n node uses as the root structure.
Convert to XML (XML n8n node): Performs the JSON-to-XML transformation. Key configuration is Headless: true.
Create HTML (HTML n8n node): Used here to embed the XML declaration and the dynamic XSLT link within the data stream. It references the secondary XSLT n8n trigger URL using environment variables.
Move Binary Data (Move Binary Data n8n node): Converts the final text output into binary data (text/xml) required for the final webhook response.
Request xsl template (n8n trigger): The secondary n8n trigger specifically designed to serve the XSLT file.
Get XSLT (HTTP Request n8n node): Fetches the external XSLT template from GitHub, configured to treat the response as a file (binary).
Use this powerful n8n workflow to turn the BulkSMS API into an AI toolset. Features 15 endpoints for SMS, credits, and webhooks, driven by the n8n trigger. Ideal for custom AI agents.

Use this robust n8n workflow to automatically monitor SSL certificate expiration dates using SSL-Checker.io. Get weekly Gmail alerts if certificates are nearing expiry. A powerful n8n template for DevOps.

Automate keyword SERP ranking checks using this powerful n8n workflow. Log country-specific search results directly into Google Sheets using RapidAPI integration. Find more n8n templates here.

Automate daily SSL certificate monitoring using this free n8n workflow. Check expiry dates via API, update Google Sheets, and send alerts for soon-to-expire domains. This n8n template is perfect for DevOps.

Use this robust n8n workflow to automatically monitor SSL/TLS certificate expiry dates across all your domains. This automation checks certificates via an API and triggers high-priority alerts via Slack 30 days before expiration, preventing downtime.


Meet the official n8n team. We specialize in building workflows that transform intricate tasks into seamless operations.







































