According to the documentation -v is a shortcut for the value of the XPATH expression given, so the following should work:
As in the following:
Code:
xmlstarlet sel -t -m / \
-o "product_id;brand;product_name;stock;msrp;inkoopEx;prijs" \
-n -b -m /products/product -v product_id -o ";" -v brand \
-o ";" -v product_name -o ";" -v stock -o ";" -v msrp -o ";" \
-v prijs -o ";" \
-v "prijs * 1.30" -o ";" \
-n text.xml
On a tangent, I wonder why these files do not use the
ASCII control codes for Record Separator (1e) and Unit Separator (1f). Tab-delimited and, worse, comma-separated are very hard to parse. Using the right ASCII control codes would seem to make that easier but I've not seen programs do that. Perhaps it is M$ damage which has spread to the rest of the world?