In this case, hypothetically if there were 8 witness items, they would not be specified as 00 x8 times, but 08 as the stack length and then each stack (containing the relevant scriptsig)?
It's each input's number of stack items followed by the stack items.
To be simpler, here's an example for 3 witness items:
<number of stack items for input0> <size of stack item0 of input0> <stack item0> <size of stack item1 of input0> <stack item1> ...
<number of stack items for input1> <size of stack item0 of input1> <stack item0> <size of stack item1 of input0> <stack item1> ...
<number of stack items for input2> <size of stack item0 of input2> <stack item0> <size of stack item1 of input0> <stack item1> ...
And if only half of them were witnesses, then it's 04 as stack length and then the 4 stack items?
If there are non-witness amongst the inputs, witness data should be (
let's say input1 above is p2pkh):
<number of stack items for input0> <size of stack item0 of input0> <stack item0> <size of stack item1 of input0> <stack item1> ...
00
<number of stack items for input2> <size of stack item0 of input2> <stack item0> <size of stack item1 of input0> <stack item1> ...
Refer to BIP143 for examples of mixed witness and non-witness inputs:
https://github.com/bitcoin/bips/blob/master/bip-0143.mediawiki#exampleThe number of witness items doesn't have to be specified and the arrangement is based from the inputs' index as mentioned in BIP144:
The number of script witnesses is not explicitly encoded as it is implied by txin_count. Empty script witnesses are encoded as a zero byte. The order of the script witnesses follows the same order as the associated txins.