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

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


Article ID: 259579


Updated On:


CA API Gateway


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!!



Release : 10.1


These values key in on messages.

Input of X

<?xml version = "1.0"?> 
<?xml-stylesheet type = "text/xsl" href = "students.xsl"?> 
   <student rollno = "393"> 
   <student rollno = "493"> 
   <student rollno = "593"> 

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="/"> 
            <table border="1"> 
               <tr bgcolor="#9acd32"> 
                  <th>Roll No</th> 
                  <th>First Name</th> 
                  <th>Last Name</th> 
                  <th>Nick Name</th> 
               <xsl:for-each select="class/student"> 
                  <xsl:if test="firstname = ''"> 
                     <xsl:message terminate="no">A first name field is empty. 
                     <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> 

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. 

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