<?xml version="1.0" encoding="UTF-8"?>
<!-- 
    This XSL Stylesheet generates a tab delimited list of references that serves as the CCE
    mapping for all the sources represented in the XCCDF file.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cdf="http://checklists.nist.gov/xccdf/1.1" xmlns="http://checklists.nist.gov/xccdf/1.1" version="2.0">
    <xsl:output method="text"/>
    <xsl:template match="/">
        <!--
            For each rule, print out a tab delimited list of references.  This list can then be
            copied into a spreadsheet for easier viewing.  Note that the reference names need
            to start with the given tags inoder to be picked up.
        -->
        <xsl:for-each select="//cdf:Rule[not(./@hidden='true')]">
            <xsl:value-of select="./cdf:reference[starts-with(., 'CCE')]"/><xsl:text>&#9;</xsl:text>
            <xsl:value-of select="./cdf:description"/><xsl:text>&#9;</xsl:text>
            <xsl:value-of select="./cdf:reference[starts-with(., '800-68')]"/><xsl:text>&#9;</xsl:text>
            <xsl:value-of select="./cdf:reference[starts-with(., 'DISA STIG')]"/><xsl:text>&#9;</xsl:text>
            <xsl:value-of select="./cdf:reference[starts-with(., 'DISA Gold')]"/><xsl:text>&#9;</xsl:text>
            <xsl:value-of select="./cdf:reference[starts-with(., 'NSA')]"/><xsl:text>&#9;</xsl:text>
            <xsl:for-each select="./cdf:requires">
                <xsl:value-of select="./@idref"/><xsl:text>&#x20;</xsl:text>
            </xsl:for-each><xsl:text>&#9;</xsl:text>
            <xsl:value-of select="./cdf:check/cdf:check-content-ref/@name"/><xsl:text>&#10;</xsl:text>
        </xsl:for-each>
    </xsl:template>
</xsl:stylesheet>
