Action: XSLT Operation on processing-instruction

Post here questions and problems related to oXygen frameworks/document types.
Posts: 32
Joined: Wed Jun 20, 2018 11:30 am

Action: XSLT Operation on processing-instruction

Post by pieterjan_vdw » 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 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 added an XSLT operation action with below XSLT.
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=""
	xmlns:xs="" version="2.0"
	<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="${}" </xsl:text>
      <xsl:text>reply-referenceid="</xsl:text><xsl:value-of select="$annotationid"/><xsl:text>"</xsl:text>
                                                <xsl:sequence select="
                                                (current-dateTime() - xs:dateTime('1970-01-01T00:00:00'))
                                                xs:dayTimeDuration('PT1S') * 1000"/>
example.png (5.52 KiB) Viewed 474 times

Posts: 20
Joined: Wed Jun 22, 2016 2:48 pm

Re: Action: XSLT Operation on processing-instruction

Post by adrian_sorop » Fri Oct 30, 2020 12:51 pm


By changing template's match to

Code: Select all

I was able to properly get the value of the pseudo attribute "annotation-id" with

Code: Select all

With other words, the only change I've made was

Code: Select all

<xsl:template match="processing-instruction()">
and the rest of your xsl remained the same.

Let me know how this works.

Best regards,
Adrian S.
Adrian Sorop
<oXygen/> XML Editor

Post Reply