|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<xsl:stylesheet version="1.0" |
| 3 | + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
| 4 | + xmlns:bom="http://cyclonedx.org/schema/bom/1.6" |
| 5 | + exclude-result-prefixes="bom"> |
| 6 | + |
| 7 | + <xsl:output method="html" encoding="UTF-8" indent="yes"/> |
| 8 | + |
| 9 | + <xsl:template match="/"> |
| 10 | + <html> |
| 11 | + <head> |
| 12 | + <title>Software Bill of Materials</title> |
| 13 | + <style> |
| 14 | + body { |
| 15 | + font-family: sans-serif; |
| 16 | + margin: 20px; |
| 17 | + background-color: #f0f4fb; |
| 18 | + color: #000; |
| 19 | + } |
| 20 | + h1 { |
| 21 | + text-align: left; |
| 22 | + color: #2c3e50; |
| 23 | + font-size: 2em; |
| 24 | + margin-bottom: 0.5em; |
| 25 | + } |
| 26 | + h2 { |
| 27 | + color: #3a4f7a; |
| 28 | + border-bottom: 2px solid #ccc; |
| 29 | + padding-bottom: 5px; |
| 30 | + margin-top: 40px; |
| 31 | + margin-bottom: 15px; |
| 32 | + } |
| 33 | + table { |
| 34 | + border-collapse: collapse; |
| 35 | + background-color: #fff; |
| 36 | + color: #000; |
| 37 | + margin-top: 10px; |
| 38 | + margin-bottom: 40px; |
| 39 | + border-radius: 6px; |
| 40 | + overflow: hidden; |
| 41 | + } |
| 42 | + .metadata-table { |
| 43 | + width: auto; |
| 44 | + margin: 0; |
| 45 | + padding: 0; |
| 46 | + } |
| 47 | + th, td { |
| 48 | + padding: 10px 10px; |
| 49 | + text-align: left; |
| 50 | + border-bottom: 1px solid #ccc; |
| 51 | + } |
| 52 | + tr { |
| 53 | + line-height: 2; |
| 54 | + } |
| 55 | + th { |
| 56 | + background-color: #d0def0; |
| 57 | + font-weight: bold; |
| 58 | + color: #1b2e4b; |
| 59 | + } |
| 60 | + a { |
| 61 | + color: #003366; |
| 62 | + text-decoration: none; |
| 63 | + } |
| 64 | + a:hover { |
| 65 | + text-decoration: underline; |
| 66 | + } |
| 67 | + .footer { |
| 68 | + margin-top: 50px; |
| 69 | + font-size: 0.9em; |
| 70 | + color: #666; |
| 71 | + text-align: center; |
| 72 | + } |
| 73 | + ul { |
| 74 | + list-style: none; |
| 75 | + padding: 0; |
| 76 | + margin: 10px 0 30px 0; |
| 77 | + } |
| 78 | + li { |
| 79 | + margin-bottom: 5px; |
| 80 | + } |
| 81 | + .index a { |
| 82 | + color: #000; |
| 83 | + text-decoration: underline; |
| 84 | + } |
| 85 | + .back-to-top { |
| 86 | + display: inline-block; |
| 87 | + margin-top: 20px; |
| 88 | + font-size: 0.9em; |
| 89 | + color: #003366; |
| 90 | + text-decoration: none; |
| 91 | + } |
| 92 | + .back-to-top::before { |
| 93 | + content: "↑ "; |
| 94 | + font-weight: bold; |
| 95 | + margin-right: 4px; |
| 96 | + } |
| 97 | + .back-to-top:hover { |
| 98 | + text-decoration: underline; |
| 99 | + } |
| 100 | + </style> |
| 101 | + </head> |
| 102 | + <body> |
| 103 | + <h1>Software Bill of Materials - ownCloud Android app</h1> |
| 104 | + |
| 105 | + <div class="index"> |
| 106 | + <h2>Index</h2> |
| 107 | + <ul> |
| 108 | + <li><a href="#metadata">Metadata</a></li> |
| 109 | + <li><a href="#components">Components</a></li> |
| 110 | + </ul> |
| 111 | + </div> |
| 112 | + |
| 113 | + <!-- Metadata Section --> |
| 114 | + <h2 id="metadata">Metadata</h2> |
| 115 | + <table class="metadata-table"> |
| 116 | + <tr><th>Creation Date</th><td><xsl:call-template name="format-date"><xsl:with-param name="timestamp" select="bom:bom/bom:metadata/bom:timestamp"/></xsl:call-template></td></tr> |
| 117 | + <tr><th>Generated by</th> |
| 118 | + <td> |
| 119 | + <xsl:for-each select="bom:bom/bom:metadata/bom:tools/bom:components/bom:component"> |
| 120 | + <xsl:value-of select="bom:name"/> <xsl:text> </xsl:text><xsl:value-of select="bom:version"/> |
| 121 | + </xsl:for-each> |
| 122 | + </td> |
| 123 | + </tr> |
| 124 | + </table> |
| 125 | + |
| 126 | + <!-- Components Section --> |
| 127 | + <h2 id="components">Components</h2> |
| 128 | + <table style="width: 100%;"> |
| 129 | + <tr> |
| 130 | + <th style="width: 10%;">Type</th> |
| 131 | + <th style="width: 15%;">Group</th> |
| 132 | + <th style="width: 20%;">Name</th> |
| 133 | + <th style="width: 10%;">Version</th> |
| 134 | + <th style="width: 10%;">License</th> |
| 135 | + <th style="width: 35%;">PURL</th> |
| 136 | + </tr> |
| 137 | + <xsl:for-each select="bom:bom/bom:components/bom:component"> |
| 138 | + <tr> |
| 139 | + <td><xsl:value-of select="@type"/></td> |
| 140 | + <td><xsl:value-of select="bom:group"/></td> |
| 141 | + <td><xsl:value-of select="bom:name"/></td> |
| 142 | + <td><xsl:value-of select="bom:version"/></td> |
| 143 | + <td><xsl:value-of select="bom:licenses/bom:license/bom:id"/></td> |
| 144 | + <td><xsl:value-of select="bom:purl"/></td> |
| 145 | + </tr> |
| 146 | + </xsl:for-each> |
| 147 | + </table> |
| 148 | + |
| 149 | + <div><a class="back-to-top" href="#metadata">Back to top</a></div> |
| 150 | + |
| 151 | + <div class="footer"> |
| 152 | + Document generated from CycloneDX SBOM using XSLT styling. |
| 153 | + </div> |
| 154 | + </body> |
| 155 | + </html> |
| 156 | + </xsl:template> |
| 157 | + |
| 158 | + <!-- Helper: Convert ISO timestamp to readable date --> |
| 159 | + <xsl:template name="format-date"> |
| 160 | + <xsl:param name="timestamp"/> |
| 161 | + <xsl:variable name="year" select="substring($timestamp, 1, 4)"/> |
| 162 | + <xsl:variable name="month" select="substring($timestamp, 6, 2)"/> |
| 163 | + <xsl:variable name="day" select="substring($timestamp, 9, 2)"/> |
| 164 | + <xsl:variable name="hour" select="substring($timestamp, 12, 2)"/> |
| 165 | + <xsl:variable name="minute" select="substring($timestamp, 15, 2)"/> |
| 166 | + <xsl:variable name="monthName"> |
| 167 | + <xsl:choose> |
| 168 | + <xsl:when test="$month = '01'">January</xsl:when> |
| 169 | + <xsl:when test="$month = '02'">February</xsl:when> |
| 170 | + <xsl:when test="$month = '03'">March</xsl:when> |
| 171 | + <xsl:when test="$month = '04'">April</xsl:when> |
| 172 | + <xsl:when test="$month = '05'">May</xsl:when> |
| 173 | + <xsl:when test="$month = '06'">June</xsl:when> |
| 174 | + <xsl:when test="$month = '07'">July</xsl:when> |
| 175 | + <xsl:when test="$month = '08'">August</xsl:when> |
| 176 | + <xsl:when test="$month = '09'">September</xsl:when> |
| 177 | + <xsl:when test="$month = '10'">October</xsl:when> |
| 178 | + <xsl:when test="$month = '11'">November</xsl:when> |
| 179 | + <xsl:when test="$month = '12'">December</xsl:when> |
| 180 | + <xsl:otherwise>Unknown</xsl:otherwise> |
| 181 | + </xsl:choose> |
| 182 | + </xsl:variable> |
| 183 | + <xsl:value-of select="concat($day, ' ', $monthName, ' ', $year, ', ', $hour, ':', $minute, ' UTC')"/> |
| 184 | + </xsl:template> |
| 185 | + |
| 186 | +</xsl:stylesheet> |
| 187 | + |
0 commit comments