Subject: Re: [xsl] Determining the context node From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Wed, 12 Apr 2006 20:46:21 -0400 |
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.
<xsl:if test="self::EventWebsite"> ...true when the current node is EventWebsite in no namespace...
<xsl:if test="self::b:figure" xmlns:b="urn:x-allison"> ...true when the current node is {urn:x-allison}:figure...
-- Registration open for XSLT/XSL-FO training: Wash.,DC 2006-06-12/16 Also for XML/XSLT/XSL-FO training:Birmingham,England 2006-05-22/25 Also for XSLT/XSL-FO training: Copenhagen,Denmark 2006-05-08/11 World-wide on-site corporate, govt. & user group XML/XSL training. G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Cancer Awareness Aug'05 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Determining the context node, Allison Bloodworth | Thread | Re: [xsl] Determining the context n, Evan Lenz |
[xsl] Determining the context node, Allison Bloodworth | Date | Re: [xsl] Determining the context n, Evan Lenz |
Month |