[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

Absolute path of a selected xml snippet

Nilo Sergio de Assis Junior tomsawyerrj at gmail.com
Thu Feb 4 16:06:38 PST 2010


  Absolute path of a selected xml snippet
Ricardo

o pessoal citou algumas  funções q vc poderia usar  , mas  se for o caso  vc
pode criar  algo customizado tambem , usando  o eixo  ancestor-or-self e  as
propriedades name() ou local-name()

algo tipo :

for  $entrada in doc("testeGroup.xml")/*   return

    let $elementoProcurado := 'B' , $posicao :='1'
    for $i  in $entrada//*[name()=
$elementoProcurado][position()=1]/ancestor-or-self::node()  return
        if (name($i)!=$elementoProcurado) then
        concat(name($i),'/')
        else
        name($i)


passando como entrada o nome do elementoe  a posição   dele....

espero ter ajudado

-------------------

Ricardo

You can use  a  function  from  functx  or  try to make a  customized  one
using   ancestor-or-self  axis  , and  name()  or local-name() properties...
something like:

for  $entrada in doc("testeGroup.xml")/*   return

    let $elementoProcurado := 'B' , $posicao :='1'
    for $i  in $entrada//*[name()=
$elementoProcurado][position()=1]/ancestor-or-self::node()  return
        if (name($i)!=$elementoProcurado) then
        concat(name($i),'/')
        else
        name($i)




Em 4 de fevereiro de 2010 11:14, Ricardo Queirós
<http://x-query.com/mailman/listinfo/talk>escreveu:

> Hi to all,
>
> I have the following XML document in a text box:
>
> <A>
> <B> 1 </ B>
> <B> 2 </ B>
> </ A>
>
> By selecting "<B> 1 </ B>"
>
> I want to get your absolute path XPath, ie, "/A/B [1]"
> You can do this using XQuery?
> What do you advise?
>
> Best regards!
>
> --
> Ricardo Queirós
>
> _______________________________________________
> http://x-query.com/mailman/listinfo/talk
> http://x-query.com/mailman/listinfo/talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://x-query.com/pipermail/talk/attachments/20100204/674fddf8/attachment.htm


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.