Re: [xsl] <xsl:number> in XPath

Subject: Re: [xsl] <xsl:number> in XPath
From: xptm@xxxxxxx
Date: Thu, 9 Dec 2004 16:19:53 +0000
I
think
i
finally
got
what
i
want,
at
least
for
now.

Just
to
recap,
let
me
say
what
i
wanted,
in
plain
english,
and
please
remind
that
nor
XSL
nor
English
are
my
native
language...

From
a
n-nested
three
of
nodes,
I
want
to
process
all
<xxx>
nodes
that
are
at
the
1st
level
of
deepness,
plus
the
<xxx>
at
absolute
position
number
n
(absolute
position
being
the
position
from
the
top
ignoring
deepness,
or
the
distance
of
the
node
to
the
root
in
<xxx>
count),
plus
all
the
ancestors
and
immediate
chldren
of
this
last
node.

To
my
understanding
i
canot
use
the
axis
in
the
select
xpath
because
they
rely
on
a
context
node,
wich
i
don't
have
at
the
time.

So
i
translate
this
to

<xsl:apply-templates
select="/menus/menu
|
(//menu)[$pos]"
/>

and
later
inside
the
template
(when
the
context
node
is
(//menu)[$pos]
)

<xsl:for-each
select="ancestor::menu/menu
|
self::menu
|
menu">

I
don't
know
if
this
is
the
most
correct
way
to
do
it.
If
someone
care
tpo
comment
i'll
apreciate,
because
i'm
a
XSLT
fan
but
a
kind
of
newby
also.

The
test
case:
http://gti.clientes.gtinformatica.pt/Site/Java/tap.html

The
XML:
http://gti.clientes.gtinformatica.pt/Site/Java/Menus.xml

The
XSL:
http://gti.clientes.gtinformatica.pt/Site/Java/dmenus.xsl

And
a
special
thank
to
Dave.

Regards.




Quoting
Antsnio
Mota
<xptm@xxxxxxx>:

>
My
God,
allmost
a
day
i've
been
trying
around
position(),
and
i
forgot
to
put
>
the
//menu
inside
parenthesis...
>
>
I
just
want
to
kick
myself...
I'm
going
to
do
it!
>
>
Thanks
David,
you're
been
a
real
help
in
the
past
two
days.
>
>
>
>
Citando
David
Carlisle
<davidc@xxxxxxxxx>:
>
>
>
>
>



Something
like
>
>
>
>


select="//menu[absoluteposition()=$pos]
>
>
>
>

(//menu)[position()=$pos]
>
>
>
>
or
if
$pos
is
a
number
(rather
than
just
a
string
that
looks
like
a
>
>
number)
>
>
>
>
>
>
>
>

(//menu)[$pos]
>
>
>
>
David
>
>
>
>
________________________________________________________________________
>
>
This
e-mail
has
been
scanned
for
all
viruses
by
Star.
The
>
>
service
is
powered
by
MessageLabs.
For
more
information
on
a
proactive
>
>
anti-virus
service
working
around
the
clock,
around
the
globe,
visit:
>
>
http://www.star.net.uk
>
>
________________________________________________________________________
>
>
>
>
--~------------------------------------------------------------------
>
>
XSL-List
info
and
archive:

http://www.mulberrytech.com/xsl/xsl-list
>
>
To
unsubscribe,
go
to:
http://lists.mulberrytech.com/xsl-list/
>
>
or
e-mail:
<mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>
>
>
--~--
>
>
>
>
>
>
>
--~------------------------------------------------------------------
>
XSL-List
info
and
archive:

http://www.mulberrytech.com/xsl/xsl-list
>
To
unsubscribe,
go
to:
http://lists.mulberrytech.com/xsl-list/
>
or
e-mail:
<mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>
>
--~--
>
>





O SAPO ja esta livre de vmrus com a Panda Software, fique vocj tambim!
Clique em: http://antivirus.sapo.pt

Current Thread