Re: [xsl] I mean self::* doesn't select attributes :(

Subject: Re: [xsl] I mean self::* doesn't select attributes :(
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 25 Apr 2001 12:33:09 -0400
At 01/04/25 07:21 -0700, Joe English wrote:
Evan Lenz wrote:
>
> Removing unneeded complexity from my previous examples, I now have the
> following approaches to testing whether the attribute context node's name is
> a particular namespaced name:
>
> @*[local-name()='foo' namespace-uri()='&xyzURI;']
> @*[generate-id()=generate-id(../@xyz:foo)]
> @*[count(.|../@xyz:foo)=count(../@xyz:foo)] (Thanks Ken)
[...]
> What I naturally tried was:
> @*[self::xyz:foo]
> But that doesn't work, [...]



Wouldn't attribute::xyz:foo or @xyz:foo work?

Not if you are already sitting at an attribute node as the current node.


If you want to check the current node is an attribute node (say from within a predicate or within a template rule that matches many different types of nodes), then you need the machinations to get what you need.

In Evan's example he wanted a test to be done in the predicate when the current node is an attribute node.

............... Ken


-- 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 (Fax:-0995) Web site: XSL/XML/DSSSL/SGML/OmniMark services, training, products. Book: Practical Transformation Using XSLT and XPath ISBN 1-894049-06-3 Article: What is XSLT? http://www.xml.com/pub/2000/08/holman/index.html Next public instructor-led training: 2001-05-01,05-14,05-15,05-16, - 05-17,05-21,05-22,06-18,06-21,07-20,07-21,09-19

Training Blitz: 3-days XSLT/XPath, 2-days XSLFO in Ottawa 2001-06-18/22


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread