Action: XSLT Operation on processing-instruction
Posted: Wed Oct 28, 2020 4:26 pm
Processing-instructions are visible and editable via custom CSS in my custom framework.
Now I would like to add an action (reply to comments) to a custom toolbar in my custom framework. These comments are stored as processing-instructions.
The is the workflow:
I adds the extra comment but it doesn't copy the annotation-ID of the selected processing-instruction in my new processing instruction.
How can I the copy the 'annotation-id' from my selected 'processing-instruction' into my newly created 'processing instruction'?
Now I would like to add an action (reply to comments) to a custom toolbar in my custom framework. These comments are stored as processing-instructions.
The is the workflow:
- I select an existing processing-instruction in author-mode and that processing-instruction has a certain 'attribute' being annotation-id.
For example
Code: Select all
<?annotation-start text="This is an example" annotation-id="a43d6702-5b17-4f11-a4f6-a040df50c88c" author-id="pieterjan.vandenweghe" timestamp=" 1603874838266 "?>
- In my toolbar, I select the action 'Reply' based on an XSLT operation that creates a new processing-instructions with the annotation-ID added from the processing-instruction selected in step 1. The value of this annotation-ID should in this case be added to the attribute reply-referenceid.
I adds the extra comment but it doesn't copy the annotation-ID of the selected processing-instruction in my new processing instruction.
How can I the copy the 'annotation-id' from my selected 'processing-instruction' into my newly created 'processing instruction'?
Code: Select all
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" version="2.0"
xmlns:saxon="http://saxon.sf.net/"
xmlns:oxy="http://www.oxygenxml.com/ns/author/xpath-extension-functions"
exclude-result-prefixes="oxy">
<xsl:template match="*">
<xsl:variable name="annotationid" select="saxon:get-pseudo-attribute('annotation-id')"/>
<xsl:processing-instruction name="annotation-reply">
<xsl:text>text="${ask('Enter comment', input_type, '@WKFS: ')}" </xsl:text>
<xsl:text>annotation-id="${uuid}" </xsl:text>
<xsl:text>author-id="${author.name}" </xsl:text>
<xsl:text>reply-referenceid="</xsl:text><xsl:value-of select="$annotationid"/><xsl:text>"</xsl:text>
<xsl:text>timestamp="</xsl:text>
<xsl:sequence select="
(current-dateTime() - xs:dateTime('1970-01-01T00:00:00'))
div
xs:dayTimeDuration('PT1S') * 1000"/>
<xsl:text>"</xsl:text>
</xsl:processing-instruction>
</xsl:template>
</xsl:stylesheet>