|
[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 snippetNilo Sergio de Assis Junior tomsawyerrj at gmail.comThu Feb 4 16:06:38 PST 2010
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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








