Formatting results in the "Results pane"
Posted: Fri Apr 28, 2017 7:33 pm
Hello.
I’m working on a Schematron rule that detects forbidden words in DITA topics and triggers warning messages in the Results pane, suggesting different types of solutions in each case.
In order to better explain my situation, I include a simplified version of this pattern:
In the description column of the Results pane, the following messages are displayed for each context=text() that contains forbidden words:
- [ISO SCHEMATRON] This word should not be used: WordA.
- [ISO SCHEMATRON] This word should not be used: WordB.
- [ISO SCHEMATRON] This word should not be used: WordC.
- [ISO SCHEMATRON] This word should not be used: WordA. This word should…
Depending on the context, it could happen that more than one word is detected. As in the last example, the list becomes too long, so it gets hidden. To see the complete description, the user has to press F2:
- [ISO SCHEMATRON] This word should not be used: WordA.
- [ISO SCHEMATRON] This word should not be used: WordA.
This word should not be used: WordB.
This word should not be used: WordC.
This word should not be used: WordD.
<!--Where the first message refers to context A: the first paragraph of the topic, and the second message refers to context B: the second paragraph of the topic-->
Do you have any suggestions on how I could do this?
Thanks in advance,
Grethel.
I’m working on a Schematron rule that detects forbidden words in DITA topics and triggers warning messages in the Results pane, suggesting different types of solutions in each case.
In order to better explain my situation, I include a simplified version of this pattern:
Code: Select all
<sch:pattern id="example">
<sch:rule id=" example1" context="*[contains(@class, ' topic/topic ')]//text()">
<xsl:variable name="context" select="."/>
<xsl:variable name="list-words">
<xsl:for-each select="document('list_of_words.dita')//tbody/row/entry[1]">
<xsl:variable name="word" select="."/>
<xsl:if test="matches($context, $word, 'i')">
<xsl:value-of select="concat('|message|This word should not be used: ', $word, '., ')"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<sch:report test="string-length($list-words) > 0" role="warning">
<xsl:for-each select="tokenize($list-words, ', ')">
<xsl:value-of select="substring-after(.,'|message|')"/>
</xsl:for-each>
</sch:report>
</sch:rule>
</sch:pattern>
- [ISO SCHEMATRON] This word should not be used: WordA.
- [ISO SCHEMATRON] This word should not be used: WordB.
- [ISO SCHEMATRON] This word should not be used: WordC.
- [ISO SCHEMATRON] This word should not be used: WordA. This word should…
Depending on the context, it could happen that more than one word is detected. As in the last example, the list becomes too long, so it gets hidden. To see the complete description, the user has to press F2:
What I would like to do is to be able to see the whole list in the Results pane, without pressing F2. It would also be easier for users if the messages that belong to the same context could be listed one under the other. The ideal result would look like:This word should not be used: WordA. This word should not be used: WordB. This word should not be used: WordC. This word should not be used: WordD.
- [ISO SCHEMATRON] This word should not be used: WordA.
- [ISO SCHEMATRON] This word should not be used: WordA.
This word should not be used: WordB.
This word should not be used: WordC.
This word should not be used: WordD.
<!--Where the first message refers to context A: the first paragraph of the topic, and the second message refers to context B: the second paragraph of the topic-->
Do you have any suggestions on how I could do this?
Thanks in advance,
Grethel.