Skip to content

Instantly share code, notes, and snippets.

@bielawb
Last active June 24, 2016 05:27
Show Gist options
  • Save bielawb/68227e931cf81a86f9a3 to your computer and use it in GitHub Desktop.
Save bielawb/68227e931cf81a86f9a3 to your computer and use it in GitHub Desktop.
$Common = @{
Path = 'SomeTables.xhtml'
Namespace = @{
d = 'http://www.w3.org/1999/xhtml'
}
}
Select-Xml -XPath '//d:table[d:tr[@class]]' @Common |
ForEach-Object { $_.Node } | Format-Table -AutoSize
Select-Xml -XPath '//d:table[count(d:tr[@class]) > 1]' @Common |
ForEach-Object { $_.Node } | Format-Table -AutoSize
Select-Xml -XPath '//d:table[count(d:tr[@class]) < count(d:tr[not(@class)])]' @Common |
ForEach-Object { $_.Node } | Format-Table -AutoSize
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Page with tables</title>
<style type="text/css">
<![CDATA[
body {
line-height: 1.6em;
}
table {
font-family: "Tahoma";
font-size: 12px;
margin: 45px;
width: 480px;
text-align: left;
border-collapse: collapse;
}
th {
font-size: 14px;
font-weight: normal;
padding: 10px 8px;
color: #039;
}
td {
padding: 8px;
color: #669;
}
.odd {
background: #e8edff;
}
tr:hover td {
background: #c8cdff;
}
]]>
</style>
</head>
<body>
<table id="withZebra">
<colgroup><col/><col/><col/></colgroup>
<tr><th>Name</th><th>Length</th><th>LastWriteTime</th></tr>
<tr class="odd"><td>Select-Xml-5th.ps1</td><td>390</td><td>01-Jul-14 00:37:18</td></tr>
<tr><td>Select-Xml-6th.ps1</td><td>3</td><td>01-Jul-14 22:02:32</td></tr>
<tr class="odd"><td>Select-Xml-First.ps1</td><td>229</td><td>17-Jun-14 20:44:50</td></tr>
<tr><td>Select-Xml-Fourth.ps1</td><td>667</td><td>29-Jun-14 23:05:50</td></tr>
<tr class="odd"><td>Select-Xml-Second.ps1</td><td>602</td><td>19-Jun-14 00:50:19</td></tr>
<tr><td>Select-Xml-Third.ps1</td><td>815</td><td>22-Jun-14 19:50:33</td></tr>
<tr class="odd"><td>SomeTables.xhtml</td><td>1118</td><td>29-Jun-14 23:20:45</td></tr>
<tr><td>Test.xml</td><td>148</td><td>17-Jun-14 05:27:56</td></tr>
<tr class="odd"><td>testLocal.xml</td><td>163971</td><td>22-Jun-14 19:48:26</td></tr>
<tr><td>TestPage.xhtml</td><td>1118</td><td>29-Jun-14 23:20:45</td></tr>
<tr class="odd"><td>TestPage.xml</td><td>918</td><td>19-Jun-14 00:08:31</td></tr>
</table>
<table id="withoutZebra">
<colgroup><col/><col/></colgroup>
<tr><th>ProcessName</th><th>HandleCount</th></tr>
<tr><td>csrss</td><td>507</td></tr>
<tr><td>csrss</td><td>478</td></tr>
<tr><td>lsass</td><td>1250</td></tr>
<tr><td>smss</td><td>44</td></tr>
</table>
<table id="withSmallZebra">
<colgroup><col/><col/><col/></colgroup>
<tr><th>Name</th><th>DisplayName</th><th>Status</th></tr>
<tr class="odd"><td>WinDefend</td><td>Windows Defender Service</td><td>Running</td></tr>
<tr><td>WinHttpAutoProxySvc</td><td>WinHTTP Web Proxy Auto-Discovery Service</td><td>Running</td></tr>
</table>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment