External File for content completion

Having trouble deploying Oxygen XML Web Author? Got a bug to report? Post it all here.
kwun
Posts: 12
Joined: Fri Mar 04, 2022 12:27 pm

External File for content completion

Post by kwun »

Hi guys,
I have a question regarding content completion ... I asked a year ago but due to unforeseen events I never got to actually follow up on my questions...
(c.f. : topic24263.html)

long story short, I am the technical person in a large project where my colleagues work on editing stuff on a server, they are the most un-techy people that you will ever meet, so any configuration needs to be done server-side with little to no action requierd by them...
they want to use content completion to enter ids and stuff for tagged entities, etc.

Is there a way where people can hit [CTRL]+ [SPACE] and get content suggestions, such as <rs type={id}> ... </rs>
after reading, and probably misunderstanding the documentation, it feels like they always need to set it up on their own computers somehow, to which I don't have admin-access. I am, however, an admin for the exist-db that they are using.

Our structure, I have full access here:

Code: Select all

server/project/texts/{some_text_to_be_edited} 
server/project/xsl/{the_xsl_file}
server/project/*/{some_other_dirs}
Is there a way that does not need me to access their computer for them to get content completion?
(sorry, I didn't find the documentation helpful when it comes to this aspect :-( )
alex_jitianu
Posts: 1015
Joined: Wed Nov 16, 2005 11:11 am

Re: External File for content completion

Post by alex_jitianu »

Hi,

Do you use Oxygen project files? If you do, then you can save the content completion configuration that I've mentioned in the other post in a TEI framework extension saved at project level. This way your colleagues will benefit from the customization without the need to do something extra on their machines.

Best regards,
Alex
kwun
Posts: 12
Joined: Fri Mar 04, 2022 12:27 pm

Re: External File for content completion

Post by kwun »

Good morning :-)

Thanks for your reply!
not yet, since they thought it not intuitive enoug, to use them ...

How would I go about setting the autocompletionup in a Project? maybe this would convince them to use project-files ...
Also: can I somehow utilise projects to have all the connections to our exist-db in there so that I can just share the project and have everything set up?
https://www.oxygenxml.com/doc/versions/ ... lt_script
There, the line 3.b and 3.c are unclear to me, sorry, I feel a little stupid :-D
I have to copy the TEI P5 under document type association, let's say I name it rather creatively TEI P5 - copy. and in frameworks/tei/resources/ I add a cc_config.xml, I am confused ...
1) Do I have to copy the folder (tei) in frameworks and rename it accordingly?
2) Should I recreate the path in the project or is it enough to just have one folder "autocomplete" and put the files there?
3) Can I just put the resources-folder from my project on the classpath *after* the resources-path for the pre-existing resources folder?
my current setup:
image.png
image.png (17.47 KiB) Viewed 1267 times
Last edited by kwun on Thu Sep 14, 2023 11:26 am, edited 3 times in total.
alex_jitianu
Posts: 1015
Joined: Wed Nov 16, 2005 11:11 am

Re: External File for content completion

Post by alex_jitianu »

Hi,

There's always room for improvement in the documentation!

A couple of aspects to clarify, before giving a recommendation. What Oxygen version are you running? Are you using the buil-in TEI P5 framework or have you customize it or extended?

Assuming that you currently rely on the built-in TEI P5 framework, I would recommend to:
- Create an Oxygen project, *.xpr file and open it inside the Project view.
- go to Options->Preferences on page Document Type Association / Locations and switch it to Project level from the bottom of the page
- in the Additional Frameworks directories section add a path like ${pd}/frameworks
- click OK to save all these settings
- create a Framework script that extends TEI P5 and save it for example in <projectDir>/frameworks/my-tei-p5/my-tei-p5.exf

Now it's time to create the content completion configuration file:
- I suggest creating a new file <projectDir>/frameworks/my-tei-p5/resources/cc_config_ext.xml using the new document template Content Completion Configuration. The invoked XSLT file can sit next to the configuration file.

The next step is to link the framework configuration to the cc_config_ext.xml file :
- edit the my-tei-p5.exf and add a block like this:

Code: Select all

  <classpath inherit="all">
    <addEntry path="${framework}/resources" position="before"/>
  </classpath>
Also: can I somehow utilise projects to have all the connections to our exist-db in there so that I can just share the project and have everything set up?
Unfortunately, no. Database connections passwords are encrypted in a way that doesn't make them sharable through the project.

Best regards,
Alex
kwun
Posts: 12
Joined: Fri Mar 04, 2022 12:27 pm

Re: External File for content completion

Post by kwun »

Hi, thanks for your response, again :-)
What Oxygen version are you running?
We have 25 and 24 running in the team
Are you using the buil-in TEI P5 framework or have you customize it or extended?
yes, we are using the built-in, but I can jsut make a copy of that as a project.

I will try to follow the rest of your post and get back here once I've done that :-)

You are really helpful and I am grateful for the help! :-)
kwun
Posts: 12
Joined: Fri Mar 04, 2022 12:27 pm

Re: External File for content completion

Post by kwun »

Hi there,
sorry for the long break, I've been to conferences and thus too busy for this :-D
I think I followed all your steps to the point.
image.png
image.png (20 KiB) Viewed 1096 times
Now, something is happening:
I don't even get the suggestions from inside the xml-file, anymore, so I guess it goes looking for stuff *somewhere*

Can you maybe provide some more help?

my-tei-5p:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!-- 

The file must be saved inside a framework directory, the same place where a *.framework file should sit.

To generate a *.framework file out of the script, you need to use the "Compile Framework Extension script" action 
from the contextual menu.
-->
<script xmlns="http://www.oxygenxml.com/ns/framework/extend"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.oxygenxml.com/ns/framework/extend http://www.oxygenxml.com/ns/framework/extend/frameworkExtensionScript.xsd"
  base="">
  <name>TEI cusotimisation for ZEiD-Projects</name>
  <description/>
  <priority>High</priority>
  
  <author>
    <!-- 
      Author Actions are loaded from these directories:
      {framework_directory}/externalAuthorActions
      {framework_directory}/{framework_file_name}_externalAuthorActions
      
      https://www.oxygenxml.com/doc/versions/22.1/ug-editor/topics/dg-create-custom-actions.html#dg-create-custom-actions__section_2
    -->
    <toolbars>
      <toolbar>
        <separator/>
        <addAction id="insert.note"/>
      </toolbar>
      
    </toolbars>
    
    <contextualMenu>
      <submenu name="Other actions">
        <addAction id="insert.note"/>
      </submenu>
    </contextualMenu>
    
    <contentCompletion>
      <authorActions>
        <addAction id="insert.note" replacedElement="note" inCCWindow="true"/> 
      </authorActions>
    </contentCompletion>
  </author>
  
  <classpath inherit="all">
    <addEntry path="${framework}/resources" position="before"/>
  </classpath>
  
</script>
cc_config_ext.xml (I skipped the header for breviety in the post, I commented everything that was in there out)

Code: Select all

    <valueProposals path="rs/@ref">
        <xslt href="get_values_from_db.xsl" useCache="false" action="replace"/>
    </valueProposals>
not sure this one is correct:
image.png
image.png (80.53 KiB) Viewed 1096 times
the folder in which my index-files are stored is this one:
image.png
image.png (21.65 KiB) Viewed 1096 times

and finally my get_values_rfom_db.xsl, just to be sure:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:editorAccess="java:ro.sync.exml.workspace.api.editor.WSEditor" xmlns:textpage="java:ro.sync.exml.workspace.api.editor.page.text.xml.WSXMLTextEditorPage" xmlns:work="java:ro.sync.exml.workspace.api.PluginWorkspace" xmlns:saxon="http://saxon.sf.net/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:prov="java:ro.sync.exml.workspace.api.PluginWorkspaceProvider" exclude-result-prefixes="#all" version="3.0">
    
    <xsl:param name="contextElementXPathExpression" as="xs:string"/>
    <xsl:param name="documentSystemID" as="xs:string"/>
    
    <xsl:template name="start">
        <xsl:variable name="workspace" select="prov:getPluginWorkspace()"/>
        <xsl:variable name="editorAccess" select="work:getEditorAccess($workspace, xs:anyURI($documentSystemID), 0)"/>
        <xsl:variable name="pageID" as="xs:string" select="editorAccess:getCurrentPageID($editorAccess)"/>
        <xsl:variable name="textpage" select="editorAccess:getCurrentPage($editorAccess)"/>
        <xsl:variable name="type" select="textpage:evaluateXPath($textpage, $contextElementXPathExpression)/@type" as="xs:string"/>
        
        <xsl:variable name="entries">
            <xsl:choose>
                <xsl:when test="$type = 'person'">
                    <xsl:sequence select="doc('${pd}/index/listPerson.xml')//*:person"/>
                </xsl:when>
                <xsl:when test="$type = 'place'">
                    <xsl:sequence select="doc('${pd}/index/listPlace.xml')//*:place"/>
                </xsl:when>
                <xsl:when test="$type = 'bibl'">
                    <xsl:sequence select="doc('${pd}/index/listBibl.xml')//*:bibl"/>
                </xsl:when>
            </xsl:choose>
        </xsl:variable>
        
        <items action="replace">
            <xsl:apply-templates select="$entries">
                <xsl:sort select="@xml:id"/> 
            </xsl:apply-templates>
        </items>
    </xsl:template>
    
    <xsl:template match="*:person">
        <item value="#{@xml:id}" annotation="{normalize-space(*:persName[1])}"/>
    </xsl:template>
    
    <xsl:template match="*:place">
        <item value="#{@xml:id}" annotation="{normalize-space(*:placeName[1])}"/>
    </xsl:template>
    
    <xsl:template match="*:bibl">
        <item value="#{@xml:id}" annotation="{normalize-space(*:abbr[1])}"/>
    </xsl:template>
</xsl:stylesheet>
edit, bcs I overlooked it:
I receive this error message:
Fehlerlevel: error
Beschreibung: Couldn't load custom extension from class: ro.sync.ecss.extensions.tei.TEIP5ExtensionsBundle because: Could not load class: ro.sync.ecss.extensions.tei.TEIP5ExtensionsBundle
edit2:
I don't know why, but somehow I ended up with two document-types:
image.png
image.png (17.17 KiB) Viewed 1094 times
(the first one, I created with the new -> assistant), while TEI P5 - EuReD-autocomplete is my project-name.
I hope I am not overstretching your helpfulnes :-(
Attachments
image.png
image.png (205.82 KiB) Viewed 1096 times
Last edited by kwun on Mon Oct 02, 2023 10:17 am, edited 3 times in total.
Post Reply