xsl-list
[Top] [All Lists]

Re: [xsl] XSL/XPath to generate a list of ancestors?

2008-05-12 10:24:01

On May 12, 2008, at 10:15 AM, Martin Honnen wrote:

Nathan Potter wrote:
On May 12, 2008, at 10:05 AM, Martin Honnen wrote:
Nathan Potter wrote:

I tried this:
     <xsl:template match="*" name="fullNameWorker" mode="fullName">
        <xsl:if test="generate-id(.)!=generate-id(/)">

You have a template for element nodes (match="*") so why do you test
  generate-id(.) != generate-id(/)
? An element (.) is never a root node (/).
Because the template recursively ascends the document I need to test that I have arrived at the top.

But your template with match="*" is never processed for the root node which is match="/". If anything makes sense then
  generate-id(.) != generate-id(/*)
as that compares the matched element to the root element (which is different from the root node).

Ahhh! That's it. Since I know what the root element is always a myns:Dataset is I can say this:

generate-id(.) != generate-id(/myns:Dataset)


And that stops the recursion problem, and it works.





--

        Martin Honnen
        http://JavaScript.FAQTs.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>
--~--


============================================================
Nathan Potter                 Oregon State University, COAS
ndp at coas.oregonstate.edu   104 Ocean. Admin. Bldg.
541 737 2293 voice            Corvallis, OR   97331-5503
541 737 2064 fax



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