Skip to main content
4everJang
Legend
April 17, 2014
Answered

How can I suppress processing instructions?

  • April 17, 2014
  • 2 replies
  • 887 views

I am writing a structured FM file to XML and then processing it into HTML using XSLT. Writing the file to XML works OK but I cannot get rid of the PIs that FrameMaker puts in the text for all kinds of things (such as conditional text). I have created elements for all the markers I need and want to get rid of any remaining PIs. Is there a way to tell FM about this in the read-write rules?

Thanks for pointing me to the useful source of information about this. I have spent a couple of hours checking the structure application guides but the info remains too cryptic to make it work.

Kind regards

Jang

This topic has been closed for replies.
Correct answer ScottPrentice

Hi Jang...

For conditional text PIs, you can specify various options with the ConditionalText node in the structure application definition for your app. This can eliminate those PIs, but others will remain.

Cheers,

...scott

2 replies

Inspiring
April 17, 2014

Jang,

    Since you are using XSLT anyway, why not just ignore the irrelevant PIs when you generate HTML?

     --Lynne

4everJang
4everJangAuthor
Legend
April 18, 2014

Hi Lynne,

That was my first thought, and it does work but I may not have found the optimal solution, as I keep getting a warning about ambiguous template matches. For myself, that is not a problem but I do not want to deliver a system to a client that gives these warnings on every transform.

I use the 'identity' template and then overrule the PIs so that they are filtered out. I am not an ace in XSLT yet, so I cannot figure out what would be the required template matching definitions. If you can spot it, let me know.

    <xsl:template match="@*|node()">
        
<xsl:copy>
            
<xsl:apply-templates select="@*|node()"/>
        
</xsl:copy>
    
</xsl:template>

    
<xsl:template match="processing-instruction()"/>

Inspiring
April 18, 2014

Jang,

    As you've noted, the problem is that a processing instruction matches both "processing-instruction()" and "node()". There are two ways you can disambiguate the matching:

1. Since "node()" is equivalent to "text() | * | processing-instruction() | comment()", in the first template, change the match attribute to "@* | text() | * | comment()".

2. Leave the match attributes as is, but add priority attributes to both templates. The value of priority is a number. When there are multiple matches, the XSLT processor uses the matching expression with the highest priority. For example, you could use priority="1" for the first template and priority="2" for the second.

--Lynne

ScottPrentice
ScottPrenticeCorrect answer
Inspiring
April 17, 2014

Hi Jang...

For conditional text PIs, you can specify various options with the ConditionalText node in the structure application definition for your app. This can eliminate those PIs, but others will remain.

Cheers,

...scott

4everJang
4everJangAuthor
Legend
April 18, 2014

Hi Scott,

I added the conditional text node as you mentioned and it worked like a breeze. Thanks a lot. It would have been so nice to find a pointer to this in the documentation where "processing instructions" are described. But I guess there are a couple of details about Tech Comms that Adobe still has to learn... :-)

Ciao

Jang