<commit_before><?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:fn="http://www.w3.org/2005/xpath-functions"
  

  xmlns:cybox="http://cybox.mitre.org/cybox-2"
  xmlns:Common="http://cybox.mitre.org/common-2"
  xmlns:stixCommon="http://stix.mitre.org/common-1"

  xmlns:AddressObject='http://cybox.mitre.org/objects#AddressObject-2'
  xmlns:URIObject='http://cybox.mitre.org/objects#URIObject-2'
  xmlns:cyboxEmail="http://cybox.mitre.org/objects#EmailMessageObject-2"
  xmlns:registry='http://cybox.mitre.org/objects#WinRegistryKeyObject-2'
  
  xmlns:http='http://cybox.mitre.org/objects#HTTPSessionObject-2'
  
  exclude-result-prefixes="cybox Common xsi fn cyboxEmail AddressObject URIObject xs registry"
  
  version="2.0">
  
  <xsl:include href="cybox_util.xsl" />
  
  <!--
    ····························································
  -->
  
  <!--
      Output URI & Link value without unnecessary nested schema tree structure
    -->
  <xsl:template match="cybox:Properties[fn:resolve-QName(fn:data(@xsi:type), .)=fn:QName('http://cybox.mitre.org/objects#URIObject-2', 'URIObjectType')]|cybox:Properties[fn:resolve-QName(fn:data(@xsi:type), .)=fn:QName('http://cybox.mitre.org/objects#URIObject-2', 'LinkObjectType')]"><fieldset>
    <legend>URI</legend>
    <div class="container cyboxPropertiesContainer cyboxProperties">
      <div class="heading cyboxPropertiesHeading cyboxProperties">
        <xsl:apply-templates select="URIObject:Value" mode="cyboxProperties" />
      </div>
    </div>
  </fieldset>
  </xsl:template>
  <xsl:template match="URIObject:Value" mode="cyboxProperties">
    Value <xsl:value-of select="Common:Defanged(@is_defanged, @defanging_algorithm_ref)" />
    <xsl:choose>
      <xsl:when test="@condition!=''"><xsl:value-of select="Common:ConditionType(@condition)" /></xsl:when>
      <xsl:otherwise> = </xsl:otherwise>
    </xsl:choose>
    <xsl:value-of select="." />
  </xsl:template>
  
  <!--
    ····························································
  -->
  
  
  <!--
    purpose: template for processing windows registry entry with more common
    sense output formatting [making use of hive, key, and value(s)].
  -->
  <!--
    <cybox:Properties xsi:type="WinRegistryKeyObject:WindowsRegistryKeyObjectType">
			<WinRegistryKeyObject:Key condition="Equals">SOFTWARE\Microsoft\Windows\CurrentVersion\Run</WinRegistryKeyObject:Key>
			<WinRegistryKeyObject:Hive condition="Equals">HKLM</WinRegistryKeyObject:Hive>
			<WinRegistryKeyObject:Values>
				<WinRegistryKeyObject:Value>
					<WinRegistryKeyObject:Data condition="FitsPattern">rundll32\.exe C:\\DOCUME~1\\USER\\LOCALS~1\\Temp\\[^.]+\.dll&comma;XMLResFunc [^ ]+ 0</WinRegistryKeyObject:Data>
				</WinRegistryKeyObject:Value>
			</WinRegistryKeyObject:Values>
		</cybox:Properties>    
  -->
  <xsl:template match="cybox:Properties[fn:resolve-QName(fn:data(@xsi:type), .)=fn:QName('http://cybox.mitre.org/objects#WinRegistryKeyObject-2', 'WindowsRegistryKeyObjectType')]">
    <xsl:variable name="hive" as="xs:string?" select="registry:Hive" />
    <xsl:variable name="key" as="xs:string?" select="registry:Key" />
    <xsl:variable name="valueDataSequence" as="element()*" select="registry:Values/registry:Value/registry:Data" />
    <xsl:variable name="valueSequence" as="element()*" select="registry:Values/registry:Value" />
    
    <table class="windowsRegistryTable">
      <thead>
        <tr>
          <th rowspan="2">Location</th>
          <th>Hive:</th>
          <td><xsl:value-of select="$hive" /></td>
        </tr>
        <tr>
          <th>Key:</th>
          <td><xsl:value-of select="$key" /></td>
        </tr>
      </thead>
      <xsl:for-each select="$valueSequence">
        <tbody>
          <xsl:if test="$valueSequence/registry:Name/text()">
            <tr>
              <th colspan="3">Name</th>
            </tr>
            <td colspan="3">
              <xsl:value-of select="$valueSequence/registry:Name/text()" />
            </td>
          </xsl:if>
          <xsl:if test="$valueSequence/registry:Data/text()">
            <tr>
              <th colspan="3">Value<xsl:value-of select="if (count($valueSequence/registry:Data) > 1) then 's' else ''" /></th>
            </tr>
            <xsl:for-each select="$valueSequence/registry:Data">
              <tr>
                <td colspan="3">
                  <xsl:value-of select="text()" />
                </td>
              </tr>
            </xsl:for-each>
          </xsl:if>
          
        </tbody>
      </xsl:for-each>
    </table>
    
  </xsl:template>  
  <!--
    ····························································
  -->
  
  <!--
    purpose: templates for process http request-response objects
  -->
  <xsl:template match="http:HTTP_Request_Response|cybox:Properties[fn:resolve-QName(fn:data(@xsi:type), .)=fn:QName('http://cybox.mitre.org/objects#HTTPSessionObject-2', 'HTTP_Request_Response')]" mode="cyboxProperties">
    <xsl:apply-templates select="." />
  </xsl:template>
  
  <xsl:template match="http:HTTP_Request_Response|cybox:Properties[fn:resolve-QName(fn:data(@xsi:type), .)=fn:QName('http://cybox.mitre.org/objects#HTTPSessionObject-2', 'HTTP_Request_Response')]">
    <xsl:variable name="mainRequestResponse" as="element()*" select="." />
    <xsl:variable name="mainRequest" as="element()?" select="$mainRequestResponse/http:HTTP_Client_Request" />
    <xsl:variable name="mainResponse" as="element()?" select="$mainRequestResponse/http:HTTP_Server_Response" />
    
    <xsl:variable name="requestLine" select="$mainRequest/http:HTTP_Request_Line" />
    <xsl:variable name="method" select="$requestLine/http:HTTP_Method" /><commit_msg>now displaying "@condition" attributes on hive, key, name, and data elements.<commit_after><?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:fn="http://www.w3.org/2005/xpath-functions"
  

  xmlns:cybox="http://cybox.mitre.org/cybox-2"
  xmlns:Common="http://cybox.mitre.org/common-2"
  xmlns:stixCommon="http://stix.mitre.org/common-1"

  xmlns:AddressObject='http://cybox.mitre.org/objects#AddressObject-2'
  xmlns:URIObject='http://cybox.mitre.org/objects#URIObject-2'
  xmlns:cyboxEmail="http://cybox.mitre.org/objects#EmailMessageObject-2"
  xmlns:registry='http://cybox.mitre.org/objects#WinRegistryKeyObject-2'
  
  xmlns:http='http://cybox.mitre.org/objects#HTTPSessionObject-2'
  
  exclude-result-prefixes="cybox Common xsi fn cyboxEmail AddressObject URIObject xs registry"
  
  version="2.0">
  
  <xsl:include href="cybox_util.xsl" />
  
  <!--
    ····························································
  -->
  
  <!--
      Output URI & Link value without unnecessary nested schema tree structure
    -->
  <xsl:template match="cybox:Properties[fn:resolve-QName(fn:data(@xsi:type), .)=fn:QName('http://cybox.mitre.org/objects#URIObject-2', 'URIObjectType')]|cybox:Properties[fn:resolve-QName(fn:data(@xsi:type), .)=fn:QName('http://cybox.mitre.org/objects#URIObject-2', 'LinkObjectType')]"><fieldset>
    <legend>URI</legend>
    <div class="container cyboxPropertiesContainer cyboxProperties">
      <div class="heading cyboxPropertiesHeading cyboxProperties">
        <xsl:apply-templates select="URIObject:Value" mode="cyboxProperties" />
      </div>
    </div>
  </fieldset>
  </xsl:template>
  <xsl:template match="URIObject:Value" mode="cyboxProperties">
    Value <xsl:value-of select="Common:Defanged(@is_defanged, @defanging_algorithm_ref)" />
    <xsl:choose>
      <xsl:when test="@condition!=''"><xsl:value-of select="Common:ConditionType(@condition)" /></xsl:when>
      <xsl:otherwise> = </xsl:otherwise>
    </xsl:choose>
    <xsl:value-of select="." />
  </xsl:template>
  
  <!--
    ····························································
  -->
  
  
  <!--
    purpose: template for processing windows registry entry with more common
    sense output formatting [making use of hive, key, and value(s)].
  -->
  <!--
    <cybox:Properties xsi:type="WinRegistryKeyObject:WindowsRegistryKeyObjectType">
			<WinRegistryKeyObject:Key condition="Equals">SOFTWARE\Microsoft\Windows\CurrentVersion\Run</WinRegistryKeyObject:Key>
			<WinRegistryKeyObject:Hive condition="Equals">HKLM</WinRegistryKeyObject:Hive>
			<WinRegistryKeyObject:Values>
				<WinRegistryKeyObject:Value>
					<WinRegistryKeyObject:Data condition="FitsPattern">rundll32\.exe C:\\DOCUME~1\\USER\\LOCALS~1\\Temp\\[^.]+\.dll&comma;XMLResFunc [^ ]+ 0</WinRegistryKeyObject:Data>
				</WinRegistryKeyObject:Value>
			</WinRegistryKeyObject:Values>
		</cybox:Properties>    
  -->
  <xsl:template match="cybox:Properties[fn:resolve-QName(fn:data(@xsi:type), .)=fn:QName('http://cybox.mitre.org/objects#WinRegistryKeyObject-2', 'WindowsRegistryKeyObjectType')]">
    <xsl:variable name="hive" as="element()?" select="registry:Hive" />
    <xsl:variable name="key" as="element()?" select="registry:Key" />
    <xsl:variable name="valueDataSequence" as="element()*" select="registry:Values/registry:Value/registry:Data" />
    <xsl:variable name="valueSequence" as="element()*" select="registry:Values/registry:Value" />
    
    <table class="windowsRegistryTable">
      <thead>
        <tr>
          <th rowspan="2">Location</th>
          <th>Hive:</th>
          <td>
            <div>
              <xsl:apply-templates select="$hive/@condition[. ne 'Equals']" mode="cyboxProperties" />
            </div>
            
            <xsl:value-of select="$hive/text()" />
          </td>
        </tr>
        <tr>
          <th>Key:</th>
          <td>
            <div>
              <xsl:apply-templates select="$key/@condition[. ne 'Equals']" mode="cyboxProperties" />
            </div>
            <xsl:value-of select="$key/text()" />
          </td>
        </tr>
      </thead>
      <xsl:for-each select="$valueSequence">
        <tbody>
          <xsl:for-each select="registry:Name[text()]">
            <tr>
              <th colspan="3">Name</th>
            </tr>
            <td colspan="3">
              <div>
                <xsl:apply-templates select="@condition[. ne 'Equals']" mode="cyboxProperties" />
              </div>
              <xsl:value-of select="text()" />
            </td>
          </xsl:for-each>
          <xsl:if test="registry:Data/text()">
            <tr>
              <th colspan="3">Value<xsl:value-of select="if (count(registry:Data) > 1) then 's' else ''" /></th>
            </tr>
            <xsl:for-each select="registry:Data">
              <tr>
                <td colspan="3">
                  <div>
                    <xsl:apply-templates select="@condition[. ne 'Equals']"  mode="cyboxProperties" />
                  </div>
                  <xsl:value-of select="text()" />
                </td>
              </tr>
            </xsl:for-each>
          </xsl:if>
          
        </tbody>
      </xsl:for-each>
    </table>
    
  </xsl:template>  
  <!--
    ····························································
  -->
  
  <!--
    purpose: templates for process http request-response objects
  -->
  <xsl:template match="http:HTTP_Request_Response|cybox:Properties[fn:resolve-QName(fn:data(@xsi:type), .)=fn:QName('http://cybox.mitre.org/objects#HTTPSessionObject-2', 'HTTP_Request_Response')]" mode="cyboxProperties">
    <xsl:apply-templates select="." />
  </xsl:template>
  
  <xsl:template match="http:HTTP_Request_Response|cybox:Properties[fn:resolve-QName(fn:data(@xsi:type), .)=fn:QName('http://cybox.mitre.org/objects#HTTPSessionObject-2', 'HTTP_Request_Response')]">
    <xsl:variable name="mainRequestResponse" as="element()*" select="." />
    <xsl:variable name="mainRequest" as="element()?" select="$mainRequestResponse/http:HTTP_Client_Request" />
    <xsl:variable name="mainResponse" as="element()?" select="$mainRequestResponse/http:HTTP_Server_Response" />
    
    <xsl:variable name="requestLine" select="$mainRequest/http:HTTP_Request_Line" />
    <xsl:variable name="method" select="$requestLine/http:HTTP_Method" />
{'fraction_non_alphanumeric': 0.2037442256260637, 'fraction_numerical': 0.007942296782559364, 'mean_word_length': 3.495446265938069, 'pattern_counts': {'":': 0, '<': 227, '<?xml version=': 2, '>': 229, 'https://': 0, 'lorem ipsum': 0, 'www.': 8, 'xml': 26}, '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': '1827286', 'n_tokens_mistral': 4469, 'n_tokens_neox': 4052, 'n_words': 508}