xsl-list
[Top] [All Lists]

Re: [xsl] top ancestor value

2006-10-20 15:03:04
I think I need the first one (which worked YAY!) because the structure is like this:
<sitemap>
   <section id=1>
      <section id=16>
      <section id=17>
      .....
   <section id=2>
      <section id=30>
      ...
</sitemap>

with 1, 16, and 17 needing the folder for 1 and 2 and 30 needing the folder for 2.

Although I could be missing something basic. None of the tutorials I found deal with nested data so I'm not sure how to apply it. They also don't seem to use namespaces.

Thanks for answering my basic questions.

Joelle



David Carlisle wrote:
I tried using youth:ancestor-or-self::section[last()]/folder, but that gives me a validation error.

its the element name in the namepsace,not the axis

ancestor-or-self::youth:section[last()]/youth:folder

(guessing, as you didn't show the input)

on the otehr hand rather than going all the way up each time, you could
just start from the other end

/a/b/youth:section/youth:folder

if th etop level section is at some known position relative to th eroot
of the document.

As its a constant you can make it a global variable

<xsl:variable name="path" select="/a/b/youth:section/youth:folder"/>

then you can just use $path

ie replace by

 <a href="{$path}/{youth:url}">

David

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

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