im seeking a simple method (utility, function, tool) for running boolean logic on data in xml format, and most likely via shell script. this has nothing to do with translating xml or creating other documents but simple logic decisions that permit basic operations <, >, =, !=
lets say given an xml file, 2012_04_21.xml
containing (amongst other things) the xml key and value of <data>...<price>6.50</price>...</data>
my ideal tool would be along the lines of:
cooltool --input 2012-04-21.xml --eval "price <= 6.50"
returning either true, false, nothing or something depending on the given logic
grep works well for 'has' or '==' type operation. grep '<key>value</key>' 2012_04_21.xml
offers either nothing or the matching string that can be booleanated.
but, grep fails to suffice for reasons:
1. not possible for price > 5.00
2. cannot cope with hierarchies like data/price > 5.00
XPATH logic is completely adequate, but im struggling to come up with a way of harnessing it under this situation.
xsltproc mylogic.xsl 2012-04-21.xml
Hmmm, perhaps a combo of xsltproc mylogic.xsl 2012-04-21.xml | grep true
Ill give that a whirl.
Any other ideas are welcome.