Re: Re: Re: How to create a combined xpath expression

Posted by Alessandro Vernet on
URL: https://discuss.orbeon.com/How-to-create-a-combined-xpath-expression-tp3027887p3029613.html

Heinrich,

If you're looking for a book, without any hesitation, I would
recommend Michael Kay's book about XSLT 2.0 and XPath 2.0:

http://www.amazon.com/XSLT-XPath-Programmers-Reference-Programmer/dp/0470192747

Mike worked on those specifications, and implemented the excellent
XPath 2.0 engine used by Orbeon Forms.

Alex

On Fri, Nov 5, 2010 at 4:01 PM, Heinrich Götzger <[hidden email]> wrote:

> Hi Tambet,
>
> thanks for your answer. Worked as expected!
>
> The dynamic is because we don't know what's in the items, this changes from
> call to call.
>
> (And that's why we use
> <xf:repeat nodeset="./*[node()]" id="table-item">
> in the inner loop. This omits the empty tags. That wasn't clear in the
> example.)
>
> But:
> Where can I find documentation on how to build such XPath. Or some
> introduction to have more chances to get things like this running at my own
>
> Thanks
>
> Cheers
>
> Heinrich
>
>
> On 11/05/10 07:08, Tambet Matiisen wrote:
>>
>> Hi Heinrich,
>>
>> I made two examples for you - one is dynamic as you wished and another
>> is with fixed elements, which is IMHO simpler and easier to maintain.
>> Both seem to give the correct answer.
>>
>> Regards,
>> Tambet
>>
>> On 5.11.2010 0:05, Heinrich Götzger wrote:
>>>
>>> Hi,
>>>
>>> I try to find a way to build a xpath-expression which will be created
>>> within a repeat-loop dynamically during page creation. But this seems
>>> not working for some reason.
>>>
>>> The goal is to get a dynamic data structure displayed in a table.
>>>
>>> An example of my xhtml-file is at the end of the mail.
>>>
>>> Now I get a table like this (the second column ref is for testing
>>> only) (not OK):
>>>
>>> item: 1
>>> label: Label A Label B Label C Label D ref: A value: 10
>>> label: Label A Label B Label C Label D ref: B value: value B
>>> label: Label A Label B Label C Label D ref: C value: C
>>> item: 2
>>> label: Label A Label B Label C Label D ref: A value: 10
>>> label: Label A Label B Label C Label D ref: C value: C
>>> label: Label A Label B Label C Label D ref: D value: value D
>>>
>>>
>>> But I want a table like this
>>> (OK):
>>>
>>> item: 1
>>> label: Label A value: 10
>>> label: Label B value: value B
>>> label: Label C value: C
>>> item: 2
>>> label: Label A value: 10
>>> label: Label C value: C
>>> label: Label D value: value D
>>>
>>>
>>> I'm not sure how to write the xpath expression to get the desired
>>> label from my labels-instance which matches the value-item in the table.
>>>
>>> The construct for the label-column is not working as expected.
>>> Why?
>>>
>>> Where can I get more information on how to get this running?
>>>
>>> How can I build the xpath from the fixed part
>>> 'instance('labels')/item' and the changing part from the valueTag?
>>>
>>> What I get is either _all_ labels at once or just the tag-name, but
>>> not the text of my label-tag.
>>>
>>> Thanks for ideas
>>>
>>> Cheers
>>>
>>> Heinrich
>>>
>>
>
>
> --
> Before printing this e-mail, think about our environmental responsibility.
>
>
> --
> 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
>
>


--
Orbeon Forms - Web forms, open-source, for the Enterprise -
http://www.orbeon.com/
My Twitter: http://twitter.com/avernet


--
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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet