Razor declare and use variable syntax - asp.net-mvc

I'm trying to get this razor template working but am having trouble declaring the variables for FDate1,2,3,4,5,etc... correctly.
For example I've just included the first FDate1 at the top. The lower part of my code is working correctly the looping part.
What am i doing incorrectly?
#{
string FDate1 = var row in AME.GridF18.FDate1("SubmissionID='" + TknParams.SubmissionID + "'");
}
<div class="table-responsive">
<table class="table table-striped table-condensed table-bordered" width="100%" border="0">
<tbody>
<tr>
<th colspan="7" scope="col">#FDate1</th>
<th colspan="2" scope="col">#FDate2</th>
<th colspan="2" scope="col">#FDate3</th>
<th colspan="2" scope="col">#FDate4</th>
<th colspan="2" scope="col">#FDate5</th>
<th colspan="2" scope="col">#FDate6</th>
<th colspan="1" scope="col">#FDate7</th>
<th colspan="1" scope="col">#FDate8</th>
}
</tr>
<tr>
<th rowspan="2" scope="col">Project #</th>
<th rowspan="2" scope="col">PW</th>
<th rowspan="2" scope="col">Project Name</th>
<th rowspan="2" scope="col">Type of Work</th>
<th rowspan="2" scope="col">Mile</th>
<th rowspan="2" scope="col">Toll</th>
<th rowspan="2" scope="col">Park</th>
<th colspan="2" scope="col">Monday</th>
<th colspan="2" scope="col">Tuesday</th>
<th colspan="2" scope="col">Wednesday</th>
<th colspan="2" scope="col">Thursday</th>
<th colspan="2" scope="col">Friday</th>
<th scope="col">Saturday</th>
<th scope="col">Sunday</th>
<th scope="col">Total</th>
</tr>
<tr>
<th scope="col">RT</th>
<th scope="col">OT</th>
<th scope="col">RT</th>
<th scope="col">OT</th>
<th scope="col">RT</th>
<th scope="col">OT</th>
<th scope="col">RT</th>
<th scope="col">OT</th>
<th scope="col">RT</th>
<th scope="col">OT</th>
<th scope="col"> </th>
<th scope="col"> </th>
<th scope="col"> </th>
</tr>
#foreach (var row in AME.GridF18("SubmissionID='" + TknParams.SubmissionID + "'")) {
<tr>
<td>#row.ProjectNumber</td>
<td><input id="checkBox" type="checkbox"></td>
<td>#row.ProjectName</td>
<td>#row.TypeofWork</td>
<td>#row.Mile</td>
<td>#row.Toll</td>
<td>#row.Park</td>
<td>#row.MonRT</td>
<td>#row.MonOT</td>
<td>#row.TuesRT</td>
<td>#row.TuesOT</td>
<td>#row.WedsRT</td>
<td>#row.WedsOT</td>
<td>#row.ThursRT</td>
<td>#row.ThursOT</td>
<td>#row.FriRT</td>
<td>#row.FriOT</td>
<td>#row.Saturday</td>
<td>#row.Sunday</td>
<td>#row.Total</td>
</tr>
}
</tbody>
</table>
</div>

Related

How to use datatable with table rowspan inside foreach laravel

Anyone know how to use datatable with format table like this
table
My data table can't use with format table like that. My code for show data
<table id="table-rekap" class="table table-bordered">
<thead>
<tr>
<th class="text-center" style="width: 20%;">No</th>
<th class="text-center" style="width: 20%;">Unit Kerja</th>
<th>Jenis Kendaraan</th>
<th>Total</th>
</tr>
</thead>
#php $no = 1; #endphp
<tbody>
#foreach($rekapUnker as $unitKerja => $jenisKendaraan)
<tr>
<td class="text-center" rowspan="9">{{ $no++ }}</td>
<td class="text-center" rowspan="9">{{ $unitKerja }}</td>
#foreach($jenisKendaraan as $jenKen => $total)
<tr>
<td>{{ $jenKen }}</td>
<td>{{ $total }}</td>
</tr>
#endforeach
</tr>
#endforeach
</tbody>
</table>
Id table rekap for call data table

text box in table is wider in a strange way

I have a table in a bootstrap-5 web page:
<table class="table align-middle table-sm">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">First</th>
<th scope="col">Last</th>
<th scope="col">Handle</th>
<th scope="col">TITLE 1</th>
<th scope="col">TITLE 2</th>
<th scope="col">TITLE 3</th>
<th scope="col">TITLE 4</th>
<th scope="col">TITLE 5</th>
<th scope="col">TITLE 6</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>#mdo</td>
<td><div class="col-12 col-md-3"><input type="text" class="form-control form-control-sm" placeholder="sum"></div></td>
<td>foo</td>
<td>boo</td>
<td>goo</td>
<td>poo</td>
<td>zoo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>#fat</td>
<td><div class="col-12 col-md-3"><input type="text" class="form-control form-control-sm" placeholder="sum"></div></td>
<td>foo</td>
<td>boo</td>
<td>goo</td>
<td>poo</td>
<td>zoo</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>Bird</td>
<td>#twitter</td>
<td><div class="col-12 col-md-3"><input type="text" class="form-control form-control-sm" placeholder="sum"></div></td>
<td>foo</td>
<td>boo</td>
<td>goo</td>
<td>poo</td>
<td>zoo</td>
</tr>
</tbody>
</table>
In small screens it looks good:
But in a wider screen there is a strange wide column for the text box:
How to fix it, and make the text box column to be same width as the other columns?
Fairly self explanatory, you have a div around that input field that is setting a column size:
<td><div class="col-12 col-md-3"><input type="text" class="form-control form-control-sm" placeholder="sum"></div></td>
Simply remove it and the column will scale with the rest of the table:
<td><input type="text" class="form-control form-control-sm" placeholder="sum"></td>
EDIT:
Something like this would set a fixed width for all table columns:
td {
width: 10%;
}

Why is <tfoot> only shows in the last page when printing?

I am trying to print a html using dompdf and I am trying to add a footer but the footer only shows only the last page in print view? Is it a chrome bug?
<table class="table table-bordered" cellspacing="0" style="color:black">
<thead>
<tr>
<th scope="col" style="border-top: color: white; border-left: color: white;border-right: color: white;" colspan="4"> </th>
</tr>
<tr class="text-center">
<th scope="col" class="align-middle" ></th>
<th scope="col" class="align-middle text-nowrap">Reference No.: BatStateU-FO-ESO-01</th>
<th scope="col" class="align-middle text-nowrap">Effectivity Date: January 3, 2017</th>
<th scope="col" class="align-middle text-nowrap">Revision No.: 00</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="4">
<p class="title-tab"><input type="checkbox" style=" transform : scale(2);"> Extension Service / Training is requested by clients.</p> <br>
<p class="title-tab"><input type="checkbox" style=" transform : scale(2);" checked> Extension Service / Training is Department’s initiative.</p>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<th scope="col" colspan="4"> </th>
</tr>
</tfoot>
</table>

PHP foreach loop and separate rows with a field that has the same value

I have a database table that has a field in the row of which can have the same value. This is a "transaction id" field that will have the order number. The rows can have the same order number but different product id's for each item ordered.
I'm querying the database just fine and outputting the data as well. However, I want to separate the transaction id's that are the same and do something different with that data. I just can figure out how to do that for some reason.
example:
ID txn_id product_id Product_name field5
-------- --------- ----------- --------- ---------
1 265 98 Product Name
2 265 99 Product Name
3 244 98 Product Name
UPDATE
So here is my updated code that still needs help. I have two queries going now. One that checks for duplicates and places them into an array, then the other that loops through the database table with an if statement which checks for matching transaction id numbers.
First Query:
$myquery = $wpdb->get_results("SELECT txn_id , COUNT(*) FROM test_table HAVING COUNT(*) > 1");
global $TXN;
foreach($myquery as $query){
$TXN= $query->txn_id;
}
Then in the main query/loop
global $wpdb;
$prepare_query = $wpdb->get_results("SELECT * FROM test_table" );
foreach($prepare_query as $data){
$txn_id = $data->txn_id;
$product_id = $data->product_id;
$product_name = $data->product_name;
?>
<table class="shop_table my_account_orders" width="100%">
<thead>
<tr>
<th align="left">Order #</th>
<th align="left">Product ID</th>
<th align="left">Product Name</th>
</tr>
</thead>
<tbody>
<tr class="order">
<td>
<?php echo "#" .$txn_id; ?>
<?php
if($txn_id === $TXN){
echo'YES';
}
?>
</td>
<td>
<?php echo $product_id; ?>
</td>
<td>
<?php echo $product_name; ?>
</td>
</tr>
</tbody>
</table>
<?php } ?>
This will output:
<table width="100%">
<thead>
<tr>
<th align="left">Order #</th>
<th align="left">Product ID</th>
<th align="left">Product Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>#265 YES</td>
<td>98</td>
<td>Product Name</td>
</tr>
</tbody>
</table>
<table width="100%">
<thead>
<tr>
<th align="left">Order #</th>
<th align="left">Product ID</th>
<th align="left">Product Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>#265 YES</td>
<td>99</td>
<td>Product Name</td>
</tr>
</tbody>
</table>
<table width="100%">
<thead>
<tr>
<th align="left">Order #</th>
<th align="left">Product ID</th>
<th align="left">Product Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>#244</td>
<td>98</td>
<td>Product Name</td>
</tr>
</tbody>
</table>
When what I want to get is:
<table width="100%">
<thead>
<tr>
<th align="left">Order #</th>
<th align="left">Product ID</th>
<th align="left">Product Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>#265 YES</td>
<td>98</td>
<td>Product Name</td>
</tr>
<tr>
<td>#265 YES</td>
<td>99</td>
<td>Product Name</td>
</tr>
</tbody>
</table>
<table width="100%">
<thead>
<tr>
<th align="left">Order #</th>
<th align="left">Product ID</th>
<th align="left">Product Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>#244</td>
<td>98</td>
<td>Product Name</td>
</tr>
</tbody>
</table>
To get the duplicated ids you could use:
SELECT id,txn_id , COUNT(*)
FROM table_name
HAVING COUNT(*) > 1
Replace of course table_name with the name of your table
I ended up doing it this way:
$myArray = $wpdb->get_results("SELECT * FROM " . $license_table);
$newArray=array();
foreach($myArray as $val){
$newKey=$val->txn_id;
$newArray[$newKey][]=$val;
}
print_r($newArray);
foreach ($newArray as $key => $array){
?>
<table border="0" cellpadding="0" cellspacing="0">
<tr class="header">
<td width="73%" valign="top">KEY</td>
<td width="73%" valign="top">Product Id</td>
<td width="27%" valign="top">Product Name</td>
</tr>
<?php
foreach($array as $values) {
?>
<tr class="details">
<td width="27%" valign="top"><?php echo $key; ?></td>
<td width="73%" valign="top"><?php echo $values->product_id; ?></td>
<td width="27%" valign="top"><?php echo $values->product_name ?></td>
</tr>
<?php } ?>
</table>
<?php
}

unable to select node in nokogiri with css attribute containing two colons

I'm receiving an error when trying to select a node with css value of "WhoIsOnDutyTableLevel1:header:2" using nokogiri. I'm assuming nokogiri just can't handle two colons. What are my options? I can't change the structure of the html.
Here's the html:
<html lang="en"><head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<link rel="stylesheet" type="text/css" href="stylesheets/forms.css">
<style type="text/css" media="screen" title="AlarmPoint">
#import "stylesheets/AlarmPoint.css";
</style>
</head>
<body><table id="WhoIsOnDutyTableLevel1" class="duty-report-level1">
<caption></caption>
<thead>
<tr>
<th id="WhoIsOnDutyTableLevel1:header:1" class="duty-report-lt-header">Who's on duty for:
January 06, 2012 00:00 -0800</th>
</tr>
</thead>
<tfoot></tfoot>
<tbody>
<tr>
<td headers="WhoIsOnDutyTableLevel1:header:1">
<table id="WhoIsOnDutyTableLevel2" class="duty-report-level2">
<caption></caption>
<thead>
<tr>
<th id="WhoIsOnDutyTableLevel1:header:1">Group Name</th><th id="WhoIsOnDutyTableLevel1:header:2">Group Time Zone</th><th id="WhoIsOnDutyTableLevel1:header:3">Default Devices</th><th id="WhoIsOnDutyTableLevel1:header:4">Supervisors</th>
</tr>
</thead>
<tfoot></tfoot>
<tbody>
<tr>
<td headers="WhoIsOnDutyTableLevel1:header:1"><a id="Support" href="/alarmpoint/GroupDetails.do;jsessionid=7pj06dj6krfs?_data=TJZuNquzHUiPj8lqyud7XvypLHHjUnT5bHn7hwtTf9Ei0C2PJ8QYcKIy8OkorCWT8HDTAzkon1ls%0D%0AefuHC1N%2F0SLQLY8nxBhwesdd7Zeg6NzvCfuzRqLg5g%3D%3D" name="Support" class="details">Support</a></td><td headers="WhoIsOnDutyTableLevel1:header:2" class="centered-text">US/Pacific</td><td headers="WhoIsOnDutyTableLevel1:header:3" class="centered-text"><img border="0" src="/static/images/icon_boolean_false.png" alt="No"></td><td headers="WhoIsOnDutyTableLevel1:header:4">
<values>
</values><a id="mgr1" href="/alarmpoint/UserDevices.do;jsessionid=7pj06dj6krfs?_data=KpBkJeR08z4qZ%2FFdHH4hUAixAYz%2BqH6ZPkanPQ24VqQFpjRFPQiWigQHttJBTMFaCLEBjP6ofpk%2B%0D%0ARqc9DbhWpI1nHAqm8ex%2BxOmu7xYUNxRSU0XUo1xoRw%3D%3D" name="mgr1" class="details">Manager 1</a>
</td>
</tr>
<tr>
<td headers="WhoIsOnDutyTableLevel1:header:1" colspan="4" class="no-padding">
<table id="WhoIsOnDutyTableLevel3" class="duty-report-level3">
<caption></caption>
<thead>
<tr>
<th id="WhoIsOnDutyTableLevel1:header:1" class="th-left">Blah_Blah1</th><th id="WhoIsOnDutyTableLevel1:header:2" class="">08:00 - 17:00 TU WE TH FR </th>
</tr>
</thead>
<tfoot></tfoot>
<tbody>
<tr>
<td headers="WhoIsOnDutyTableLevel1:header:1" colspan="2" class="no-padding">
<table id="WhoIsOnDutyTableLevel4" class="duty-report-level4">
<caption></caption>
<thead>
<tr>
<th id="WhoIsOnDutyTableLevel1:header:1">Recipient</th><th id="WhoIsOnDutyTableLevel1:header:2">Category</th><th id="WhoIsOnDutyTableLevel1:header:3">Escalation</th>
</tr>
</thead>
<tfoot></tfoot>
<tbody>
<tr id="205414">
<td headers="WhoIsOnDutyTableLevel1:header:1"><a id="user0" href="/alarmpoint/UserDevices.do;jsessionid=7pj06dj6krfs?_data=KpBkJeR08z6oL%2BaI47zI4gixAYz%2BqH6ZPkanPQ24VqQFpjRFPQiWigQHttJBTMFaCLEBjP6ofpk%2B%0D%0ARqc9DbhWpI1nHAqm8ex%2BxOmu7xYUNxRSU0XUo1xoRw%3D%3D" name="user0" class="details">User 0</a></td><td headers="WhoIsOnDutyTableLevel1:header:2">PERSON</td><td headers="WhoIsOnDutyTableLevel1:header:3">0</td>
</tr>
<tr id="207569">
<td headers="WhoIsOnDutyTableLevel1:header:1"><a id="user1" href="/alarmpoint/UserDevices.do;jsessionid=7pj06dj6krfs?_data=KpBkJeR08z4qZ%2FFdHH4hUAixAYz%2BqH6ZPkanPQ24VqQFpjRFPQiWigQHttJBTMFaCLEBjP6ofpk%2B%0D%0ARqc9DbhWpI1nHAqm8ex%2BxOmu7xYUNxRSU0XUo1xoRw%3D%3D" name="user1" class="details">User 1</a></td><td headers="WhoIsOnDutyTableLevel1:header:2">PERSON</td><td headers="WhoIsOnDutyTableLevel1:header:3">10</td>
</tr>
<tr id="209107">
<td headers="WhoIsOnDutyTableLevel1:header:1"><a id="user2" href="/alarmpoint/UserDevices.do;jsessionid=7pj06dj6krfs?_data=KpBkJeR08z6uKpyoDh%2Fz%2FQixAYz%2BqH6ZPkanPQ24VqQFpjRFPQiWigQHttJBTMFaCLEBjP6ofpk%2B%0D%0ARqc9DbhWpI1nHAqm8ex%2BxOmu7xYUNxRSU0XUo1xoRw%3D%3D" name="uer2" class="details">User 2</a></td><td headers="WhoIsOnDutyTableLevel1:header:2">PERSON</td><td headers="WhoIsOnDutyTableLevel1:header:3">25</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td headers="WhoIsOnDutyTableLevel1:header:1" colspan="4" class="no-padding">
<table id="WhoIsOnDutyTableLevel3" class="duty-report-level3">
<caption></caption>
<thead>
<tr>
<th id="WhoIsOnDutyTableLevel1:header:1" class="th-left">Blah_Blah</th><th id="WhoIsOnDutyTableLevel1:header:2" class="">17:00 Lasting 15:00 WE TH FR </th>
</tr>
</thead>
<tfoot></tfoot>
<tbody>
<tr>
<td headers="WhoIsOnDutyTableLevel1:header:1" colspan="2" class="no-padding">
<table id="WhoIsOnDutyTableLevel4" class="duty-report-level4">
<caption></caption>
<thead>
<tr>
<th id="WhoIsOnDutyTableLevel1:header:1">Recipient</th><th id="WhoIsOnDutyTableLevel1:header:2">Category</th><th id="WhoIsOnDutyTableLevel1:header:3">Escalation</th>
</tr>
</thead>
<tfoot></tfoot>
<tbody>
<tr id="210855">
<td headers="WhoIsOnDutyTableLevel1:header:1"><a id="user0" href="/alarmpoint/UserDevices.do;jsessionid=7pj06dj6krfs?_data=KpBkJeR08z72pjQodq7P5gixAYz%2BqH6ZPkanPQ24VqQFpjRFPQiWigQHttJBTMFaCLEBjP6ofpk%2B%0D%0ARqc9DbhWpI1nHAqm8ex%2BxOmu7xYUNxRSU0XUo1xoRw%3D%3D" name="user0" class="details">User 0</a></td><td headers="WhoIsOnDutyTableLevel1:header:2">PERSON</td><td headers="WhoIsOnDutyTableLevel1:header:3">5</td>
</tr>
<tr id="210529">
<td headers="WhoIsOnDutyTableLevel1:header:1"><a id="user1" href="/alarmpoint/UserDevices.do;jsessionid=7pj06dj6krfs?_data=KpBkJeR08z6r1%2Fmnw2SZ2AixAYz%2BqH6ZPkanPQ24VqQFpjRFPQiWigQHttJBTMFaCLEBjP6ofpk%2B%0D%0ARqc9DbhWpI1nHAqm8ex%2BxOmu7xYUNxRSU0XUo1xoRw%3D%3D" name="user1" class="details">User 1</a></td><td headers="WhoIsOnDutyTableLevel1:header:2">PERSON</td><td headers="WhoIsOnDutyTableLevel1:header:3">10</td>
</tr>
<tr id="210337">
<td headers="WhoIsOnDutyTableLevel1:header:1"><a id="user2" href="/alarmpoint/UserDevices.do;jsessionid=7pj06dj6krfs?_data=KpBkJeR08z6Rwqu8vCtzBAixAYz%2BqH6ZPkanPQ24VqQFpjRFPQiWigQHttJBTMFaCLEBjP6ofpk%2B%0D%0ARqc9DbhWpI1nHAqm8ex%2BxOmu7xYUNxRSU0XUo1xoRw%3D%3D" name="user2" class="details">User 2</a></td><td headers="WhoIsOnDutyTableLevel1:header:2">PERSON</td><td headers="WhoIsOnDutyTableLevel1:header:3">15</td>
</tr>
<tr id="204675">
<td headers="WhoIsOnDutyTableLevel1:header:1"><a id="user3" href="/alarmpoint/UserDevices.do;jsessionid=7pj06dj6krfs?_data=KpBkJeR08z5oj5jdRJbzggixAYz%2BqH6ZPkanPQ24VqQFpjRFPQiWigQHttJBTMFaCLEBjP6ofpk%2B%0D%0ARqc9DbhWpI1nHAqm8ex%2BxOmu7xYUNxRSU0XUo1xoRw%3D%3D" name="user3" class="details">User 3</a></td><td headers="WhoIsOnDutyTableLevel1:header:2">PERSON</td><td headers="WhoIsOnDutyTableLevel1:header:3">20</td>
</tr>
<tr id="205555">
<td headers="WhoIsOnDutyTableLevel1:header:1"><a id="user4" href="/alarmpoint/UserDevices.do;jsessionid=7pj06dj6krfs?_data=KpBkJeR08z4G8e7%2FY9SHyQixAYz%2BqH6ZPkanPQ24VqQFpjRFPQiWigQHttJBTMFaCLEBjP6ofpk%2B%0D%0ARqc9DbhWpI1nHAqm8ex%2BxOmu7xYUNxRSU0XUo1xoRw%3D%3D" name="user4" class="details">User 4</a></td><td headers="WhoIsOnDutyTableLevel1:header:2">PERSON</td><td headers="WhoIsOnDutyTableLevel1:header:3">25</td>
</tr>
<tr id="205004">
<td headers="WhoIsOnDutyTableLevel1:header:1"><a id="user5" href="/alarmpoint/UserDevices.do;jsessionid=7pj06dj6krfs?_data=KpBkJeR08z5XHkcVAMfXqgixAYz%2BqH6ZPkanPQ24VqQFpjRFPQiWigQHttJBTMFaCLEBjP6ofpk%2B%0D%0ARqc9DbhWpI1nHAqm8ex%2BxOmu7xYUNxRSU0XUo1xoRw%3D%3D" name="user5" class="details">User 5</a></td><td headers="WhoIsOnDutyTableLevel1:header:2">PERSON</td><td headers="WhoIsOnDutyTableLevel1:header:3">30</td>
</tr>
<tr id="204718">
<td headers="WhoIsOnDutyTableLevel1:header:1"><a id="user6" href="/alarmpoint/GroupDetails.do;jsessionid=7pj06dj6krfs?_data=TJZuNquzHUiUNEK29yovHscXndexl2jCbHn7hwtTf9Ei0C2PJ8QYcKIy8OkorCWT8HDTAzkon1ls%0D%0AefuHC1N%2F0SLQLY8nxBhwesdd7Zeg6NzvCfuzRqLg5g%3D%3D" name="user6" class="details">User 6</a></td><td headers="WhoIsOnDutyTableLevel1:header:2">GROUP</td><td headers="WhoIsOnDutyTableLevel1:header:3">35</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</body></html>
I'm running this in my rails console:
>> onDuty_userList = doc.at_xpath('//*[#id="WhoIsOnDutyTableLevel4"]/tbody/tr')
=> #<Nokogiri::XML::Element:0x1b83804 name="tr" attributes=[#<Nokogiri::XML::Attr:0x1b83764 name="id" value="208894">] children=[#<Nokogiri::XML::Element:0x1b83174 name="td" attributes=[#<Nokogiri::XML::Attr:0x1b83110 name="headers" value="WhoIsOnDutyTableLevel1:header:1">] children=[#<Nokogiri::XML::Element:0x1b82b70 name="a" attributes=[#<Nokogiri::XML::Attr:0x1b82aa8 name="href" value="/alarmpoint/UserDevices.do;jsessionid=3pz7t91kle3?_data=KpBkJeR08z6mdgIY4sPrzAixAYz%2BqH6ZPkanPQ24VqQFpjRFPQiWigQHttJBTMFaCLEBjP6ofpk%2B%0D%0ARqc9DbhWpI1nHAqm8ex%2BxOmu7xYUNxRSU0XUo1xoRw%3D%3D">, #<Nokogiri::XML::Attr:0x1b82a94 name="name" value="xxx">, #<Nokogiri::XML::Attr:0x1b82a80 name="id" value="xxx">, #<Nokogiri::XML::Attr:0x1b82a6c name="class" value="details">] children=[#<Nokogiri::XML::Text:0x1b7b438 "\r\n xxx, xxx (xxx)\r\n ">]>]>, #<Nokogiri::XML::Element:0x1b7b104 name="td" attributes=[#<Nokogiri::XML::Attr:0x1b7b0a0 name="headers" value="WhoIsOnDutyTableLevel1:header:2">] children=[#<Nokogiri::XML::Text:0x1b7aba0 "PERSON">]>, #<Nokogiri::XML::Element:0x1b7a984 name="td" attributes=[#<Nokogiri::XML::Attr:0x1b7a90c name="headers" value="WhoIsOnDutyTableLevel1:header:3">] children=[#<Nokogiri::XML::Text:0x1b7a420 "0">]>, #<Nokogiri::XML::Text:0x1b7a1f0 "\r\n">]>
When I try to select with css value:
>> onDuty_userList.css('WhoIsOnDutyTableLevel1:header:2')
Nokogiri::CSS::SyntaxError: unexpected '2' after ':'
from /home/dan/.rvm/gems/ruby-1.9.2-p290#apraper/gems/nokogiri-1.5.0/lib/nokogiri/css/parser_extras.rb:87:in `on_error'
from /home/dan/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/racc/parser.rb:99:in `_racc_do_parse_c'
from /home/dan/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/racc/parser.rb:99:in `do_parse'
from /home/dan/.rvm/gems/ruby-1.9.2-p290#apraper/gems/nokogiri-1.5.0/lib/nokogiri/css/parser_extras.rb:62:in `parse'
from /home/dan/.rvm/gems/ruby-1.9.2-p290#apraper/gems/nokogiri-1.5.0/lib/nokogiri/css/parser_extras.rb:79:in `xpath_for'
from /home/dan/.rvm/gems/ruby-1.9.2-p290#apraper/gems/nokogiri-1.5.0/lib/nokogiri/css.rb:23:in `xpath_for'
from /home/dan/.rvm/gems/ruby-1.9.2-p290#apraper/gems/nokogiri-1.5.0/lib/nokogiri/xml/node.rb:211:in `block in css'
from /home/dan/.rvm/gems/ruby-1.9.2-p290#apraper/gems/nokogiri-1.5.0/lib/nokogiri/xml/node.rb:210:in `map'
from /home/dan/.rvm/gems/ruby-1.9.2-p290#apraper/gems/nokogiri-1.5.0/lib/nokogiri/xml/node.rb:210:in `css'
from (irb):129
from /home/dan/.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in `<main>'
You need to preface the id with a #.
This should work:
doc.css('#WhoIsOnDutyTableLevel1:header:2')

Resources