Compare map and topic values

xephon
Posts: 100
Joined: Mon Nov 24, 2014 1:49 pm
Location: Münster/Germany

Compare map and topic values

Post by xephon » Mon Sep 12, 2016 9:03 pm

Hi,

I have a DITA Map with a topic reference, that has a filter attribute, for example @foo:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map id="map">
<title>DITA Topic Map</title>
<topicref href="topic.dita" foo="bar"/>
</map>
The topic has a <data> element, named foo with a value, that must be equal to the filter attribute.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic id="topic">
<title>Topic</title>
<prolog>
<metadata>
<data name="foo" value="no-bar"/>
</metadata>
</prolog>
</topic>
Is it possible to compare both values with <oXygen/>, preferably with Schematron and a DITA Map validation scenario and a DITA Topic validation scenario :?:

Greetings,
Stefan
Join the DOCTALES DITA development team :arrow: https://doctales.atlassian.net/wiki

Radu
Posts: 7032
Joined: Fri Jul 09, 2004 5:18 pm

Re: Compare map and topic values

Post by Radu » Tue Sep 13, 2016 9:22 am

Hi Stefan,

Possibly in the Schematron used to validate the topic you could use the document() function to load the DITA Map and look inside it.
Other than this, I'm not sure how this could be done...

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

xephon
Posts: 100
Joined: Mon Nov 24, 2014 1:49 pm
Location: Münster/Germany

Re: Compare map and topic values

Post by xephon » Tue Sep 13, 2016 10:04 am

Hi Radu,

alright, thanks. So, there is no option to get the DITA Map that is opened in the DITA Maps Manager?

Greetings,
Stefan
Join the DOCTALES DITA development team :arrow: https://doctales.atlassian.net/wiki

Radu
Posts: 7032
Joined: Fri Jul 09, 2004 5:18 pm

Re: Compare map and topic values

Post by Radu » Tue Sep 13, 2016 1:27 pm

Hi Stefan,

We have some static Java API to access the URL of the current opened DITA Map.
So in the Schematron you could define a prefix for the Java extension:

Code: Select all

    <ns uri="java:ro.sync.ecss.dita.DITAAccess" prefix="java"/>
and then use it like:

Code: Select all

<value-of select="java:getRootMapURL()"/>
but loading the main DITA Map using the document() function and parsing it each time the user types something in a topic (and automatic validation is triggered) seems a bit too much. You would need some kind of caching and I'm not sure how you could do this only with Schematron.
We have Java API which would allow you to add your own Java-based validation stage, this would possibly allow you to cache the information stored in the DITA Map instead of parsing the DITA Map each time.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Post Reply