This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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


Hi Evan,

> What I naturally tried was:
>
> @*[self::xyz:foo]
>
> But that doesn't work, because the self axis will *never* select
> attributes except with self::node(), being that *element* is the
> principal node type of the self axis and there is no attribute()
> node test (not that that would be useful).

An attribute() node test would be useful in this context if it
operated in the same way as processing-instruction() i.e. if you could
pass a string as a value to it and that would be used to test the name
of the attribute:

  @*[self::attribute('xyz:foo')]

Of course the string could be a variable:

  @*[self::attribute($attr)]

and then you could do things like:

  @attribute($attr)

rather than:

  @*[name() = $attr]

The big trouble would be handling namespaces with this syntax - is the
prefix in the name string resolved according to the current namespace
declarations within the stylesheet or is it a match between the
actual qualified name of the attribute in the source and the string
that you have?

Of course if you had that kind of node test for attributes, then you
may as well have one for elements as well.  I believe that this kind
of node test syntax was in an early WD of the XPath Rec.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]