Quick revision
The short answer
I would first find out exactly what we have: an inventory of every XPath and XSLT mapping, where it lives and which business process depends on it. Then I would make it safe to change, with tests that pair sample inputs with expected outputs for each mapping, run in CI, and spread the knowledge by pairing more engineers with the two experts and documenting the important mappings. Finally I would decide, mapping by mapping, which rules belong in code or a rules engine owned by the business domain team, and keep the tooling current with clear ownership recorded.
What to remember
In this answer, we reduced the risk of business rules hidden in XPath and XSLT by first inventorying every mapping and the process it supports, then adding tests with sample inputs and expected outputs in CI, then spreading the knowledge through pairing, rotation, training and documentation, and then moving the business decisions that change often into code or a rules engine owned by the domain team. Current tooling versions and recorded ownership keep the situation from returning.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
I would first find out exactly what we have: an inventory of every XPath and XSLT mapping, where it lives and which business process depends on it. Then I would make it safe to change, with tests that pair sample inputs with expected outputs for each mapping, run in CI, and spread the knowledge by pairing more engineers with the two experts and documenting the important mappings. Finally I would decide, mapping by mapping, which rules belong in code or a rules engine owned by the business domain team, and keep the tooling current with clear ownership recorded.
Why this question is asked
Integration configurations are where business rules go to hide. A discount rule, a tax code mapping or a routing decision written as an XPath predicate in an integration product's configuration looks like plumbing, so it never appears in the domain team's code or tests. When only two engineers understand these files, the company carries a key-person risk: illness, a resignation or simply two people being on holiday can stop changes to processes that move money. Interviewers ask this to see how we reduce such a risk step by step without stopping the business. In this answer, we will build the inventory, add tests, spread the knowledge, decide where each rule should live, and keep the tooling and ownership healthy.
1Why This Is an Organisational Risk, Not Only a Technical One
XPath is a query language for selecting parts of an XML document, and XSLT is a language for transforming one XML document into another, built on XPath. Both are declarative and compact: a twenty-line stylesheet can encode a dozen business decisions. That compactness is the problem. Rules are dense, they are not where developers look, and the skills to read them are rare.
So the risk has three parts: we do not know where the rules are, we cannot tell whether a change breaks one, and too few people can make changes. Each part has its own remedy, and the order matters, because tests are hard to write for mappings we have not found, and people learn faster with tests to guide them.
2Inventory the Mappings
We search every repository and configuration store for XSLT files, XPath expressions in integration flows (for example in Apache Camel routes, Spring Integration configurations or a commercial integration platform) and expressions stored in databases. For each mapping we record the file, the integration it belongs to, the business process it supports, the partner involved, how often it runs and when it last changed.
The two experts are the best source for the business meaning, so we schedule short sessions with them per integration rather than asking them to write documents alone. The outcome is a table that tells us where the risk concentrates: usually a handful of mappings carry most of the business-critical logic.
| Mapping | Process | Runs per day | Last change | Who understands it |
|---|---|---|---|---|
invoice-to-ubl.xsl | billing to customers | 40,000 | 2025 | 2 people |
| route-by-country XPath | order routing | 120,000 | 2026 | 2 people |
tax-code-map.xsl | tax reporting | 1 batch | 2019 | 1 person |
partner-x-ack.xsl | acknowledgements | 500 | 2017 | nobody |
3Put Every Important Mapping Under Test
For each mapping we collect sample inputs, anonymised production messages where possible, and record the current outputs as expected results. A test runs the stylesheet or expression on each input and compares the output with the expected file. These run in CI on every change, so a broken rule is caught in minutes rather than by a partner.
For XSLT there are also dedicated tools; XSpec, for example, lets us write tests for individual templates. Choosing samples deliberately, one per business case, matters more than having many. The experts are invaluable here: when they explain a rule, we turn the explanation into a test case.
4Spread the Knowledge
With tests in place, others can learn safely. We pair at least two more engineers with the experts on every change to these mappings for a few months, rotate the support duty for the integrations, and run a short internal course on XPath, XSLT and namespaces using our own stylesheets as material. For the most important mappings we write a one-page explanation of the business rules in plain language, with links to the tests that prove each rule.
The goal can be measured: for each critical mapping, at least three people have made a change and released it. We track that number and report it alongside the inventory.
5Decide Where Each Rule Should Live
Some rules are true transformations: field renaming, restructuring and formatting for a partner's schema. Those belong in the mapping and are fine as XSLT. Others are business decisions, such as which country gets which discount or which orders need manual approval. Those belong with the business domain team, in their code or a rules engine they own, where they are visible, tested with the domain and changed by the people responsible for them.
We do not move everything at once. For each mapping, we ask how often its rules change and who asks for the changes. Rules that the business changes several times a year move first; stable formatting stays. After a move, the mapping receives the decision as an input field rather than computing it.
- Is it a business decision rather than formatting?YesGo to the next questionNoKeep it in the mapping
- Does the business change it often?YesMove it to the domain team's code or rules engineNoKeep it, with tests and docs
- Pass the decision into the mapping as datathe mapping only formats
3 steps in order. Play them, or step through them one at a time.
6Keep Tooling Current and Ownership Clear
Old mappings often depend on old tools: an outdated Saxon release, a JDK-specific XSLT behaviour or an integration product version near its end of support. We keep these versions current on a schedule, using the new tests to prove nothing changed, because an emergency upgrade forced by a security issue is far riskier than a planned one.
Every mapping gets an owning team recorded in the inventory, with a review date. Ownership is what keeps the inventory true a year later, when the next stylesheet is added.
7Follow-up questions
What if the two experts resist sharing their knowledge?
Usually they do not resist knowledge sharing itself; they resist losing time or status. I would make teaching an explicit, recognised part of their work, reduce their other load during the transition, and involve them in deciding which rules move. Being the person who made the system safe is a better position than being the only person who can fix it.
Is XSLT itself the problem?
No. XSLT is a good tool for transformations and is well supported by Saxon. The problem is business decisions hidden in it without tests or owners. With tests, documentation and more people who know it, XSLT mappings can stay for years.
How do you prioritise if there are hundreds of mappings?
By business impact and bus factor: start with mappings that support high-volume or regulated processes and that the fewest people understand. The inventory makes this a sorting exercise rather than a guess.
8Conclusion
In this answer, we reduced the risk of business rules hidden in XPath and XSLT by first inventorying every mapping and the process it supports, then adding tests with sample inputs and expected outputs in CI, then spreading the knowledge through pairing, rotation, training and documentation, and then moving the business decisions that change often into code or a rules engine owned by the domain team. Current tooling versions and recorded ownership keep the situation from returning.
Open with
I would treat it as a key-person risk with three parts: we do not know where all the rules are, we cannot tell if a change breaks them, and too few people can change them.
Then, if they want more
So step one is an inventory: search the repositories and integration configs for XSLT files and XPath expressions, and for each one record which business process and partner depend on it, how often it runs and who understands it. That usually shows a handful of mappings carrying most of the risk.
Step two is tests: sample inputs, anonymised where needed, with the current outputs as expected results, run in CI, so anyone can change a mapping and know immediately whether behaviour moved.
Step three is people: pair two or three more engineers with the experts on every change, rotate support, and write a plain-language page per critical mapping linked to its tests, aiming for at least three people who have shipped a change to each.
Step four is placement: formatting and restructuring can stay in XSLT, but business decisions that change often, like discounts or approval rules, should move into code or a rules engine owned by the domain team, and the mapping then only formats.
Finally, I would keep Saxon and the JDK current on a schedule and record an owning team for every mapping.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Many of your company's business rules are encoded in XPath and XSLT inside integration...": https://scrivio-interview-library.netlify.app/java/xml-processing/96684489b4/