XSL: of a list of xml files, create single DITA files based on the xml element contents
Posted: Fri Feb 14, 2025 1:08 pm
Hi,
Suppose I have several XML files of the following structure (below).
For each group element, create a DITA file <group-name>.dita that contains all the group elements. (There should be some more configuration/mapping behind it but that's manageable for me.)
If there are same-name groups in an XML file or across XML files, also list those groups.
I tried this in various ways with XSL, etc. but there are always conflicts between same-name groups.
Suppose I have several XML files of the following structure (below).
For each group element, create a DITA file <group-name>.dita that contains all the group elements. (There should be some more configuration/mapping behind it but that's manageable for me.)
If there are same-name groups in an XML file or across XML files, also list those groups.
I tried this in various ways with XSL, etc. but there are always conflicts between same-name groups.
- When I try to merge and split this with one XSL file, then only one same-name group/all same-name groups of one file but not of other files get generated to the output.
- So I tried merging all XML contents to one file as described in general-xml-questions/topic11375.html. Then I used another xsl stylesheet to generate the output. However, this resulted in a Saxon error:
(In theory it works better than the first option, so the xsl stylesheet also considers other files with same-name groups. However, if one same-name group is directly followed by another one, then the error occurs.Cannot write more than one result document to the same URI.
Code: Select all
<?xml version="1.0" encoding="UTF-8" standalone="no"?><configuration>
<group name="gruppnoans" >
<parameter name = "testingoans" value = "true" type="BOOLEAN">
<description lang="en">English text.. he.</description>
<description lang="de">... he</description>
</parameter>
</group>
<group name="gruppnzowa" >
<parameter name="elementoans" value="false" type="BOOLEAN">
<description lang="en">English text a</description>
<description lang="de">bla bla a</description>
</parameter>
<parameter name="element.zwoa" value="C:\tiger" type="STRING">
<description lang="en">English text...</description>
<description lang="de">bla bla...</description>
</parameter>
<parameter name="ajkdjfaklsdj" value="1,MINUTE" type="PERIOD">
<description lang="en">English text</description>
<description lang="de">de</description>
</parameter>
</group>
</configuration>