<#--
/* Copyright 2009 ISP RAS (http://www.ispras.ru), UniTESK Lab (http://www.unitesk.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 *
 *
 * THIS TEMPLATE GENERATES AN XML REPRESENTATION OF THE REQUIREMENT TREE DEVELOPED WITH THE REQUALITY TOOL
 *
 * OUTPUT EXAMPLE:
 * <problems category="ru.ispras.masiw.plugin.aadl.validator">
 *   <problem id="v01">
 *     <text>Short description of the problem</text>
 *     <description>Full description of the problem</description>
 *     <requirement>An excerpt from the standard</requirement>
 *     ...
 *     <requirement>An excerpt from the standard</requirement>
 *   </problem>
 *   <problem id="v02">
 *   ...
 *   </problem>
 * </problems>
 */
 -->
 <#macro showreq req>
 	<#local root = req/>
 	<#local childrenList = root.getSortedChildren()/>
 	<#if root.getAttributeValue("category")?has_content>
		 <#local category = root.getAttributeValue("category")/>
	<#else>
		<#local category = ""/>
	</#if>
	<problems category="${report.htmlEscape(category)}">
 	<#list childrenList as child>
 		<#if child.getType() = "Requirement">
            <#if child.getAttributeValue("text")?has_content>
		 		<#local text = child.getAttributeValue("text")/>
		 	<#else>
		 		<#local text = ""/>	
		 	</#if>
		 	<#if child.getDescription()?has_content>
		 		<#local description = child.getDescription()/>
		 	<#else>
		 		<#local description = ""/>	
		 	</#if>	
		 	<problem id="${report.htmlEscape(child.getId())}">
		 		<text>${text}</text>
		 		<description>${description}</description>
		 		<#list child.getLocations() as location>
			 		<requirement>
				 		<#if !location.isHidden()>
		                    ${location.getDescription(reportLocation)}
		                </#if>
		            </requirement>    
		 		</#list>
		 	</problem>
        </#if>
 	</#list>
 	</problems> 	
 </#macro>
 
<?xml version="1.0" ?>
<@showreq rootReq/>


