Subject: RE: Determining the context node
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 13 Apr 2006 11:23:58 +0100
|
You can get the name of the context node using name(). Saxon has an
extension function saxon:path() which gives you a full path to a node; I
believe there are portable solutions to this problem at
http://www.dpawson.co.uk/xsl/sect2/N6077.html
but it seems to be down.
Michael Kay
http://www.saxonica.com/
> -----Original Message-----
> From: Allison Bloodworth [mailto:abloodworth@xxxxxxxxxxxx]
> Sent: 13 April 2006 01:15
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Determining the context node
>
> Hi,
>
> I sometimes get confused about what the context node is when
> I'm writing a
> complicated XSL stylesheet. I'm wondering if someone can
> suggest an easy way
> to determine what node I'm on (e.g. by using some code to
> print this info
> out to my output)?
>
> I've tried xsl:copy, xsl:copy-of, and xsl:value-of, but I
> don't want to know
> the value of the element, I want to know the name of the
> element (e.g. for
> <EventWebsite>www.berkeley.edu</EventWebsite> I want to know
> that I'm on
> EventWebsite, not that the value is www.berkeley.edu). Also,
> because most of
> my elements contain other elements instead of text, often
> doing xsl:copy
> (which is more rational than using copy-of) doesn't get me anything. I
> assume there's probably an easy XPath expression for this,
> but even after
> doing quite a bit of research I can't find it.
>
> Thanks for any suggestions on this!
>
> Allison Bloodworth
> Principal Administrative Analyst
> Technology Program Office
> University of California, Berkeley
> (415) 377-8243
> abloodworth@xxxxxxxxxxxx
|