repeat bug?!

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

repeat bug?!

Alexandru Ionita


Hello guys

We are facing a very unpleasant situation and we think this is a bug. 

We have the following reference: 


<xf:output ref="instance('searchHelpFieldsResult')/Content/F4OutputValues/Values/item[$position]/$resultFieldName"></xf:output>


both variables $position and $resultFieldName are visible in this scope

but this expression will return the value stored in $resultFieldName !!!
If I replace the variable reference ($resultFieldName) with the value itself, everything works great.

eg:

$resultFieldName -> "SAKNR"       

instance('searchHelpFieldsResult')/Content/F4OutputValues/Values/item[$position]/$resultFieldName  = "SAKNR"    !!!!!!!!
instance('searchHelpFieldsResult')/Content/F4OutputValues/Values/item[$position]/SAKNR = "real_value"    (OK!)   


Thank you!
Alexandru


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: repeat bug?!

Erik Bruchez
Administrator
All,

Here is how the expression should be written:

instance('searchHelpFieldsResult')/Content/F4OutputValues/Values/item[$position]/*[local-name()
= $resultFieldName]

Say $resultFieldName contains a string 'foobar'. Then writing the
original expression would be the same as:

instance('searchHelpFieldsResult')/Content/F4OutputValues/Values/item[$position]/'foobar'

This is different from writing:

instance('searchHelpFieldsResult')/Content/F4OutputValues/Values/item[$position]/foobar

In the first case, the expression returns a string called 'foobar',
for each selected <item> element.

In the second case, the last part of the expression is an element
test: it tests for elements <foobar> children of the selected <item>
element and returns them.

On the other hand, *[local-name() = 'foobar'] conceptually works in two steps:

* first it selects all children elements children of the selected <item> element
* then it filters them if their local name is 'foobar'

You could also write:

*[name() = 'foobar']

if you want to check on the full qualified name of the element.

-Erik

On Mon, Feb 8, 2010 at 11:37 AM, Alexandru Ionita
<[hidden email]> wrote:

>
>
> Hello guys
> We are facing a very unpleasant situation and we think this is a bug.
> We have the following reference:
>
> <xf:output
> ref="instance('searchHelpFieldsResult')/Content/F4OutputValues/Values/item[$position]/$resultFieldName"></xf:output>
>
> both variables $position and $resultFieldName are visible in this scope
> but this expression will return the value stored in $resultFieldName !!!
> If I replace the variable reference ($resultFieldName) with the value
> itself, everything works great.
> eg:
> $resultFieldName -> "SAKNR"
> instance('searchHelpFieldsResult')/Content/F4OutputValues/Values/item[$position]/$resultFieldName
>  = "SAKNR"    !!!!!!!!
> instance('searchHelpFieldsResult')/Content/F4OutputValues/Values/item[$position]/SAKNR
> = "real_value"    (OK!)
>
> Thank you!
> Alexandru
>
> --
> You receive this message as a subscriber of the [hidden email] mailing
> list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws