Output of Apply XSLT Transform messages does not populate as expected.
search cancel

Output of Apply XSLT Transform messages does not populate as expected.

book

Article ID: 259579

calendar_today

Updated On:

Products

CA API Gateway

Issue/Introduction

I am using an Apply XSLT Transformation assertion in my policy and I have set the XSLT Messages Prefix in the assertion to "attributeStatement".

When I run the policy, the policy is succeeding but the CVs "${attributeStatement.messages.first}" and "${attributeStatement.messages.last}" are both empty!!

 

Environment

Release : 10.1

Resolution

These values key in on messages.

Input of X

<?xml version = "1.0"?> 
<?xml-stylesheet type = "text/xsl" href = "students.xsl"?> 
<class> 
   <student rollno = "393"> 
      <firstname>FFFFF</firstname> 
      <lastname>XXXX</lastname> 
      <nickname>Dinkar</nickname> 
      <marks>85</marks> 
   </student> 
   <student rollno = "493"> 
      <firstname>FFFFFF</firstname> 
      <lastname>YYYYYY</lastname> 
      <nickname>Vinni</nickname> 
      <marks>95</marks> 
   </student> 
   <student rollno = "593"> 
      <firstname>FFFFF</firstname> 
      <lastname>ZZZZZZZ</lastname> 
      <nickname>Jazz</nickname> 
      <marks>90</marks> 
   </student> 
</class>

You will note Student 493 Firstname is blank.

XSLT Assertion

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">   
   <xsl:template match="/"> 
      <html> 
         <body> 
            <h2>Students</h2> 
            <table border="1"> 
               <tr bgcolor="#9acd32"> 
                  <th>Roll No</th> 
                  <th>First Name</th> 
                  <th>Last Name</th> 
                  <th>Nick Name</th> 
                  <th>Marks</th> 
               </tr> 
                    
               <xsl:for-each select="class/student"> 
                    
                  <xsl:if test="firstname = ''"> 
                     <xsl:message terminate="no">A first name field is empty. 
                     </xsl:message> 
                  </xsl:if> 
               
                  <tr> 
                     <td><xsl:value-of select="@rollno"/></td> 
                     <td><xsl:value-of select="firstname"/></td> 
                     <td><xsl:value-of select="lastname"/></td>
                     <td><xsl:value-of select="nickname"/></td> 
                     <td><xsl:value-of select="marks"/></td> 
                  </tr> 
               </xsl:for-each> 
            </table> 
         </body> 
      </html> 
   </xsl:template>
</xsl:stylesheet>

I get 1 and only 1 message here about firstname being empty. 


Thats because there is 1 defined message in xslt only for that item in an if when the value is empty.

If I add more xsl:message beyond the end if to produce a message like,

    <xsl:message terminate="no">A first name field is NOT empty. 
                     </xsl:message>  

Then I see additional messages regarding the Not empty firstnames and I see a first and last. in the multivalue context variable.

So the messages (including first and last) are programmed based on your xslt having message attributes