<commit_before># STIX XML -> HTML Transform v1

~~~
Copyright (c) 2013 - The MITRE Corporation
All rights reserved. See LICENSE.txt for complete terms.
~~~

~~~
BY USING THE STIX XML to HTML TRANSFORM, YOU SIGNIFY YOUR ACCEPTANCE OF THE 
TERMS AND CONDITIONS OF USE.  IF YOU DO NOT AGREE TO THESE TERMS, DO NOT USE 
THE STIX XML to HTML TRANSFORM.

For more information, please refer to the terms.txt file.
~~~

## STIX XML to HTML transform v1.0beta2
Compatible with STIX v1.0.1

This is an xslt to transform a stix 1.0/1.0.1 document containing metadata and
different categories of top level items into html for easy viewing.

The first two tables on the output html page are 1) a metadata table
showing information about the input document and when the content was
converted, and 2) information obtained from the stix header element.

Regarding the stix header, we only include very simple support for
the handling instructions for this release.  It will include the text contents
of the simpleMarking:Statement.  The marking:Controlled_Structure with its
xpath is not used yet. 

Currently we support the following top level entities and sub-entities:
- **Observables**
  - All except for Events (this is true for any embedded Observables also)
- **Indicators**
  - Title
  - Description
  - Valid_Time_Position
  - Suggested_COAs
  - Observable
  - Composite_Indicator_Expression
  - Indicated_TTP
  - Kill_Chain_Phases
  - Confidence
- **TTPs**
  - Description
  - Intended_Effect
  - Behavior
  - Resources
  - Victim_Targeting
  - Exploit_Targets
  - Related_TTPs
  - Kill_Chain_Phases
- **Exploit Targets**
  - Title
  - Vulnerability
- **Incidents**
  - Description
  - Status
  - Related_Observables
  - Leveraged_TTPs
  - Observable
- **Courses of Action**
  - All
- **Campaigns**
  - Title
  - Status
  - Related_Incidents
  - Related_TTPs
  - Related_Indicators
- **Threat Actors**
  - Title
  - Identity
  - Type
  - Motivation
  - Observed_TTPs

Each category of top level "items" is turned into a main table on the page.
The item itself is expandable and other nested content pointing to other
"items" and objects are also expandable.

At the moment, "items" are expandable when they have inline content with an
id attribute or when it references content in another part of the document with
an idref attribute.  (Content "item" without an id or idref is displayed
inline.)

Indicator and observable composition is supported.

The contents of description elements are treated as text.  This release does
not handle embedded html documents; they will be displayed as escaped text.

This is a work in progress.  Feedback is most welcome!

requirements:
 - XSLT 2.0 engine (this has been tested with Saxon 9.5)
 - a STIX 1.0/1.0.1 input xml document

## Releases
### current release
 * v1.0beta2  
   2013-10-24  
   https://github.com/STIXProject/Tools/issues?milestone=1&state=open

### previous releases
 * v1.0beta1  
   2013-08-28


## More inforation on STIX

STIX - http://stix.mitre.org

## Included Files

 - **README**: this file.
 - **stix_to_html.xsl**: the top-level STIX XML to HTML XSL Transform.
 - **stix_to_hmtl__customized.xsl**: [not required] example of how to use the stix
   stylesheet and override the default title, header, footer, and css to
   customize the output.
 - **cybox_common.xsl**: common CybOX transformations used by stix_to_html.xsl.
 - **stix_common.xsl**: common stix transformations used by stix_to_html.xsl.
 - **normalize.xsl**: used by stix
 - **icons.xsl**: stylesheet code to read in the svg icons for the main item type logos
 - **common.js**: common javascript code
 - **wgxpath.install.js**: xpath support in javascript for browsers that don't
   support it (IE)  
   [source: http://code.google.com/p/wicked-good-xpath/]
 - **common.css**: common css styles
 - **theme_default.css**: css styles used for main item type background colors
   (observables, ttps, indicators, etc)
 - **images/*.svg and *.svgz**: svg vector images for the main item type logos
   (the *.svg files are used and pulled in via the xsl and included in the
   output html inline)

## Usage Notes

Use with your favorite XML Editor or XSLT 2.0 interpreter (e.g. Saxon).

Here are commands to run a single document or multiple documents through the
stylesheet with Saxon. 

Single file:

~~~
  java -jar /opt/saxon/saxon9he.jar -xsl:xslt/stix_to_html.xsl -s:input.xml -o:output.html
~~~

Directory of files ("inputdir" and "outputdir" are directories):

~~~
  java -jar /opt/saxon/saxon9he.jar -xsl:stix_to_html.xsl -s:inputdir -o:outputdir
~~~


## Customization

The header, footer, title, and css can easily be customized.

Inside stix_to_html.xsl there are three corresponding named templates:
 * customHeader
 * customFooter
 * customTitle
 * customCss
 
The easiest and cleanest way to customize this is to create your own
stylesheet, import stix_to_html.xsl, and then define your own named templates
with the above names.

There is an example of this in stix_to_html__customized.xsl

The css that determines the color scheme for the main top level items
(Observables, TTPs, Indicators, etc) is contained in theme_default.css.  The
colors are defined with css's hsl() color definitions.  The general color can
be tweaked by just adjusting the first parameter, the hue (which is specified
in degrees and varies from 0-359).  By adjusting the saturation and lightness,
the darness or lightness can be adjusted.

There are also three stylesheet parameters that may be used to control the
output.  Each one is a boolean and can be passed in on the command-line or
programatically.

Here are the three stylesheet parameters.  Each one defaults to true.

 * includeFileMetadataHeader
 * includeStixHeader
 * displayConstraints

"includeFileMetadataHeader" determines if the header with the stix version,
filename, and html generation date is going to be displayed.

"includeStixHeader" determines if the header table (generated from the
stix:STIX_Header contents) is dislayed.

"displayContraints" determines if the contraint properties on cybox:Properties
(and other similary formatted data elements) will be displayed.  This includes
such information what type of matching is performed (equals or string match).

<commit_msg>updating for beta3<commit_after># STIX XML -> HTML Transform v1

~~~
Copyright (c) 2014 - The MITRE Corporation
All rights reserved. See LICENSE.txt for complete terms.
~~~

~~~
BY USING THE STIX XML to HTML TRANSFORM, YOU SIGNIFY YOUR ACCEPTANCE OF THE 
TERMS AND CONDITIONS OF USE.  IF YOU DO NOT AGREE TO THESE TERMS, DO NOT USE 
THE STIX XML to HTML TRANSFORM.

For more information, please refer to the terms.txt file.
~~~

## STIX XML to HTML transform v1.0beta3
Compatible with STIX v1.0.1

This is an xslt to transform a stix 1.0/1.0.1 document containing metadata and
different categories of top level items into html for easy viewing.

The first two tables on the output html page are 1) a metadata table
showing information about the input document and when the content was
converted, and 2) information obtained from the stix header element.

Regarding the stix header, we only include very simple support for
the handling instructions for this release.  It will include the text contents
of the simpleMarking:Statement.  The marking:Controlled_Structure with its
xpath is not used yet. 

Currently we support the following top level entities and sub-entities:
- **Observables**
  - All except for Events (this is true for any embedded Observables also)
- **Indicators**
  - Title
  - Description
  - Valid_Time_Position
  - Suggested_COAs
  - Observable
  - Composite_Indicator_Expression
  - Indicated_TTP
  - Kill_Chain_Phases
  - Confidence
- **TTPs**
  - Description
  - Intended_Effect
  - Behavior
  - Resources
  - Victim_Targeting
  - Exploit_Targets
  - Related_TTPs
  - Kill_Chain_Phases
- **Exploit Targets**
  - Title
  - Vulnerability
- **Incidents**
  - Description
  - Status
  - Related_Observables
  - Leveraged_TTPs
  - Observable
- **Courses of Action**
  - All
- **Campaigns**
  - Title
  - Status
  - Related_Incidents
  - Related_TTPs
  - Related_Indicators
- **Threat Actors**
  - Title
  - Identity
  - Type
  - Motivation
  - Observed_TTPs

Each category of top level "items" is turned into a main table on the page.
The item itself is expandable and other nested content pointing to other
"items" and objects are also expandable.

At the moment, "items" are expandable when they have inline content with an
id attribute or when it references content in another part of the document with
an idref attribute.  (Content "item" without an id or idref is displayed
inline.)

Indicator and observable composition is supported.

The contents of description elements are treated as text.  This release does
not handle embedded html documents; they will be displayed as escaped text.

This is a work in progress.  Feedback is most welcome!

requirements:
 - XSLT 2.0 engine (this has been tested with Saxon 9.5)
 - a STIX 1.0/1.0.1 input xml document

## Releases
### current release
 * v1.0beta3
   2014-01-15  
   https://github.com/STIXProject/stix-to-html/issues?direction=desc&milestone=1&page=1&sort=updated&state=closed

### previous releases
 * v1.0beta2  
   2013-10-24  
   https://github.com/STIXProject/Tools/issues?milestone=1&state=open
 * v1.0beta1  
   2013-08-28


## More inforation on STIX

STIX - http://stix.mitre.org

## Included Files

 - **README**: this file.
 - **stix_to_html.xsl**: the top-level STIX XML to HTML XSL Transform.
 - **stix_to_hmtl__customized.xsl**: [not required] example of how to use the stix
   stylesheet and override the default title, header, footer, and css to
   customize the output.
 - **cybox_common.xsl**: common CybOX transformations used by stix_to_html.xsl.
 - **stix_common.xsl**: common stix transformations used by stix_to_html.xsl.
 - **normalize.xsl**: used by stix
 - **icons.xsl**: stylesheet code to read in the svg icons for the main item type logos
 - **common.js**: common javascript code
 - **wgxpath.install.js**: xpath support in javascript for browsers that don't
   support it (IE)  
   [source: http://code.google.com/p/wicked-good-xpath/]
 - **common.css**: common css styles
 - **theme_default.css**: css styles used for main item type background colors
   (observables, ttps, indicators, etc)
 - **images/*.svg and *.svgz**: svg vector images for the main item type logos
   (the *.svg files are used and pulled in via the xsl and included in the
   output html inline)

## Usage Notes

Use with your favorite XML Editor or XSLT 2.0 interpreter (e.g. Saxon).

Here are commands to run a single document or multiple documents through the
stylesheet with Saxon. 

Single file:

~~~
  java -jar /opt/saxon/saxon9he.jar -xsl:xslt/stix_to_html.xsl -s:input.xml -o:output.html
~~~

Directory of files ("inputdir" and "outputdir" are directories):

~~~
  java -jar /opt/saxon/saxon9he.jar -xsl:stix_to_html.xsl -s:inputdir -o:outputdir
~~~


## Customization

The header, footer, title, and css can easily be customized.

Inside stix_to_html.xsl there are three corresponding named templates:
 * customHeader
 * customFooter
 * customTitle
 * customCss
 
The easiest and cleanest way to customize this is to create your own
stylesheet, import stix_to_html.xsl, and then define your own named templates
with the above names.

There is an example of this in stix_to_html__customized.xsl

The css that determines the color scheme for the main top level items
(Observables, TTPs, Indicators, etc) is contained in theme_default.css.  The
colors are defined with css's hsl() color definitions.  The general color can
be tweaked by just adjusting the first parameter, the hue (which is specified
in degrees and varies from 0-359).  By adjusting the saturation and lightness,
the darness or lightness can be adjusted.

There are also three stylesheet parameters that may be used to control the
output.  Each one is a boolean and can be passed in on the command-line or
programatically.

Here are the three stylesheet parameters.  Each one defaults to true.

 * includeFileMetadataHeader
 * includeStixHeader
 * displayConstraints

"includeFileMetadataHeader" determines if the header with the stix version,
filename, and html generation date is going to be displayed.

"includeStixHeader" determines if the header table (generated from the
stix:STIX_Header contents) is dislayed.

"displayContraints" determines if the contraint properties on cybox:Properties
(and other similary formatted data elements) will be displayed.  This includes
such information what type of matching is performed (equals or string match).


{'fraction_non_alphanumeric': 0.07202587567055854, 'fraction_numerical': 0.010255601136005049, 'mean_word_length': 3.923106796116505, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2028329', 'n_tokens_mistral': 3905, 'n_tokens_neox': 3656, 'n_words': 1611}