templates and iterating attributes from xpath expression

View: New views
7 Messages — Rating Filter:   Alert me  

templates and iterating attributes from xpath expression

by rvj-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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?







 


_______________________________________________
dev-tech-xml mailing list
dev-tech-xml@...
https://lists.mozilla.org/listinfo/dev-tech-xml

Re: templates and iterating attributes from xpath expression

by rvj-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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" <rvj@...> wrote in message
news:bY6dnRW2zMqWsbjUnZ2dnUVZ_t7inZ2d@......

>
> 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?
>
>
>
>
>
>
>
>
>
>


_______________________________________________
dev-tech-xml mailing list
dev-tech-xml@...
https://lists.mozilla.org/listinfo/dev-tech-xml

Re: templates and iterating attributes from xpath expression

by rvj-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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




"rvj" <rvj@...> wrote in message
news:_dadnexv1J9D9bjUnZ2dnUVZ_sTinZ2d@......

> 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" <rvj@...> wrote in message
> news:bY6dnRW2zMqWsbjUnZ2dnUVZ_t7inZ2d@......
>>
>> 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?
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>
>


_______________________________________________
dev-tech-xml mailing list
dev-tech-xml@...
https://lists.mozilla.org/listinfo/dev-tech-xml

Re: templates and iterating attributes from xpath expression

by Martin Honnen-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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/
_______________________________________________
dev-tech-xml mailing list
dev-tech-xml@...
https://lists.mozilla.org/listinfo/dev-tech-xml

Re: templates and iterating attributes from xpath expression

by rvj-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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" <mahotrash@...> wrote in message
news:bYydnUzyeb5TDrjUnZ2dnUVZ_gydnZ2d@......

> 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/ 


_______________________________________________
dev-tech-xml mailing list
dev-tech-xml@...
https://lists.mozilla.org/listinfo/dev-tech-xml

Re: templates and iterating attributes from xpath expression

by Martin Honnen-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.


--

        Martin Honnen
        http://JavaScript.FAQTs.com/
_______________________________________________
dev-tech-xml mailing list
dev-tech-xml@...
https://lists.mozilla.org/listinfo/dev-tech-xml

Re: templates and iterating attributes from xpath expression

by rvj-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Great !

"Martin Honnen" <mahotrash@...> wrote in message
news:4-2dnaOspIMVArfUnZ2dnUVZ_uGdnZ2d@......

> 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.
>
>
> --
>
> Martin Honnen
> http://JavaScript.FAQTs.com/ 


_______________________________________________
dev-tech-xml mailing list
dev-tech-xml@...
https://lists.mozilla.org/listinfo/dev-tech-xml