Multiple Ditavals in WebAuthor URL

Are you missing a feature? Request its implementation here.
zuza
Posts: 22
Joined: Fri May 13, 2016 5:34 pm

Multiple Ditavals in WebAuthor URL

Post by zuza »

Hello,

I am trying to construct the “edit online” links for the latest editlink plugin. We are still using editlink.web.author.url and editlink.remote.ditamap.url, but moving on to using editlink.ditamap.edit.url and editlink.additional.query.parameters.

I assume the ditavals need to be passed in the editlink.additional.query.parameters parameter, is this correct?

It seems to me that WebAuthor does not support filtering using multiple ditavals... I have tried something similar to the following (note: we are using Perforce revision system) and noticed that only the last ditaval in the list is used for filtering.

“&dita.val.url= p4java://p4master.hh.imgtec.org:1666//techpubs/MAIN/ditavals/product.ditaval&dita.val.url= p4java://p4master.hh.imgtec.org:1666//techpubs/MAIN/ditavals/features.ditaval&dita.val.url= p4java://p4master.hh.imgtec.org:1666//techpubs/MAIN/ditavals/audience.ditaval”

Would you consider implementing support for filtering with multiple ditaval files in WebAuthor? We use 4-5 ditavals for most of the PDFs we publish.

Many thanks.

Best regards,
Ozana
cristi_talau
Posts: 487
Joined: Thu Sep 04, 2014 4:22 pm

Re: Multiple Ditavals in WebAuthor URL

Post by cristi_talau »

Hello,

It is currently not possible to pass multiple DITAVAL files. I registered an internal issue to add this possibility. I will update this thread when it is implemented.

Meanwhile, you can create DITAVAL files that contain all the rules in those multiple files.

Best,
Cristian
kj_rk
Posts: 27
Joined: Thu Jul 15, 2021 10:01 am

Re: Multiple Ditavals in WebAuthor URL

Post by kj_rk »

If I understand this correctly, using multiple ditaval files is not allowed using the UI as well. Correct?
For example, if we have 2 different ditaval files for 2 different product guides (to be generated from the same Oxygen project), Oxygen does not validate the bookmap correctly.
image.png
image.png (48.48 KiB) Viewed 1153 times
The validation only works with one ditaval file at any time. So every time, we have to switch (remove and add) the appropriate ditaval file according to our needs.

Can this be fixed such that only the "selected" ditaval file is used during validation? That would be more intuitive.

Thanks
kj_rk
Attachments
image.png
image.png (13.63 KiB) Viewed 1153 times
mihaela
Posts: 488
Joined: Wed May 20, 2009 2:40 pm

Re: Multiple Ditavals in WebAuthor URL

Post by mihaela »

Hello,

If I understand correctly you are referring to the DITA Maps Completeness Check action from the Oxygen XML Editor, right?
If this is the case, then the answer is that all DITAVALs are used: for each DITAVAL file from this list, the map content is filtered using the DITAVAL file before validation [1].

The first question from this post refers to Oxygen XML Web Author, which has no support yet for using multiple DITAVALs when opening a document.

[1] https://www.oxygenxml.com/doc/versions/ ... al-filters

Best regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
kj_rk
Posts: 27
Joined: Thu Jul 15, 2021 10:01 am

Re: Multiple Ditavals in WebAuthor URL

Post by kj_rk »

Hi Christian,
To your following comment:
"Meanwhile, you can create DITAVAL files that contain all the rules in those multiple files."

How is this possible? We have multiple ditaval files, one for each product type. All products reuse some topics but need some product-specific variations.

To validate these, is there a way to combine different product combinations (to include/exclude) in one DITAVAL file?

Thanks
mircea_b
Posts: 1
Joined: Fri Dec 08, 2023 12:51 pm

Re: Multiple Ditavals in WebAuthor URL

Post by mircea_b »

Hello,

Regarding how you can create a DITAVAL file that contains all the rules from multiple files:

You need to create a single (combined) DITAVAL file for each product. This file concatenates the individual DITAVAL files by merging their content.

An example of how you can create such a DITAVAL file using python:

Code: Select all

import xml.etree.ElementTree as ET
import sys

def merge_ditavals(file_paths, output_file):
    first_file = True

    for file_path in file_paths:
        tree = ET.parse(file_path)
        root = tree.getroot()

        if first_file:
            merged_root = root
            first_file = False
        else:
            for element in root:
                merged_root.append(element)

    merged_tree = ET.ElementTree(merged_root)
    merged_tree.write(output_file, encoding='utf-8', xml_declaration=True)

def main():
    if len(sys.argv) < 3:
        print("Usage: python3 ditaval_merger.py <output_file.ditaval> <file1.ditaval> <file2.ditaval> ...")
        sys.exit(1)

    output_file = sys.argv[1]
    file_paths = sys.argv[2:]
    
    merge_ditavals(file_paths, output_file)
    print(f"Merged DITAVAL file created at {output_file}")

if __name__ == "__main__":
    main()
This code can be saved into a file called

Code: Select all

ditaval_merger.py 
and be used using the command line to create the merged file:

Code: Select all

python3 ditaval_merger.py output.ditaval ditaval1.ditaval ditaval2.ditaval
.

Note that you need to have python installed on your system.

Best regards,
Mircea
Post Reply