othermeta/name/content completion framework extension

Post here questions and problems related to oXygen frameworks/document types.
stephanie-m
Posts: 3
Joined: Tue Apr 09, 2024 10:17 pm

othermeta/name/content completion framework extension

Post by stephanie-m »

I would like to specify values for the @content attribute of the <othermeta> element in a map based on the @name attribute value.

For example:

Code: Select all

<othermeta name="doctype" content="User Guide"/>
Where content = User Guide, Installation Guide, or other defined values
and

Code: Select all

<othermeta name="product-status" content="Active"/>
Where content = Active or Discontinued

I have already extended a custom dita map framework with resources/cc_config_ext.xml with proposed values for the <permissions> element @view attribute using the following instructions:
https://www.oxygenxml.com/doc/versions/ ... osals.html

As expected, this method will not work for othermeta @content due to the dependency on the @name attribute. If I try it anyway as a test, the first value set for content in my config file is used for all @content instances in my map.

To do this correctly based on the context, I have tried the steps in the following articles:
https://blog.oxygenxml.com/topics/contr ... lues2.html
https://www.oxygenxml.com/doc/versions/ ... in_context

When testing these two methods one at a time, I placed either the getvalues.xsl or meta.xsl files in the resources folder and have also tried within resources/xsl to no avail.

For meta.xsl, I used the code from the article and customized the xsl:choose as follows:

Code: Select all

<items>
   <xsl:choose>
	 <xsl:when test="$name = 'doctype'">
			<item value="Installation Guide">
			<item value="User Guide">
     </xsl:when>
     <xsl:when test="$name = 'product-status'">
        <item value="Active"/>
		<item value="Discontinued"/>
     </xsl:when>
   </xsl:choose>
  </items>
For getvalues, I tried the following:

Code: Select all

   <items>
        <xsl:if test="$propertyElement/@name = 'doctype'">
			<item value='Installation Guide'>
			<item value='User Guide'>
         </xsl:if>
	 <xsl:if test="$propertyElement/@name = 'product-status'">
       <item value='Active'/>
       <item value='Discontinued'/>  
     </xsl:if>
   </items>
I have confirmed that the resources folder of my custom framework is listed above the base framework resources folder on the Classpath tab, as the permissions customization is working.

I'm missing something somewhere and am attaching the files in case anyone can see what I've done wrong.
resources.zip
(4.16 KiB) Downloaded 62 times
Note: I am using Oxygen 23.1 right now but will be upgrading to the latest version in the next month or so.
Radu
Posts: 9246
Joined: Fri Jul 09, 2004 5:18 pm

Re: othermeta/name/content completion framework extension

Post by Radu »

Hi,
I'm attaching a DITA Map framework extension which works for me with Oxygen 26.1.
frameworks.zip
(10.56 KiB) Downloaded 64 times
Using Oxygen 26.1 the simplest approach is to have a "cc_config_ext.xml" file with the content something like this:
https://www.oxygenxml.com/doc/versions/ ... osals.html

Code: Select all

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.oxygenxml.com/ns/ccfilter/config http://www.oxygenxml.com/ns/ccfilter/config/ccConfigSchemaFilter.xsd"
    xmlns="http://www.oxygenxml.com/ns/ccfilter/config">
    <valueProposals path="othermeta[@name='color']/@content">
        <items>
            <item value="red"/>
            <item value="blue"/>
        </items>
    </valueProposals>
    <valueProposals path="othermeta[@name='product']/@content">
        <items>
            <item value="p1"/>
            <item value="p2"/>
        </items>
    </valueProposals>
</config> 
but this way of specifying the "path="othermeta[@name='product']/@content"" probably does not work with Oxygen 23.1.

Some observations based on what you tried:
The "cc_value_config.xml" is deprecated as the name of a configuration file, it might still work but it's best to move its content to the "cc_config_ext.xml".
I do not know how you actually used the in your DITA Map extension framework configuration, I assume it's in a folder "resources" and that the DITA Map framework extension's "Classpath" list refers to something like ${framework}/resources. Ideally you should have attached the entire zipped framework extension.
If you open both your XSLT stylesheets in Oxygen, it reports them as not wellformed, you probably forgot to close the <item> tags in both of them. So something like:
<item value='Wiring Diagram'> =><item value='Wiring Diagram'/>
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
stephanie-m
Posts: 3
Joined: Tue Apr 09, 2024 10:17 pm

Re: othermeta/name/content completion framework extension

Post by stephanie-m »

Thanks, Radu! I have confirmed that specifying the "path="othermeta[@name='product']/@content"" in the cc_config_ext.xml file does not work with Oxygen 23.1. I will test again once I've upgraded.

I fixed the end tags for the items but they still do not work with either the getvalues or meta method. I have a resources folder in my framework folder and it is listed at the top of the classpath list. I've attached the full framework folder.
custom_frameworks.zip
(48.06 KiB) Downloaded 66 times
I think the answer is to upgrade to 26.1 and then retest with the code you shared for the cc_config_ext.xml file.
Radu
Posts: 9246
Joined: Fri Jul 09, 2004 5:18 pm

Re: othermeta/name/content completion framework extension

Post by Radu »

Hi,
The meta.xsl stylesheet you attached is still invalid, if you open and validate it, Oxygen reports a validation error.
Anyway, I made it valid, and made some more changes on my side, attaching the modifications I made on my side for the "resources" folder in the DITA Map framework extension folder. I think these changes should work also with version 23.1 but I did not test with it.
resources.zip
(6.07 KiB) Downloaded 67 times
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
stephanie-m
Posts: 3
Joined: Tue Apr 09, 2024 10:17 pm

Re: othermeta/name/content completion framework extension

Post by stephanie-m »

Thanks, Radu! That worked!
I completely missed the extra / in the code. Thanks for catching that.
Post Reply