On 7/13/07, Ingmar Kliche <ingmar.kliche@googlemail.com> wrote:
> I have difficuties to select a node using XPath. I use an EMMA XML
> repesented input:
>
> <emma:emma version="1.0"
> xmlns:emma="http://www.w3.org/2003/04/emma"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.w3.org/2003/04/emma
> http://www.w3.org/TR/2007/WD-emma-20070409/emma.xsd"
> xmlns="http://www.example.com/example">
> <emma:one-of id="r1" emma:start="1087995961542" emma:end="1087995963542">
> <emma:interpretation id="int1" emma:confidence="0.75"
> emma:tokens="flights from boston to denver">
> <origin>Boston</origin>
> <destination>Denver</destination>
> </emma:interpretation>
>
> <emma:interpretation id="int2" emma:confidence="0.68"
> emma:tokens="flights from austin to denver">
> <origin>Austin</origin>
> <destination>Denver</destination>
> </emma:interpretation>
> </emma:one-of>
> </emma:emma>
>
> taken from [1]. This EMMA document is parsed into its DOM and passed into
> the engine (attached to the eventdata). Now I'd like to select the <origin>
> out of the first interpretation. I tried to use the following statement:
>
> <transition event="emma" xmlns:emma=http://www.w3.org/2003/04/emma
> cond="Data(_eventdata.emma,'/emma:emma/emma:one-of/emma:interpretation[@id='int1']/origin')
> eq 'Boston'" target="twenty" />
>
> I think the XPath itself is correct, but unfortunately the overall statement
> is not a valid JEXL statement anymore (as of the ' around "int1"). How
> should I select the value of the attribute to make it a valid statement? I
> tried to escape using \ , but it did not work.
>
> Any suggestion?
>
<snip/>
This nets out to be a JEXL question. It has been asked before a few
[1],[2],[3],[4] times.
JEXL has no elegant way of doing this (you can store an apostrophe in
the state machine's root context and then use it in string
concatenation to get by).
-Rahul
[1] http://www.nabble.com/-scxml--Data%28%29-xpath-and-the-syntax-tf1682372.html
[2] http://www.nabble.com/-jexl--How-to-escape-the-Apostrophe-tf1686607.html
[3] http://www.nabble.com/-Jelly-JEXL--String-concatenation-tf155102.html
[4] http://www.nabble.com/-Jexl--String-Literals-with-Newline-do-not-work-tf4035993.html
> - Ingmar.
>
> [1] http://www.w3.org/TR/emma
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
|