This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: I mean self::* doesn't select attributes :(
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: Re: [xsl] I mean self::* doesn't select attributes :(
- From: "G. Ken Holman" <gkholman at CraneSoftwrights dot com>
- Date: Tue, 24 Apr 2001 16:56:27 -0400
- References: <BNEMICIEADHDDOIKLHNCGEDBECAA.elenz@xyzfind.com>
- Reply-To: xsl-list at lists dot mulberrytech dot com
At 01/04/24 13:24 -0700, Evan Lenz wrote:
><correction>
>Anyone else have headaches with not being able to do @*[not(self::xyz:* or
>self::abc:*)] ?
>
>Anything more elegant than the following two solutions?
>
>@*[not(namespace-uri()='&xyzURI;' or namespace-uri()='&barURI;')]
>
>@*[not(generate-id()=generate-id(../@xyz:*) or
>generate-id()=generate-id(../@abc:*))]
>
>I'd love to be missing something.
></correction>
This is an excerpt from pages 182/183 of my book:
Practical Transformation Using XSLT and XPath
(XSL Transformations and the XML Path Language)
Ninth Edition - 2001-01-19 - ISBN 1-894049-06-3
Copyright (c) 2001 Crane Softwrights Ltd.
/ 375 Pages / Subscription price includes free updates
/ / and separate copy of all example files.
/ / Free 137-page download preview excerpt.
These pages describe the way to do a test of the current node as being one
of every node type of XPath ... the following are the attribute tests I
suggest for the current node:
<--specific namespaced-unqualified attribute-->
<xsl:when test="count(.|../@version)=count(../@version)">
<xsl:text>version attribute </xsl:text>
</xsl:when>
<!--specific namespace-qualified attribute-->
<xsl:when test="count(.|../@book:ref)=count(../@book:ref)">
<xsl:text>book:ref attribute </xsl:text>
</xsl:when>
<!--any attribute-->
<xsl:when test="count(.|../@*)=count(../@*)">
<xsl:text>attribute </xsl:text>
</xsl:when>
The use above of the XPath axes handles the prefix/URI issue.
I hope this helps.
....................... Ken
--
G. Ken Holman mailto:gkholman@CraneSoftwrights.com
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