Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

templates and iterating attributes from xpath expression

3 views
Skip to first unread message

rvj

unread,
Nov 20, 2008, 4:21:17 AM11/20/08
to

I doubt it can be done but ..........

I ve been trying to see if ASSIGN might return a list of current attributes
(or ideally a specific ndexed attribute)

Having hunted around I came across

http://www.velocityreviews.com/forums/t167301-seek-xpath-expression-where-an-attribute-name-is-a-regular-expression.html

which seems to suggest that

<assign var="?findattributenames"
expr="contains(local-name(@*),'gender')"/>

should select the attribute 'gender' (using people.xml). this returns
false.

Is this correct?


rvj

unread,
Nov 20, 2008, 8:40:47 AM11/20/08
to
OK seems Ive found a working solution since @* defaults to the first
attribute which is good enough for my needs

- if this is a bug PLEASE DONT FIX IT!!

"rvj" <r...@rolemodels.net> wrote in message
news:bY6dnRW2zMqWsbjU...@mozilla.org...

rvj

unread,
Nov 20, 2008, 9:11:36 AM11/20/08
to

seems not - seems @*[index number] is the syntax I was looking for !


"rvj" <r...@rolemodels.net> wrote in message

news:_dadnexv1J9D9bjU...@mozilla.org...

Martin Honnen

unread,
Nov 20, 2008, 11:43:57 AM11/20/08
to
rvj wrote:
> OK seems Ive found a working solution since @* defaults to the first
> attribute which is good enough for my needs

>> expr="contains(local-name(@*),'gender')"/>

@* selects a node-set of all attribute but local-name(@*) returns the
name of the first node in that node-set.


--

Martin Honnen
http://JavaScript.FAQTs.com/

rvj

unread,
Nov 24, 2008, 3:07:55 AM11/24/08
to
thanks - just about getting there

ps had any problem with parent syntax ? ../@*[1] seems ok but problems
with

a) ../name()
b) ../name(@*[1])

"Martin Honnen" <maho...@yahoo.de> wrote in message
news:bYydnUzyeb5TDrjU...@mozilla.org...

Martin Honnen

unread,
Nov 24, 2008, 7:35:17 AM11/24/08
to
rvj wrote:
> thanks - just about getting there
>
> ps had any problem with parent syntax ? ../@*[1] seems ok but problems
> with
>
> a) ../name()
name(..)
gives you the name of the parent in XPath 1.0.

> b) ../name(@*[1])

name(../@*[1])
gives you the name of the first attribute of the parent in XPath 1.0.

The syntax you have choosen is allowed in XPath 2.0 and XQuery 1.0 but
not in XPath 1.0.

rvj

unread,
Nov 24, 2008, 10:22:26 AM11/24/08
to
Great !

"Martin Honnen" <maho...@yahoo.de> wrote in message

news:4-2dnaOspIMVArfU...@mozilla.org...

0 new messages