Filtering requirements in DocGen

We have defined a number of requirements in our model. Some of these are functional, some non-functional, etc. We are using DocGen to generate the SRS, using this:

${ELEMENT, “Requirement paragraphs”, Requirement, SortBy=”group,userID”, LoopInProject, “MyRequirementBasic”}

Where MyRequirementBasic is a template that formats each requirement as we need:

<?xml version="1.0" encoding="UTF-8"?>
<ElementBaseInitiationBlock>
	<Property property="userID" style="@heading+"/><Text style="@heading"> </Text><Property property="name" style="@heading"/>
	<ParagraphBreak/>
	<Property property="description" style="Description"/>
	<ParagraphBreak/>
</ElementBaseInitiationBlock>

I’d like to be able to filter on requirement ‘kind’, so we can have one ${ELEMENT, ...} that only lists functional requirements and in another section of the SRS we have a different ${ELEMENT, ...} that only lists (for example) non-functional requirements.

I was hoping that I could do this via a parameter to the ${ELEMENT, ...} command but I can’t see any way of doing this. Does that mean I need to have two XML templates, and if so how can I filter requirements in XML?

To achieve your goal you will have to add the ValueChecker inside your XML to check on the value of the “kind” property of the requirement. If it match your defined value then it go in the print the data, otherwise the element will be skipped. You can reference to the section 4.7.2 in Doc. Composer Writer’s Guide about the use of ValueChecker.

Hi Rain,

Yes, that worked, thanks. It would be nice if the ${ELEMENT, ...} command supported filtering directly so we didn’t need to duplicate XML templates, but I am now able to group my requirements as needed in the SRS.

As usual, thanks again for your excellent assistance.