I need split one field in some column, e.g
[A1] [B1] [C1] [D1] [E1]
[A2] [B2] [C2] [D2] [E2]
........
I would like transorm it to
[A1] [B1] [C1] [D1] [E1_1|E1_2]
[A2] [B2] [C2] [D2] [E2_1|E2_2]
.....
The simplified fragment of my code looks like:
<table>
<thead>
<tr>
<th>HEAD_A</th>
<th>HEAD_B</th>
<th>HEAD_C</th>
<th>HEAD_D</th>
<th>HEAD_E</th>
<th>
</tr>
</thead>
<tbody>
<tr ng-repeat="row in myCtrl.rows>
<td>A</td>
<td>B</td>
<td>C</td>
<td>D</td>
<td>E</td>
<td>F</td>
</tr>
</tbody>
</table>
The additional requirement and key is to add headers for this two columns (these two columns are nested in some field, ane are created via splitting).
Can you tell me how to do it?
Related
I need something like this in HTML
please click here for the layout
This is my code:
<table>
<tr>
<th colspan="2">ROW A</th>
</tr>
<tr>
<th colspan="3">ROW B1</th>
<th colspan="3">ROW B2</th>
</tr>
<tr>
<th>RB1.1</th>
<th>RB1.2</th>
<th>RB1.3</th>
<th>RB2.1</th>
<th>RB2.2</th>
<th>RB2.3</th>
</tr>
<tr>
<td>a</td>
<td>b</td>
<td>c</td>
<td>d</td>
<td>e</td>
<td>f</td>
</tr>
</table>
However, this is what I get:
click here for the result
What am I supposed to do?
You only need to change "ROW A" to this :
<th colspan="6">ROW A</th>
The number of columns is determined by the amount of columns in the row that has the most.
In this case, the highest number of columns of any row of the table is 6. If you want "ROW A" to be as wide as the table, you need a colspan of 6. If you want it to be half the width of the table, you would need a colspan of 3.
Example html:
<table>
<thead>
<tr>
<td class="foo"></td>
<td class="bar"></td>
<td class="buzz"></td>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>4</td>
<td>5</td>
<td>6</td>
</tr>
</tbody>
</table>
Problem
I have row position (//tbody/tr[X]) and header class (//thead//td[#class="XXX"])
I want to find table data cell using row and column
For example <td>5</td> can be located by //tbody/tr[2] and //thead//td[#class="bar"]
Pseudo-xpath:
//tbody/tr[2]/td[position() = //thead//td[#class="bar"]::position()]
I was tweaking with ancestor:: axis but it was dead end.
Any ideas how to write it properly?
Try to use this XPath to select required node:
//tbody/tr[2]/td[position() = count(//thead/tr/td[#class="bar"]/preceding-sibling::*) + 1]
Instead of position we're checking the count of preceding siblings + 1
I want to create a table that its data is a Map< String, List < Object> >.
So the table has one header that and the rows should have the exact data.
Map.key
Object.item1
Object.item2
Object.item3
So since it is a List of Object i want one row for every Object of the List and the Map.key to be repeated.
So i need to iterate through keys like
<table>
<thead>
<tr>
<th>Code</th>
<th>Status</th>
<th>Flag</th>
<th>Message</th>
</tr>
</thead>
<tbody>
<tr th:each= "result : ${myMap}">
<td th:text="${result.key}"></td>
<td><table>
<tr th:each="obj: ${result.value}">
<td th:text="${not #lists.isEmpty(obj.errorList)}?'Error':'Warning'"></td>
<td th:text="${obj.flag}==true?'YES':'NO'"></td>
<td th:text="${not #lists.isEmpty(obj.errorList)}?${obj.warningList}:${obj.errorList}"></td>
</tr>
</table></td>
</tr>
</tbody>
</table>
but this solution places a table in a table. I want to use one header and iterate the lists and place the variables in the main table .
I think you're looking for a structure like this:
<table>
<thead>
<tr>
<th>Code</th>
<th>Status</th>
<th>Flag</th>
<th>Message</th>
</tr>
</thead>
<tbody>
<th:block th:each= "result : ${myMap}">
<tr th:each="obj: ${result.value}">
<td th:text="${result.key}" />
<td th:text="${not #lists.isEmpty(obj.errorList)}?'Error':'Warning'" />
<td th:text="${obj.flag}==true?'YES':'NO'" />
<td th:text="${not #lists.isEmpty(obj.errorList)}?${obj.warningList}:${obj.errorList}" />
</tr>
</th:block>
</tbody>
</table>
Could please someone help me to xpath values in a dynamic table.
I have the following HTML code and I need to select the values of the cells, as for example:
if a tr-cell contains the text "Values1" then select the first value (0) in td / third value (1) in td of this cell
I would be very thankful.
<table class="DynamicTable">
<tbody>
<tr>
<th>Details</th>
</tr>
<tr>
<td>0</td>
<td>Values1</td>
<td>1</td>
</tr>
<tr>
<td>4</td>
<td>Values2</td>
<td>2</td>
</tr>
<tr>
<td>1</td>
<td>Values6</td>
<td>0</td>
</tr>
</tbody>
</table>
I have the following document:
<html>
<body>
<div>
<table>
<tr>
<td>390920000</td>
<td>A</td>
</tr>
<tr>
<td>390920000</td>
<td></td>
</tr>
<tr>
<td>3924100011</td>
<td>B</td>
</tr>
<tr>
<td>3924100011</td>
<td></td>
</tr>
<tr>
<td>3924100019</td>
<td></td>
</tr>
<tr>
<td>3924100019</td>
<td>C</td>
</tr>
</table>
</div>
</body>
</html>
What I would like is to use an xpath to select /html/body/div/table/tr/td[2], but for each empty element select the previous non-empty element instead. So instead of getting the values 'A','','B','','','C' I would like to get 'A','A','B','B','B','C'. Is this possible?
Btw, nevermind that this is an html and not an xml. I am using HtmlAgilityPack so I create ordinary xpath expressions to select html elements.
If XPath 3 is fine, the following should work:
//table/tr ! head((., reverse(preceding-sibling::*))[normalize-space(td[2]/text()) != ""])/td[2]