How to convert a hexadecimal number to an octal number? How can I convert a hexadecimal number, for example 0x1A03 to its octal value?
I know that one way is to convert it to decimal and then convert it to octal
0x1A03 = 6659 = 0o15003



*

*Is there a simple way to do it without the middle step (conversion to decimal or conversion to binary)?

*Why do we tend to convert it to Base10 every time?
 A: I think the easiest way is to go through binary.  A hex digit corresponds to 4 bits, an octal digit to 3.
0x1A03 in binary is 0001 1010 0000 0011 (grouped into 4-bit nibbles).  If I regroup into 3-bit groups (from the right), I have 001 101 000 000 011.  That's octal 0o15003.  
A: When you're converting among bases $2^n$, you can often do so more quickly with a comprehensive conversion table.  For example, between binary and octal, each block of 3 binary digits will convert to one octal digit:
$$\begin{matrix}
000_2=0_8 & 001_2=1_8 & 010_2=2_8 & 011_2=3_8
\\ 
100_2=4_8 & 101_2=5_8 & 110_2=6_8 & 111_2=7_8
\end{matrix}$$
Similarly, when converting between binary and hexadecimal, each block of 4 binary digits converts to a single hexadecimal digit.  Because of these two facts, each block of 12 (least common multiple of 3 and 4) binary digits is 4 octal digits and 3 hexadecimal digits, so each block of 3 hexadecimal digits can be converted to a block of 4 octal digits.  The table for doing hexadecimal<->octal directly is quite large, though, so it's usually simpler to convert to binary as an intermediate form.
It is also possible to do the conversion directly by performing division in octal or hexadecimal, though this can be tricky to get used to.
I think we tend to use decimal as an intermediate form because we are most familiar and comfortable with base 10 (since we generally have 10 fingers and use it most often).
A: A simpler way is to go through binary (base 2) instead of base 10.
0x1A03 = 0001 1010 0000 0011
Now group the bits in bunches of 3 starting from the right
0 001 101 000 000 011
This gives
0 1 5 0 0 3
Which is your octal representation.
A: There's a fast procedure involving no intermediate representation.  You need only four lookup tables totaling 544 entries.
Earlier answers have established that the conversion can be done in blocks of 3 (working right to left).  Consider the rightmost block in your example:
0xA03 = 1010 0000 0011 B
You need to break this binary string into four groups of three bits, which I will number 1, 2, 3, 4 from the right to the left:
1: 011 B
2: 000 B
3: 000 B
4: 101 B
The first depends only on the rightmost hex digit 0x3.  The second depends only on the two rightmost digits 0x03 (it gets its rightmost bit from the 0x3 and its first two bits from 0x0).  The third depends only on the second and third digits 0xA0.  The fourth depends only on the third digit 0xA.  Whence, you only need to perform the following conversions, each of which can be stored in its own static lookup table:
1: 0x3 --> 03 [16 entries cover all possibilities]
2: (0x0, 0x3) --> 00 [16 * 16 entries]
3: (0xA, 0x0) --> 00 [16 * 16 entries]
4: 0xA --> 5 [16 entries].
Now you repeat with the next block, padding with zeros on the left as needed.  Continuing the example, the next block is 0x001:
1: 0x1 --> 01
2: (0x0, 0x1) --> 00.
You can stop here because all the original input has been consumed.  The output, working backwards, is 0015003.
This directly answers both parts of the original question: it provides a simple conversion without the middle step and it avoids base 10 (which is rarely used for computer conversion anyway: usually the job is done with bit shifting and masking, essentially a binary operation).  In case this procedure still looks too much like the other proposed solutions, please note that it performs absolutely no arithmetic (apart from decrementing pointers to input and output as it proceeds): it takes a string representation (hex) as its input, uses the characters to index its tables, and outputs an octal string.
