xsl-list
[Top] [All Lists]

Re: <xsl:number> in XPath

2004-12-09 09:19:53
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
António
Mota
<xptm(_at_)sapo(_dot_)pt>:


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(_at_)nag(_dot_)co(_dot_)uk>:








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(_at_)lists(_dot_)mulberrytech(_dot_)com>


--~--







--~------------------------------------------------------------------

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(_at_)lists(_dot_)mulberrytech(_dot_)com>

--~--







O SAPO já está livre de vírus com a Panda Software, fique você também!
Clique em: http://antivirus.sapo.pt

--~------------------------------------------------------------------
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(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>