From: Noam P. <npo...@us...> - 2010-11-30 02:45:16
|
André Kaplan <ak...@la...> writes: > I felt a bit let down when I was trying to go over the one-liner since > things are rarely as simple as they look like. > This is why I added options to support other xsl elements. > First of I didn't much like the idea of writing: > xml sel -t -i 'condition' -o 'yes' -b -i 'not(condition) -o 'no' -b -b > for an if/then/else so I added support for choose/when/otherwise: > xml sel -t --choose --when 'condition' -o 'yes' -b --otherwise -o 'no' > -b -b -b I see your point, though in this specific instance we don't need to be bound xslt's zany conditionals: xml sel -t --if 'condition' -o 'yes' --else 'no' -b > > Anyway, adding other switches won't prevent you from using xmlstarlet > for one-liners if that's how you use it. I also use it for one-liners. > I just don't want to be stopped at the first hurdle. The more code there is, the greater the chance of screwing it up. >> If we do go in the "less verbose stylesheet direction", I think there >> should be some kind of syntax defined instead of using options for >> everything. I don't find the dashes very pretty, and single letter >> options aren't all that human-readable. > > Well sure that's a matter of taste. I don't mind too much the dashes, > but I rarely write long xml commands directly in the terminal, I > directly integrate them in longer shell scripts. I forgot to mention the quoting, that's probably the worst thing. Shell evaluation rules are sufficiently icky that I really try to avoid longer shell scripts. > As for the the syntax I don't quite understand. > If that's a full language, then XQuery is already there. > If that's some shortcuts or syntactic sugar to avoid typing dashes > then OK. Hmm, maybe shell is good enough. Noam |